#5

Quote:
Originally Posted by [HLF]Southclaw
Посмотреть сообщение
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.
I've got a script doing that as I am a bit lazy, soon I should get a ZCMD + SSCANF system, but it wont fix any problems.

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;
}
@Roko this command functions fine, it set a player position, it saves all of the player, but it still returns the command.

Also, would mixing DINI with MySQL causes strcmp commands to stop working?
Reply


Messages In This Thread
Hm.. - by Riddy - 04.08.2012, 17:02
Re: Hm.. - by TaLhA XIV - 04.08.2012, 17:05
Re: Hm.. - by Riddy - 04.08.2012, 17:53
Re: Hm.. - by Roko_foko - 04.08.2012, 17:56
Re: Hm.. - by Riddy - 04.08.2012, 19:15

Forum Jump:


Users browsing this thread: 5 Guest(s)