Formatting
#5

Quote:
Originally Posted by Garc1a
View Post
Whole command:

pawn Code:
if(strcmp(cmd, "/ajail", true) == 0)
    {
        if(PlayerInfo[playerid][pLogged] == 1)
        {
            if(PlayerInfo[playerid][pAdmin] >= 1)
            {
                tmp = strtok(cmdtext, idx);
                if(!strlen(tmp))
                {
                    SendClientMessage(playerid, COLOR_WHITE, "[Command]: /ajail [playerid] [minutes] [Reason]");
                    return 1;
                }
                new playa;
                new jailtime;
                playa = ReturnUser(tmp);
                tmp = strtok(cmdtext, idx);
                if(!strlen(tmp))
                {
                    SendClientMessage(playerid, COLOR_WHITE, "[Command]: /ajail [playerid] [minutes] [Reason]");
                    return 1;
                }
                jailtime = strval(tmp);
                new length = strlen(cmdtext);
                while ((idx < length) && (cmdtext[idx] <= ' '))
                {
                    idx++;
                }
                new offset = idx;
                new result[64];
                while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
                {
                    result[idx - offset] = cmdtext[idx];
                    idx++;
                }
                result[idx - offset] = EOS;
                if(!strlen(result))
                {
                    SendClientMessage(playerid, COLOR_WHITE, "[Command]: /ajail [playerid] [Jailtime] [Reason]");
                    return 1;
                }
                new name[MAX_PLAYER_NAME];
                if(IsPlayerConnected(playa))
                {
                    if(playa != INVALID_PLAYER_ID)
                    {
                        GetPlayerName(playa, giveplayer, sizeof(giveplayer));
                        GetPlayerName(playerid, name, sizeof(name));
                        format(string, sizeof(string), "AdmCmd: %s has jailed %s, reason: %s", name, giveplayerid, (result));
                        SendClientMessageToAll(COLOR_LIGHTRED, string);
                        PlayerInfo[playa][pJailed] = 1;
                        PlayerInfo[playa][pJailTime] = jailtime*60;
                        SetPlayerInterior(playa, 6);
                        SetPlayerPos(playa, 264.6288,77.5742,1001.0391);
                    }
                    else SendClientMessage(playerid, COLOR_LIGHTRED, "[Error]: That player is not connected!");
                }
                else SendClientMessage(playerid, COLOR_LIGHTRED, "[Error]: That player is not connected!");
            }
            else SendClientMessage(playerid, COLOR_LIGHTRED, "[Error]: You're not allowed to use that command!");
        }
        else SendClientMessage(playerid, COLOR_LIGHTRED, "[Error]: You're not logged in!");
        return 1;
    }
Did you actually declare 'giveplayerid'? Because I don't find a declaration in this code.
Reply


Messages In This Thread
Formatting - by Garc1a - 29.10.2010, 17:38
Re: Formatting - by DeathOnaStick - 29.10.2010, 17:39
Re: Formatting - by 0ne - 29.10.2010, 17:40
Re: Formatting - by Garc1a - 29.10.2010, 17:50
Re: Formatting - by DeathOnaStick - 29.10.2010, 17:56
Re: Formatting - by Garc1a - 29.10.2010, 18:01

Forum Jump:


Users browsing this thread: 1 Guest(s)