ajail timer problem - 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: ajail timer problem (
/showthread.php?tid=459448)
ajail timer problem -
Slepur - 22.08.2013
Hey, I'm making an AJail command and it seems to work fine, until I ajail a second person... When I ajail a user it ajails them for the x amount of time and released them back to their teams spawn... Now, when I ajail someone else after he's been release it puts them into the ajail but after their time is up it doesn't unjail them, it unjails the first person I put in jail even though they're not actually in jail and spawns them where the second person would have spawned.
Код:
CMD:ajail(playerid, params[])
{
if(pInfo[playerid][pAdmin] >= 1)
{
new targetid, minutes;
if(sscanf(params, "ri", targetid, minutes)) return SendClientMessage(playerid, COLOR_RED,"Usage: /ajail <playerid> <minutes>");
if(minutes <= 0 || minutes > 60) return SendClientMessage(playerid, COLOR_RED, "Minutes can't be less than 0 or more than 60!");
if(pInfo[targetid][pAdmin] > pInfo[playerid][pAdmin]) return SendClientMessage(playerid, COLOR_RED, "You can't jail higher level admins!");
new str[128];
format(str, sizeof(str), "Administrator %s has jailed %s for %d minute(s)!", pInfo[playerid][User], pInfo[targetid][User], minutes);
SendClientMessageToAll(COLOR_LIGHTBLUE,str);
pInfo[targetid][pAJailTime] = SetTimer("Unjail", minutes*60*1000, false);
SetPlayerPos(targetid, 2056.8838, 2420.1187, 150.4766);
SetPlayerInterior(targetid, 0);
pInfo[targetid][pAJail] = 1;
GameTextForPlayer(targetid, "~p~AJAILED", 10000, 6);
}
else return SendClientMessage(playerid, COLOR_RED, "You have to be level 1 to use this command!");
return 1;
}
forward Unjail(playerid);
public Unjail(playerid)
{
SpawnPlayer(playerid);
SetPlayerInterior(playerid, 0);
pInfo[playerid][pAJail] = 0;
KillTimer(pInfo[playerid][pAJailTime]);
pInfo[playerid][pAJailTime] = 0;
GameTextForPlayer(playerid, "~g~Unjailed", 5000, 6);
}
Re: ajail timer problem -
Slepur - 22.08.2013
Still in need to find a solution for this >.<
Re: ajail timer problem -
RALL0 - 23.08.2013
pawn Код:
pInfo[targetid][pAJailTime] = SetTimerEx("Unjail", minutes*60*1000, false,"i",playerid);
Respuesta: ajail timer problem -
Strier - 23.08.2013
pawn Код:
pInfo[targetid][pAJailTime] = SetTimerEx("Unjail",minutes*1000*60,false,"i",targetid);