07.05.2011, 16:08
Alright, I got a problem with my /ajail command. It is scripted with sscanf & zcmd. And i am new to sscanf. I dont understand it so good. But when i write /ajail 1(my ID) 5(5 mins) test(reason) it just shows up: You cant jail NPCS!
This is my code:
Anyone know how to fix this?
Again, Im new to sscanf.
This is my code:
pawn Код:
CMD:ajail(playerid, params[])
{
new
user,
ajailtime,
szReason[32],
giveplayerid;
if(sscanf(params, "us[32]", user, ajailtime, szReason))
return SendClientMessage(playerid, RED, "[LOST:RP] /ajail [ID] [TIME] [REASON]");
if(IsPlayerNPC(giveplayerid))
return SendClientMessage(playerid, RED, "[LOST:RP] You cant ajail npcs");
if(PlayerInfo[playerid][pAdmin] == 0)
return SendClientMessage(playerid, RED, "[LOST:RP] You are not a admin");
if(PlayerInfo[playerid][pAdmin] < 2)
return SendClientMessage(playerid, RED, "[LOST:RP] You are not a admin or you are a to low one");
if(PlayerInfo[playerid][pAdmin] > 3)
{
new
sendername[MAX_PLAYER_NAME],
string[128],
giveplayer[MAX_PLAYER_NAME];
GetPlayerName(user, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
PlayerInfo[user][pJailed] = 1;
PlayerInfo[user][pJailTime] = ajailtime*60;
SetPlayerInterior(user, 6);
SetPlayerVirtualWorld(playerid, 0);
SetPlayerPos(user, 264.6288,77.5742,1001.0391);
SetPlayerFacingAngle(user, -90);
format(string, sizeof(string), "You got jailed! %d minutes left.", ajailtime);
SendClientMessage(user, RED, string);
}
return 1;
}
Again, Im new to sscanf.