Commands Not Working [Major Problem]
#1

When i jail someone on the server to test if the system works it jails them correctly but will not let me use that command or any other commands that uses SSCANF, if anyone can help me with this problem it would be great.

i think its the jail command that causes the problem because when i use /kick more than once it works but when i do /jail 0 5 100 it will not work more than once same with kick but it won't work at all even if i don't use it before i used /jail .

Note: SendActionReport isn't needed.

Jail Command:
pawn Код:
CMD:jail(playerid, params[], jailid, time, result[])
{
    if(pData[playerid][StaffLevel] >=1)
    {
        if(sscanf(params,  "dds[150]", jailid, time, result)) return SendClientMessage(playerid, -1, "Syntax: /jail [playerid] [time (minutes)] [reason]");
        if(pData[jailid][IsJailed_Admin] == 1) return SendClientMessage(playerid, -1, "This player is already jail, you cannot jail him again use /unjail");
        if(time < 1 || time > 5000) return SendClientMessage(playerid, -1, "You cannot be below 1 or above 5000");
       
        if(pData[playerid][StaffLevel] >= pData[jailid][StaffLevel])
        {
            new t = (time * 60);
            new str[128];
            format(str,sizeof(str),"You have been admin jailed for %d minutes.",time);
            SendClientMessage(jailid,COLOR_LIGHTRED,str);
            StaffJailPlayer(jailid,playerid,result,t);
            format(str,sizeof(str),"You have jailed %s",GetRolePlayName(jailid));
            SendClientMessage(playerid,COLOR_LIGHTRED,str);
        } else {
       
        }
    }
}
General Listener:
pawn Код:
public GeneralPlayerListener(playerid)
{
    foreach(Player, gp)
    {
        if(pData[gp][IsJailed_Admin] == 1)
        {
            if(pData[gp][JailTime_Admin] > 1)
            {
                pData[gp][JailTime_Admin] --;
                new mins = (pData[gp][JailTime_Admin] / 60);
                new str[64];
                if(mins > 0) { format(str,sizeof(str),"Time Left: ~r~%d ~w~Minutes",mins); } else { format(str,sizeof(str),"Time Left: ~r~%d ~w~Seconds",pData[gp][JailTime_Admin]); }
                TextDrawSetString(Jail_Timer[gp],str);
                TextDrawShowForPlayer(gp,Jail_Timer[gp]);
            }
            else if(pData[gp][JailTime_Admin] == 1)
            {
                pData[gp][JailTime_Admin] = 0;
                pData[gp][IsJailed_Admin] = 0;
                SetPlayerPos(gp, 0,0,0);
                SetPlayerInterior(gp,0);
                GameTextForPlayer(gp,"~g~ Released from jail",5000,1);
                TextDrawHideForPlayer(gp,Jail_Timer[gp]);

           
            }
        }
    }
}

Jail Player Function:
pawn Код:
public StaffJailPlayer(target,sender,reason[],time)
{
    SendActionReport("Jail",target,sender,reason);
    SetPlayerPos(target,223.5856,111.1056,999.0156);
    SetPlayerInterior(target,10);
    SetPlayerVirtualWorld(target,(target + 2000));
    pData[target][JailTime_Admin] = time;
    pData[target][IsJailed_Admin] = 1;
    return 1;
}
Reply
#2

I don't think you need the CMD format like this:

pawn Код:
CMD:jail(playerid, params[], jailid, time, result[])
All you really need is:

pawn Код:
CMD:jail(playerid, params[])
And then the parameters get declared with sscanf. My friend a while back did the same thing, by putting parameters inside of the brackets of the CMD: line, and his server didn't work so well either.
Reply
#3

This is what i'm on about i'm using it like that on CMD:ban and CMD:kick but i'll give it a shot with new jailid, time, result[150] thanks for your reply pal.

Edit: Working thanks pal.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)