04.08.2012, 19:15
Quote:
You need a positive return ("return 1;") at the end of a command, and a negative return ("return 0;") at the end of the callback.
However I can't read the code as easy because the indentation is all broken up and for some reason I just can't code with the braces at the end of the lines. Try using chrfind and sscanf to split the cmdtext instead (It's faster I think) or just use ZCMD and sscanf. |
SouthClaw cleaned up:
pawn Код:
if(strcmp(cmd, "/ajail", true) == 0)
{
new targetid,time,reason[128],string[128];
if(sscanf(cmd,"uis[128]",targetid,time,reason))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /ajail [playerid/PartOfName] [time(minutes)] [reason]");
return 1;
}
if (PlayerInfo[playerid][pAdmin] >= 1 && PlayerInfo[playerid][pAdmin] < 10)
{
SendClientMessage(playerid, COLOR_GRAD2, "Your admin level is too low to jail other admins.");
return 1;
}
format(string, sizeof(string), "* You Jailed %s(%d).", PlayerName(targetid), targetid);
SendClientMessage(playerid, COLOR_LIGHTRED, string);
format(string, sizeof(string), "* You were Jailed by Admin %s. (%d minutes.)", PlayerName(playerid),time);
SendClientMessage(targetid, COLOR_LIGHTRED, string);
ResetPlayerWeaponsEx(targetid);
PlayerInfo[targetid][pJailed] = 2;
PlayerInfo[targetid][pJailTime] = time*60;
Mute[targetid] = 1;
PlayerInfo[targetid][pAjailc]++;
SetPlayerInterior(targetid, 0);
SetPlayerVirtualWorld(targetid, targetid);
PlayerInfo[targetid][pInt] = 0;
DOO_SetPlayerPos(targetid,3523.9175,-503.7138,270.5802);
format(string, sizeof(string), "AdmCmd: %s has been jailed by Admin %s for %i minutes [Reason: %s]", PlayerName(targetid),PlayerName(playerid),time,reason);
OOCOff(COLOR_RED, string);
SavePlayerData(targetid);
return 1;
}
Also, would mixing DINI with MySQL causes strcmp commands to stop working?