When I die, no matter how if it's a command (/kill) or getting die from falling down it always takes me to this screen:
Here is my OnPlayerDeath, OnPlayerSpawn and OnPlayerRequestClass codes:
OnPlayerRequestClass
OnPlayerSpawn
OnPlayerDeath
Thanks for the help!
Here is my OnPlayerDeath, OnPlayerSpawn and OnPlayerRequestClass codes:
OnPlayerRequestClass
Code:
public OnPlayerRequestClass(playerid, classid)
{
TogglePlayerSpectating(playerid, 1);
if(pInfo[playerid][Login]==1 && pInfo[playerid][RequestTeam]==0)
{
OnPlayerSpawn(playerid);
return 1;
}
else if(pInfo[playerid][Login]==0 && pInfo[playerid][RequestTeam]==1)
{
ShowPlayerDialog(playerid, TEAM_DIALOG, DIALOG_STYLE_LIST, "Choose Team..",""cblue"United Stats America\n"cgreen"Europe\n"cyellow"Arabian\n"csoviet"Soviet\n"cgermany"Germany\n"caust"Australia ","Select","");
}
if(pInfo[playerid][RequestClass]==1)
{
ShowPlayerDialog(playerid, CLASS_DIALOG, DIALOG_STYLE_LIST,"Choose Class..","Assault - Rank 0\nSniper - Rank 0\nPilot - Rank 6\nEngineer - Rank 5\nJetTrooper - Rank 6\nSupport - Rank 5\nSpy - Rank 7\nDonor - For Donators only","Select","Back");
}
return 1;
}
Code:
public OnPlayerSpawn(playerid)
{
SetPlayerHealth(playerid, 99999);
SendClientMessage(playerid, GREEN, "You have Anti-Spawn kill for 10 seconds.");
spawnkilltimer[playerid] = SetTimerEx("AntiSK", 10000, false, "i", playerid);
if(pInfo[playerid][Jailed] == 1)
{
ResetPlayerWeapons(playerid);
SetPlayerInterior(playerid, 6);
SetPlayerPos(playerid, 264.6707,77.4835,1001.0391);
SetPlayerVirtualWorld(playerid, 97);
}
if(pInfo[playerid][Duty] == 1)
{
AllowAdminTeleport(1);
}
if(synccount==1)
{
SetPlayerPos(playerid, GetPVarFloat(playerid, "syncx"), GetPVarFloat(playerid, "syncy"), GetPVarFloat(playerid, "syncz"));
SetPlayerHealth(playerid,GetPVarFloat(playerid, "synch"));
SetPlayerArmour(playerid, GetPVarFloat(playerid, "synca"));
SetPlayerSkin(playerid, skin[playerid]);
GameTextForPlayer(playerid, "~r~Synced!", 2000, 3);
for (new i = 0; i <= 12; i++)
{
GivePlayerWeapon(playerid,weapons[i][0], weapons[i][1]);
}
KillTimer(spawnkilltimer[playerid]);
synccount=0;
return 1;
}
if(pInfo[playerid][Team] == USA)
{
SetPlayerTeam(playerid, USA);
SetPlayerColor(playerid, BLUE);
SetPlayerPos(playerid, 957.9977,2486.3159,10.9533);
SetPlayerFacingAngle(playerid,179.2086);
SetPlayerSkin(playerid, 287);
}
if(pInfo[playerid][Team] == Europe)
{
SetPlayerTeam(playerid, Europe);
SetPlayerColor(playerid, GREEN);
SetPlayerPos(playerid, -19.2288,1176.5468,19.5634);
SetPlayerSkin(playerid, 73);
}
if(pInfo[playerid][Team] == Arabian)
{
SetPlayerTeam(playerid, Arabian);
SetPlayerColor(playerid, ORANGE);
AllowAdminTeleport(0);
SetPlayerSkin(playerid, 179);
}
if(pInfo[playerid][Team] == Soviet)
{
SetPlayerTeam(playerid, Soviet);
SetPlayerColor(playerid, 0xDD0000FF);
AllowAdminTeleport(0);
SetPlayerSkin(playerid, 285);
}
if(pInfo[playerid][Team] == Germany)
{
SetPlayerTeam(playerid, Germany);
SetPlayerColor(playerid, 0x6C00D9FF);
AllowAdminTeleport(0);
SetPlayerSkin(playerid, 124);
}
if(pInfo[playerid][Team] == Australia)
{
SetPlayerTeam(playerid, Australia);
SetPlayerColor(playerid, 0x4A9595FF);
SetPlayerPos(playerid, 0, 0, 0);
AllowAdminTeleport(0);
SetPlayerSkin(playerid, 124);
}
if(pInfo[playerid][Class] == ASSAULT)
{
SendClientMessage(playerid, -1,"You have chosen the Assault class");
SendClientMessage(playerid, -1,"BONUS: No extra bonus with this class");
GivePlayerWeapon(playerid, 24, 200);
GivePlayerWeapon(playerid, 27, 200);
GivePlayerWeapon(playerid, 31, 400);
}
if(pInfo[playerid][Class] == SNIPER)
{
SendClientMessage(playerid, -1,"You have chosen the Sniper class");
SendClientMessage(playerid, -1,"BONUS: Invisible on map");
GivePlayerWeapon(playerid, 4, 1);
GivePlayerWeapon(playerid, 23, 100);
GivePlayerWeapon(playerid, 29, 200);
GivePlayerWeapon(playerid, 34, 150);
if(pInfo[playerid][Team]==USA)
{
SetPlayerColor(playerid, 0x4B6FFA00);
}
else if(pInfo[playerid][Team]==Europe)
{
SetPlayerColor(playerid, 0x15FF0000);
}
else if(pInfo[playerid][Team]==Arabian)
{
SetPlayerColor(playerid, 0xFF641A00);
}
else if(pInfo[playerid][Team]==Germany)
{
SetPlayerColor(playerid, 0x6C00D966);
}
else if(pInfo[playerid][Team]==Soviet)
{
SetPlayerColor(playerid, 0xDD000000);
}
else if(pInfo[playerid][Team]==Australia)
{
SetPlayerColor(playerid, 0x4A959500);
}
}
if(pInfo[playerid][Class] == PILOT)
{
SendClientMessage(playerid, -1,"You have chosen Pilot class");
SendClientMessage(playerid, -1,"BONUS: Can fly heavy air vehicles");
GivePlayerWeapon(playerid, 22, 200);
GivePlayerWeapon(playerid, 25, 200);
GivePlayerWeapon(playerid, 29, 200);
}
if(pInfo[playerid][Class] == ENGINEER)
{
SendClientMessage(playerid, -1,"You have chosen Engineer class");
SendClientMessage(playerid, -1,"BONUS: Can drive rhino");
GivePlayerWeapon(playerid, 24, 200);
GivePlayerWeapon(playerid, 27, 200);
GivePlayerWeapon(playerid, 30, 400);
}
if(pInfo[playerid][Class] == JET)
{
SendClientMessage(playerid, -1,"You have chosen JetTrooper class");
SendClientMessage(playerid, -1,"BONUS: Can use /jetpack to spawn jetpack.");
GivePlayerWeapon(playerid, 32, 400);
GivePlayerWeapon(playerid, 24, 200);
GivePlayerWeapon(playerid, 29, 200);
}
if(pInfo[playerid][Class] == SP)
{
SendClientMessage(playerid, -1,"You have chosen Support class");
SendClientMessage(playerid, -1,"BONUS: Use /Shelp For Supporter Commands.");
}
if(pInfo[playerid][Class] == AG)
{
SendClientMessage(playerid, -1,"You have chosen Spy class");
SendClientMessage(playerid, -1,"BONUS: /Dis to disguise.");
GivePlayerWeapon(playerid, 24, 200);
GivePlayerWeapon(playerid, 27, 200);
GivePlayerWeapon(playerid, 31, 400);
GivePlayerWeapon(playerid, 26, 100);
}
if(pInfo[playerid][Class] == DONOR)
{
SendClientMessage(playerid, -1,"You have chosen Donor class");
SendClientMessage(playerid, -1,"BONUS: Can Drive All Vehicles.");
SendClientMessage(playerid, -1,"Use /DCmds For Donor Commands.");
}
if(pInfo[playerid][Duty] == 1)
{
KillTimer(spawnkilltimer[playerid]);
SetPlayerColor(playerid, PINK);
SetPlayerHealth(playerid, 99999);
GivePlayerWeapon(playerid, 38, 9999);
SetPlayerSkin(playerid, 217);
}
//----------------------------------Ranks-----------------------------------
CheckPlayerRank(playerid);
if(pInfo[playerid][Rank]== RANK_PRIVATE){
Update3DTextLabelText(bubble[playerid], GetPlayerColor(playerid), "Private");
Attach3DTextLabelToPlayer(bubble[playerid], playerid, 0.0, 0.0, 0.3);
TextDrawShowForPlayer(playerid, Star0);
TextDrawHideForPlayer(playerid, Star1);
TextDrawHideForPlayer(playerid, Star2);
TextDrawHideForPlayer(playerid, Star3);
TextDrawHideForPlayer(playerid, Star4);
TextDrawHideForPlayer(playerid, Star5);
TextDrawHideForPlayer(playerid, Star6);
TextDrawHideForPlayer(playerid, Star7);
TextDrawHideForPlayer(playerid, Star8);
}
else if(pInfo[playerid][Rank]== RANK_CORPORAL){
Update3DTextLabelText(bubble[playerid], GetPlayerColor(playerid), "Corporal");
Attach3DTextLabelToPlayer(bubble[playerid], playerid, 0.0, 0.0, 0.3);
TextDrawShowForPlayer(playerid, Star0);
TextDrawShowForPlayer(playerid, Star1);
TextDrawHideForPlayer(playerid, Star2);
TextDrawHideForPlayer(playerid, Star3);
TextDrawHideForPlayer(playerid, Star4);
TextDrawHideForPlayer(playerid, Star5);
TextDrawHideForPlayer(playerid, Star6);
TextDrawHideForPlayer(playerid, Star7);
TextDrawHideForPlayer(playerid, Star8);
}
else if(pInfo[playerid][Rank]== RANK_SERGEANT){
Update3DTextLabelText(bubble[playerid], GetPlayerColor(playerid), "Sergeant");
Attach3DTextLabelToPlayer(bubble[playerid], playerid, 0.0, 0.0, 0.3);
TextDrawShowForPlayer(playerid, Star0);
TextDrawShowForPlayer(playerid, Star1);
TextDrawShowForPlayer(playerid, Star2);
TextDrawHideForPlayer(playerid, Star3);
TextDrawHideForPlayer(playerid, Star4);
TextDrawHideForPlayer(playerid, Star5);
TextDrawHideForPlayer(playerid, Star6);
TextDrawHideForPlayer(playerid, Star7);
TextDrawHideForPlayer(playerid, Star8);
}
else if(pInfo[playerid][Rank]== RANK_OFFICER){
Update3DTextLabelText(bubble[playerid], GetPlayerColor(playerid), "Officer");
Attach3DTextLabelToPlayer(bubble[playerid], playerid, 0.0, 0.0, 0.3);
TextDrawShowForPlayer(playerid, Star0);
TextDrawShowForPlayer(playerid, Star1);
TextDrawShowForPlayer(playerid, Star2);
TextDrawShowForPlayer(playerid, Star3);
TextDrawHideForPlayer(playerid, Star4);
TextDrawHideForPlayer(playerid, Star5);
TextDrawHideForPlayer(playerid, Star6);
TextDrawHideForPlayer(playerid, Star7);
TextDrawHideForPlayer(playerid, Star8);
}
else if(pInfo[playerid][Rank]== RANK_LIEUTENANT){
Update3DTextLabelText(bubble[playerid], GetPlayerColor(playerid), "Lieutenant");
Attach3DTextLabelToPlayer(bubble[playerid], playerid, 0.0, 0.0, 0.3);
TextDrawShowForPlayer(playerid, Star0);
TextDrawShowForPlayer(playerid, Star1);
TextDrawShowForPlayer(playerid, Star2);
TextDrawShowForPlayer(playerid, Star3);
TextDrawShowForPlayer(playerid, Star4);
TextDrawHideForPlayer(playerid, Star5);
TextDrawHideForPlayer(playerid, Star6);
TextDrawHideForPlayer(playerid, Star7);
TextDrawHideForPlayer(playerid, Star8);
}
else if(pInfo[playerid][Rank]== RANK_CAPTAIN){
Update3DTextLabelText(bubble[playerid], GetPlayerColor(playerid), "Captain");
Attach3DTextLabelToPlayer(bubble[playerid], playerid, 0.0, 0.0, 0.3);
TextDrawShowForPlayer(playerid, Star0);
TextDrawShowForPlayer(playerid, Star1);
TextDrawShowForPlayer(playerid, Star2);
TextDrawShowForPlayer(playerid, Star3);
TextDrawShowForPlayer(playerid, Star4);
TextDrawShowForPlayer(playerid, Star5);
TextDrawHideForPlayer(playerid, Star6);
TextDrawHideForPlayer(playerid, Star7);
TextDrawHideForPlayer(playerid, Star8);
}
else if(pInfo[playerid][Rank]== RANK_MAJOR){
Update3DTextLabelText(bubble[playerid], GetPlayerColor(playerid), "Major");
Attach3DTextLabelToPlayer(bubble[playerid], playerid, 0.0, 0.0, 0.3);
TextDrawShowForPlayer(playerid, Star0);
TextDrawShowForPlayer(playerid, Star1);
TextDrawShowForPlayer(playerid, Star2);
TextDrawShowForPlayer(playerid, Star3);
TextDrawShowForPlayer(playerid, Star4);
TextDrawShowForPlayer(playerid, Star5);
TextDrawShowForPlayer(playerid, Star6);
TextDrawHideForPlayer(playerid, Star7);
TextDrawHideForPlayer(playerid, Star8);
}
else if(pInfo[playerid][Rank]== RANK_COLONEL){
Update3DTextLabelText(bubble[playerid], GetPlayerColor(playerid), "Colonel");
Attach3DTextLabelToPlayer(bubble[playerid], playerid, 0.0, 0.0, 0.3);
TextDrawShowForPlayer(playerid, Star0);
TextDrawShowForPlayer(playerid, Star1);
TextDrawShowForPlayer(playerid, Star2);
TextDrawShowForPlayer(playerid, Star3);
TextDrawShowForPlayer(playerid, Star4);
TextDrawShowForPlayer(playerid, Star5);
TextDrawShowForPlayer(playerid, Star6);
TextDrawShowForPlayer(playerid, Star7);
TextDrawHideForPlayer(playerid, Star8);
}
else if(pInfo[playerid][Rank]== RANK_GENERAL){
Update3DTextLabelText(bubble[playerid], GetPlayerColor(playerid), "General");
Attach3DTextLabelToPlayer(bubble[playerid], playerid, 0.0, 0.0, 0.3);
TextDrawShowForPlayer(playerid, Star0);
TextDrawShowForPlayer(playerid, Star1);
TextDrawShowForPlayer(playerid, Star2);
TextDrawShowForPlayer(playerid, Star3);
TextDrawShowForPlayer(playerid, Star4);
TextDrawShowForPlayer(playerid, Star5);
TextDrawShowForPlayer(playerid, Star6);
TextDrawShowForPlayer(playerid, Star7);
TextDrawShowForPlayer(playerid, Star8);
}
//-------Stats info--------//
format(str, SOS, "%i", pInfo[playerid][Kills]);
PlayerTextDrawSetString(playerid, stats3[playerid], str);
format(str, SOS, "%i", pInfo[playerid][Deaths]);
PlayerTextDrawSetString(playerid, stats4[playerid], str);
format(str, SOS, "%i", pInfo[playerid][Score]);
PlayerTextDrawSetString(playerid, stats5[playerid], str);
format(str, SOS, "%s", GetTeamName(playerid));
PlayerTextDrawSetString(playerid, stats10[playerid], str);
format(str, SOS, "%s", GetClassName(playerid));
PlayerTextDrawSetString(playerid, stats11[playerid], str);
format(str, SOS, "%s", GetRankName(playerid));
PlayerTextDrawSetString(playerid, stats12[playerid], str);
PlayerTextDrawShow(playerid, stats0[playerid]);
PlayerTextDrawShow(playerid, stats1[playerid]);
PlayerTextDrawShow(playerid, stats2[playerid]);
PlayerTextDrawShow(playerid, stats3[playerid]);
PlayerTextDrawShow(playerid, stats4[playerid]);
PlayerTextDrawShow(playerid, stats5[playerid]);
PlayerTextDrawShow(playerid, stats6[playerid]);
PlayerTextDrawShow(playerid, stats7[playerid]);
PlayerTextDrawShow(playerid, stats8[playerid]);
PlayerTextDrawShow(playerid, stats9[playerid]);
PlayerTextDrawShow(playerid, stats10[playerid]);
PlayerTextDrawShow(playerid, stats11[playerid]);
PlayerTextDrawShow(playerid, stats12[playerid]);
return 1;
}
forward AntiSK(playerid);
public AntiSK(playerid)
{
SetPlayerHealth(playerid, 100);
SendClientMessage(playerid, RED, "Your Anti-Spawn kill ended.");
HAtimer[playerid]=SetTimerEx("AntiHAtimer",100,0,"i",playerid);
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
IsDead[playerid] = true;
//--------------Stats Info------------------//
PlayerTextDrawHide (playerid, stats0[playerid]);
PlayerTextDrawHide (playerid, stats1[playerid]);
PlayerTextDrawHide (playerid, stats2[playerid]);
PlayerTextDrawHide (playerid, stats3[playerid]);
PlayerTextDrawHide (playerid, stats4[playerid]);
PlayerTextDrawHide (playerid, stats5[playerid]);
PlayerTextDrawHide (playerid, stats6[playerid]);
PlayerTextDrawHide (playerid, stats7[playerid]);
PlayerTextDrawHide (playerid, stats8[playerid]);
PlayerTextDrawHide (playerid, stats9[playerid]);
PlayerTextDrawHide (playerid, stats10[playerid]);
PlayerTextDrawHide (playerid, stats11[playerid]);
PlayerTextDrawHide (playerid, stats12[playerid]);
//--------------------------------------------//
for(new i = 0; i < MAX_ZONES; ++i)
{
if(IsPlayerCapturing[playerid]{ i })
{
StopCaptureArea(playerid,i);
}
if(IsPlayerHelping[playerid]{ i })
{
IsPlayerHelping[playerid]{ i } = false;
}
}
DestroyPlayerProgressBar(playerid, PlayerBar:zonebar);
SendDeathMessage(killerid, playerid, reason);
KillTimer(HAtimer[playerid]);
// GameTextForPlayer(playerid, "~r~Wasted", 5000, 2);
pInfo[playerid][Joined]=0;
pInfo[playerid][Deaths] += 1;
pInfo[killerid][Score] +=2;
pInfo[killerid][Kills] += 1;
new rand = RandomEx(2500,5001);
format(str,SOS,"You have killed %s and you earned 2 Score and %i$ !",pInfo[playerid][Name],rand);
SendClientMessage(killerid,GREEN,str);
AllowAdminTeleport(0);
SaveStats(playerid);
return 1;
}
Code:
public OnPlayerDeath(playerid, killerid, reason)
{
IsDead[playerid] = true;
//--------------Stats Info------------------//
PlayerTextDrawHide (playerid, stats0[playerid]);
PlayerTextDrawHide (playerid, stats1[playerid]);
PlayerTextDrawHide (playerid, stats2[playerid]);
PlayerTextDrawHide (playerid, stats3[playerid]);
PlayerTextDrawHide (playerid, stats4[playerid]);
PlayerTextDrawHide (playerid, stats5[playerid]);
PlayerTextDrawHide (playerid, stats6[playerid]);
PlayerTextDrawHide (playerid, stats7[playerid]);
PlayerTextDrawHide (playerid, stats8[playerid]);
PlayerTextDrawHide (playerid, stats9[playerid]);
PlayerTextDrawHide (playerid, stats10[playerid]);
PlayerTextDrawHide (playerid, stats11[playerid]);
PlayerTextDrawHide (playerid, stats12[playerid]);
//--------------------------------------------//
for(new i = 0; i < MAX_ZONES; ++i)
{
if(IsPlayerCapturing[playerid]{ i })
{
StopCaptureArea(playerid,i);
}
if(IsPlayerHelping[playerid]{ i })
{
IsPlayerHelping[playerid]{ i } = false;
}
}
DestroyPlayerProgressBar(playerid, PlayerBar:zonebar);
SendDeathMessage(killerid, playerid, reason);
KillTimer(HAtimer[playerid]);
// GameTextForPlayer(playerid, "~r~Wasted", 5000, 2);
pInfo[playerid][Joined]=0;
pInfo[playerid][Deaths] += 1;
pInfo[killerid][Score] +=2;
pInfo[killerid][Kills] += 1;
new rand = RandomEx(2500,5001);
format(str,SOS,"You have killed %s and you earned 2 Score and %i$ !",pInfo[playerid][Name],rand);
SendClientMessage(killerid,GREEN,str);
AllowAdminTeleport(0);
SaveStats(playerid);
return 1;
}