24.02.2010, 17:47
OK so i have this if statement in OnPlayerCommandText in my FS.
And this is the Jail CMD:
And my issue is, Once there jailed its not stopping them from using commands, i set the "PlayerInfo[id][Jailed] = 1;" to one and yet OnPlayerCommandText is still returning allowing the player to use a command, I am really stumped here, I'm not sure what to do, It should return that SendClientMessage when "PlayerInfo[id][Jailed] = 1" but yet it doesn't?, Thanks Chris.
Код:
public OnPlayerCommandText(playerid, cmdtext[]) { if(PlayerInfo[playerid][Jailed] == 1) return SendClientMessage(playerid, AdministrationError, "Error: You cannot use a command when you are jailed."); return 0; }
Код:
COMMAND:jail(playerid, params[]) { new string[128]; new JailedPlayer[MAX_PLAYER_NAME]; new AdministratorName[MAX_PLAYER_NAME]; new id, Reason[128]; if (PlayerInfo[playerid][Level] > 1) { if (sscanf(params, "uz", id, Reason)) SendClientMessage(playerid, 0xFF0000AA, "Usage: /jail [PlayerID] [Reason]"); else if (id == INVALID_PLAYER_ID) SendClientMessage(playerid, 0xFF0000AA, "Player not found"); else { GetPlayerName(id, JailedPlayer, sizeof(JailedPlayer)); GetPlayerName(playerid, AdministratorName, sizeof(AdministratorName)); format(string, sizeof(string), "%s was jailed by Administrator %s. [Reason: %s ]", JailedPlayer, AdministratorName, Reason); SendClientMessage(playerid, AdministrationHelp, "[Help] To unjail the specified player type /unjail [PlayerID]."); SetPlayerPos(id, 199.3792, 173.4266, 1003.0234); TogglePlayerControllable(id, 1); PlayerInfo[id][Jailed] = 1; SetPlayerInterior(id, 3); SendClientMessageToAll(AdministrationAnnouncement, string); LogCommand(string); } } else { SendClientMessage(playerid, AdministrationError, NotAdminError); } return 1; }