Auto-Kill for a certain gang zone.
#1

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?
Reply
#2

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.
Reply
#3

Код:
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;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)