SA-MP Forums Archive
Can somebody please help with this - 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: Can somebody please help with this (/showthread.php?tid=297328)



Can somebody please help with this - Stefand - 15.11.2011

Hi users,

i have made a admin Jail command.
but maybe some of you can made a timer for it so he have to sit in jail for 1 min and then he is released to a place (cordinates i will put on it)

and make it so the player who needs to get jailed gets jailed and not the admin :$

but maybe some of you can make a start for me

pawn Код:
CMD:jail(playerid,params[])
{
    new jail[MAX_PLAYER_NAME],name[MAX_PLAYER_NAME],string[128],pID;
    GetPlayerName(pID,jail,MAX_PLAYER_NAME);
    GetPlayerName(playerid,name,MAX_PLAYER_NAME);

    if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid,COLOR_WHITE,"You are not an Admin");
    else if(isnull(params))
        {
            SendClientMessage(playerid,COLOR_WHITE,"USAGE: /jail <playerid> <reason>");
        }
    else if(!IsPlayerConnected(pID)) return SendClientMessage(playerid,COLOR_WHITE,"Invalid Player");
    else
    {
    format(string,sizeof(string),"COMMAND: %s has been jailed by %s reason: %s",jail,name,params);
    SetPlayerPos(pID, 0, 0, 0);
    SendClientMessageToAll(COLOR_RED,string);
    }
    return 1;
}



Re: Can somebody please help with this - KosmasRego - 15.11.2011

You can create a /unjail CMD. Example:

pawn Код:
CMD:unjail(playerid,params[])
{
    new unjail[MAX_PLAYER_NAME],name[MAX_PLAYER_NAME],string[128],pID;
    GetPlayerName(pID,unjail,MAX_PLAYER_NAME);
    GetPlayerName(playerid,name,MAX_PLAYER_NAME);

    if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid,COLOR_WHITE,"You are not an Admin");
    else if(isnull(params))
        {
            SendClientMessage(playerid,COLOR_WHITE,"USAGE: /unjail <playerid> <reason>");
        }
    else if(!IsPlayerConnected(pID)) return SendClientMessage(playerid,COLOR_WHITE,"Invalid Player");
    else
    {
    format(string,sizeof(string),"COMMAND: %s has been unjailed by %s reason: %s",jail,name,params);
    SetPlayerPos(pID, X, Y, Z);
    SendClientMessageToAll(COLOR_RED,string);
    }
    return 1;
}



Re: Can somebody please help with this - Stefand - 15.11.2011

i already tried but it jails and unjails my own account :S


Re: Can somebody please help with this - KosmasRego - 15.11.2011

you didnt add the tmp shit try searching for Scripting Tutorials in forums


Re: Can somebody please help with this - Stefand - 15.11.2011

Ok will try it now



Re: Can somebody please help with this - SmiT - 15.11.2011

I suggest you sscanf2:

pawn Код:
CMD:jail(playerid,params[])
{
    new
        jail[MAX_PLAYER_NAME], name[MAX_PLAYER_NAME], string[128], pID, reason[ 128 ];
   
    if ( sscanf ( params, "rs[128]", pID, reason ) ) return SendClientMessage( playerid, -1, #Usage /jail <playerid/name> <reason> );
    if ( PlayerInfo[ playerid ][ pAdmin ] < 1 ) return SendClientMessage( playerid, COLOR_WHITE, #You are not an Admin );
   
    GetPlayerName( pID, jail, MAX_PLAYER_NAME);
    GetPlayerName( playerid, name, MAX_PLAYER_NAME);

    format( string, sizeof ( string ),"COMMAND: %s has been jailed by %s reason: %s", jail, name, reason);
    SetPlayerPos(pID, 0, 0, 0);
    SendClientMessageToAll(COLOR_RED,string);
   
    return 1;
}