Auto-Kill for a certain gang zone. - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Auto-Kill for a certain gang zone. (
/showthread.php?tid=231301)
Auto-Kill for a certain gang zone. -
Shetch - 25.02.2011
Hello guys. Tody i thought i could make a auto-kill for my clan base. This is how i did it:
Код:
public OnPlayerConnect(playerid)
{
// Auto Kill
SetTimer("eStrike_AK_Timer", 1000, true);
return 1;
}
Код:
forward eStrike_AK_Timer(playerid);
public eStrike_AK_Timer(playerid)
{
if (IsPlayerInAreaEx(playerid,-74.913414, -394.928070, 13.086585, -266.928070))
{
new Nick[MAX_PLAYER_NAME];
GetPlayerName(playerid, Nick, sizeof(Nick));
if(strfind(Nick, "FreSh[eS]", true) != -1 || strfind(Nick, "[eS]", true) != -1)
{
SetPlayerHealth(playerid,100);
}
}
else
{
SetPlayerHealth(playerid,1.0);
}
}
But i don't know why it doesn't work. Can somebody tell me whats the problem?
Re: Auto-Kill for a certain gang zone. -
Calgon - 25.02.2011
Because
pawn Код:
SetTimer("eStrike_AK_Timer", 1000, true);
doesn't send on a playerid...
pawn Код:
SetTimerEx("eStrike_AK_Timer", 1000, true, "i", playerid);
Will, but you're better off having one timer in OnGameModeInit that loops through all of the connected players, instead of having individual timers for individual players.
Re: Auto-Kill for a certain gang zone. -
deather - 25.02.2011
Код:
SetTimer("eStrike_AK_Timer", 1000, true);
You dont provide any params while you call the function, but you need the playerid in the function -
eStrike_AK_Timer(playerid).
Try this:
Код:
public OnPlayerConnect(playerid)
{
SetTimerEx("eStrike_AK_Timer", 1000, true, "i", playerid);
return 1;
}