/ajail 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: /ajail Help (
/showthread.php?tid=409238)
/ajail Help -
Noles2197 - 20.01.2013
PHP код:
CMD:ajail(playerid, params[])
{
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,name, sizeof(name));
GetPlayerName(id,name2, sizeof(name2));
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, GRAY,"CMD: Invalid playerid.");
format(string, sizeof(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>");"
Re: /ajail Help -
Chenko - 20.01.2013
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.