Settimer for a given player...
#1

Hello,
I make a jail script. Only i have one problem. I want to set a timer for the player that i've jailed, but the function only works on the player that have typed the command. The function works only on 'playerid' and not on 'giveplayerid'. Someone know how to solve this? Sorry if my explanation is not so clear but i can't describe it else.
Greets,
sean5874
Reply
#2

create an array for all players' jail-status- and jail-time:
Код:
new gArrested[MAX_PLAYERS];
new gArrestTime[MAX_PLAYERS];
and in your timer, simply test all players.
Код:
	for(new playerid=0;playerid<MAX_PLAYERS;playerid++)
	{
		if(gArrested[playerid]>0)
		{
			if(gArrestTime[playerid]>0)
			{
				gArrestTime[playerid]--;
			}
			else
			{
				SendClientMessageToAll(0xffffffff,"Player may now leave jail");
			}
		}
	}
Reply
#3

I understand what you explained to me.. but how i know that the timer is setten for the 'playerid' AND the 'giveplayerid'. If the timer only work for playerid he dont work anyway...
Reply
#4

try in your command:
pawn Код:
SetTimerEx("UnjailPublic",time_in_miliseconds,0,"i",GIVEPLAYERID);
the i = GIVEPLAYERID
and if u make ex
"ii",giveplayerid,playerid it sends 2 intergers to the public ex
pawn Код:
SetTimerEx("UnJailPlayer",120000,0,"i",GIVEPLAYERID);
//
public UnJailPlayer(playerid){
//unjaiil the player
SendClientMessage(playerid,color,"You have been unjailed");
}
or with more intergers.. etc
pawn Код:
SetTimerEx("UnJail",120000,0,"ii",GIVEPLAYERID,playerid);
//
public UnJail(giveplayerid,playerid){
new tmp[82];
format(tmp,sizeof(tmp),"You have been unjailed from the jail given by playrd %s",PlayerName(playerid));
SendClientMessage(giveplayerid,color,tmp);
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)