13.03.2015, 13:39
when is player jailed and when he disconnect he is not in jail??
Код:
CMD:jail(playerid, params[]) { if(pInfo[playerid][pLevel] >= 1) { new id, time = 0, reason[50]; if(isnull(params)) return SendClientMessage(playerid, yellow, "Usage: /Jail <Player ID> <Minutes> <Reason>"); sscanf(params, "uis[50]", id, time, reason); if(IsPlayerConnected(id) && id != playerid) { if(pInfo[id][Jailed] == 1) return SendClientMessage(playerid,red,"This player is already jailed. see /jailed"); if(pInfo[playerid][pLevel] <= pInfo[id][pLevel]) return ShowMessage(playerid, red, 6); if(!isnull(reason) && time == 0) format(Jstring,sizeof(Jstring),"Administrator %s has jailed player '%s' | Reason: %s",GetName(playerid),GetName(id),reason); else if(!isnull(reason) && time >= 1) format(Jstring,sizeof(Jstring),"Administrator %s has jailed '%s' for %d minutes (reason: %s)",GetName(playerid),GetName(id), time, reason); else if(isnull(reason) && time >= 1) format(Jstring,sizeof(Jstring),"Administrator %s has jailed '%s' for %d minutes",GetName(playerid),GetName(id), time); else format(Jstring,sizeof(Jstring),"Administrator %s has jailed '%s'",GetName(playerid),GetName(id)); CommandToAdmins(playerid,"jail"); SendClientMessageToAll(red,Jstring); pInfo[id][Jailed] = 1; TogglePlayerControllable(id, false); new Float:x, Float:y, Float:z; GetPlayerPos(id,x,y,z); SetPlayerCameraPos(id,x+7,y,z+5); SetPlayerCameraLookAt(id,x,y,z); JPlayer[id] = SetTimerEx("JailPlayer",3000,0,"d",id); if(GetPlayerState(id) == PLAYER_STATE_ONFOOT) SetPlayerSpecialAction(id,SPECIAL_ACTION_HANDSUP); if(time >= 1) { Jtimer[id] = SetTimerEx("Unjail",time*1000*60,0,"u",id); } return 1; } else return ShowMessage(playerid, red, 3); } else return ShowMessage(playerid, red, 1); }