Formatting
#1

Quote:

format(string, sizeof(string), "AdmCmd: %s has jailed %s, reason: %s", name, giveplayerid, (result));

It doesn't say the person who has been jailed's name in-game, help please.
Reply
#2

Quote:
Originally Posted by Garc1a
View Post
It doesn't say the person who has been jailed's name in-game, help please.
Where are the names of the players stored in?
Like 'name[MAX_PLAYERNAME]' and 'AdminName[MAX_PLAYERNAME]'.
Reply
#3

instead of giveplayerid, try using: name(giveplayerid)
Reply
#4

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;
    }
Reply
#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
#6

Quote:
Originally Posted by DeathOnaStick
View Post
Did you actually declare 'giveplayerid'? Because I don't find a declaration in this code.
I just downloaded it, it's a FS.
If it isn't declared how do I declare it?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)