SA-MP Forums Archive
hunted system - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: hunted system (/showthread.php?tid=503278)



hunted system - AhmedMohamed - 28.03.2014

I made hunted system for my server , for any one dun know what is the hunted system : any admin sets some one as a hunted and who kill that hunted will get auto prize, i made the auto prize in OnPlayerDeath callback like that:
pawn Код:
f(ServerHunted == 1 && PlayerInfo[playerid][Hunted] == 1)
{
                   format(string,sizeof(string)," %s has Killed the Hunted %s and got his prize.",RPN(killerid),RPN(playerid));
           SendClientMessageToAll(TRANSPARENT_PURPLE,string);
           format(string,sizeof(string),"You have killed the hunted %s",RPN(playerid));
           SendClientMessage(killerid,COLOR_GREY,string);
           ServerHunted = 0;
           SetPlayerColor(playerid,TRANSPARENT_WHITE);
}
the problem is:
if the hunted died without no one killed him it send the message without name, to recap I wanna make thing if the hunted died without no one killed him send message to all that: no winner, hunted died.
thank you


Re: hunted system - AhmedMohamed - 28.03.2014

i mean in OnPlayerDeath when no killer what can i type?


Re: hunted system - Konstantinos - 28.03.2014

Check if killer is connected (if the player dies by themselves, killerid will be INVALID_PLAYER_ID (65535)):
pawn Код:
if (ServerHunted == 1 && PlayerInfo[playerid][Hunted] == 1 && killerid != INVALID_PLAYER_ID)



Re: hunted system - AhmedMohamed - 28.03.2014

thanks Konstantinos, I will try it now.