/ajail Help
#1

PHP код:
CMD:ajail(playeridparams[])
{
    if(
PlayerInfo[playerid][pAdmin] > 0)
    {
        new 
name[MAX_PLAYER_NAME],name2[MAX_PLAYER_NAME],string[128],id,reason[64],time;
        if(
sscanf(params,"ds[64]",id,time,reason)) return SendClientMessage(playerid,GRAY,"CMD: /ajail <playerid> <minutes> <reason>");
        
GetPlayerName(playerid,namesizeof(name));
        
GetPlayerName(id,name2sizeof(name2));
        if(!
IsPlayerConnected(id)) return SendClientMessage(playeridGRAY,"CMD: Invalid playerid.");
        
format(stringsizeof(string), "Administrator %s admin jailed %s %s minutes for %s."name,name2,time,reason);
        
SendClientMessageToAll(PINK,string);
        
SetPlayerPos(id,-1425.1499,1490.4562,1.8672);
    } 
// Administrator Noles2197 admin jailed Noles2197  minutes for 60 dm."
    
return 1;

appears as "Administrator Noles2197 admin jailed Noles2197 minutes for 60 dm."
The time and reason seem to be getting mixed up and I think it has something to do with..
"if(sscanf(params,"ds[64]",id,time,reason)) return SendClientMessage(playerid,GRAY,"CMD: /ajail <playerid> <minutes> <reason>");"
Reply
#2

When formatting a number into a string use "%d" not "%s". Also,

pawn Код:
if(sscanf(params,"ds[64]",id,time,reason)) return SendClientMessage(playerid,GRAY,"CMD: /ajail <playerid> <minutes> <reason>");
Should be:

pawn Код:
if(sscanf(params,"uds[64]",id,time,reason)) return SendClientMessage(playerid,GRAY,"CMD: /ajail <playerid> <minutes> <reason>");
You forgot to put the "u" parameter for playerid.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)