SA-MP Forums Archive
Little Help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Little Help (/showthread.php?tid=303559)



Little Help - SpiderWalk - 14.12.2011

Hello.I got problem with unjail.When i type /unjail it will unjail me but it need to show message
here is code
pawn Код:
CMD:unjail(playerid, params[])
{
    new id;
    if(PlayerInfo[playerid][pAdminLevel] < 4) return SendClientMessage(playerid,COLOR_GREY,"You are not allowed to use this command!");
    {
        if(sscanf(params, "u", playerid))SendClientMessage(playerid, COLOR_WHITE, "/unjail [PLAYERID]");
        else if (id == INVALID_PLAYER_ID) SendClientMessage(playerid, 0xFF0000AA, "Player not found");
        {
            SpawnPlayer(id);
            SendClientMessage(id,0xFF0000FF,"You have been unjailed by an admin.");
            new gName[MAX_PLAYER_NAME],string[128];
            GetPlayerName(playerid,gName,sizeof gName);
            format(string,sizeof string,"You Unjailed player %s",gName);
            SendClientMessage(playerid,0x00ff00ff,string);
        }
    }
    return 1;
}



Re: Little Help - SpiderWalk - 14.12.2011

Any help??!!


Re: Little Help - emokidx - 14.12.2011

define the id's by GetPlayerName??

maybe


Re: Little Help - Calgon - 14.12.2011

Don't bump your thread so quickly. It's unfair to the others that are asking for help.

pawn Код:
CMD:unjail(playerid, params[])
{
    new id;
    if(PlayerInfo[playerid][pAdminLevel] < 4) return SendClientMessage(playerid,COLOR_GREY,"You are not allowed to use this command!");
    {
        if(sscanf(params, "u", id))SendClientMessage(playerid, COLOR_WHITE, "/unjail [PLAYERID]");
        else if (id == INVALID_PLAYER_ID) SendClientMessage(playerid, 0xFF0000AA, "Player not found");
        {
            SpawnPlayer(id);
            SendClientMessage(id,0xFF0000FF,"You have been unjailed by an admin.");
            new gName[MAX_PLAYER_NAME],string[128];
            GetPlayerName(playerid,gName,sizeof gName);
            format(string,sizeof string,"You Unjailed player %s",gName);
            SendClientMessage(playerid,0x00ff00ff,string);
        }
    }
    return 1;
}
Your code tried to unload the 'u' parameter in to playerid, so id would always equal 0, and the id would become playerid.


Re: Little Help - SpiderWalk - 14.12.2011

Quote:
Originally Posted by Calgon
Посмотреть сообщение
Don't bump your thread so quickly. It's unfair to the others that are asking for help.

pawn Код:
CMD:unjail(playerid, params[])
{
    new id;
    if(PlayerInfo[playerid][pAdminLevel] < 4) return SendClientMessage(playerid,COLOR_GREY,"You are not allowed to use this command!");
    {
        if(sscanf(params, "u", id))SendClientMessage(playerid, COLOR_WHITE, "/unjail [PLAYERID]");
        else if (id == INVALID_PLAYER_ID) SendClientMessage(playerid, 0xFF0000AA, "Player not found");
        {
            SpawnPlayer(id);
            SendClientMessage(id,0xFF0000FF,"You have been unjailed by an admin.");
            new gName[MAX_PLAYER_NAME],string[128];
            GetPlayerName(playerid,gName,sizeof gName);
            format(string,sizeof string,"You Unjailed player %s",gName);
            SendClientMessage(playerid,0x00ff00ff,string);
        }
    }
    return 1;
}
Your code tried to unload the 'u' parameter in to playerid, so id would always equal 0, and the id would become playerid.
So to change "u" to "s[124]" am i right?And to make String[124]?


Re: Little Help - Ballu Miaa - 14.12.2011

EDIT: Nevermind!


Re: Little Help - emokidx - 14.12.2011

edit:look down x.x


Re: Little Help - Calgon - 14.12.2011

No I fixed it in the code I posted, you don't change it to a string, you change 'playerid' to 'id' in the sscanf function on this line:

pawn Код:
if(sscanf(params, "u", playerid))SendClientMessage(playerid, COLOR_WHITE, "/unjail [PLAYERID]");
Fixed code:

pawn Код:
if(sscanf(params, "u", id))SendClientMessage(playerid, COLOR_WHITE, "/unjail [PLAYERID]");



Re: Little Help - suhrab_mujeeb - 14.12.2011

Quote:
Originally Posted by Calgon
Посмотреть сообщение
No I fixed it in the code I posted, you don't change it to a string, you change 'playerid' to 'id' in the sscanf function on this line:

pawn Код:
if(sscanf(params, "u", playerid))SendClientMessage(playerid, COLOR_WHITE, "/unjail [PLAYERID]");
Fixed code:

pawn Код:
if(sscanf(params, "u", id))SendClientMessage(playerid, COLOR_WHITE, "/unjail [PLAYERID]");
Not even with this?


Re: Little Help - SpiderWalk - 14.12.2011

Quote:
Originally Posted by suhrab_mujeeb
Посмотреть сообщение
Not even with this?
i still got the problem when i type /unjail it shows me message but i get message you have been unjailed and i get respawned anyone help?