22.08.2013, 20:49
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); }