SA-MP Forums Archive
Need help /ajail - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Need help /ajail (/showthread.php?tid=272838)



Need help /ajail - SilverBox aka XHell4YouX - 30.07.2011

I have the new gamemode of FCRP that someone posted yesterday

But when im doing /ajail is crashing the server here is the command

PHP код:
if(strcmp(cmd"/ajail"true) == 0)
    {
        if(
IsPlayerConnected(playerid))
        {
            
tmp strtok(cmdtextidx);
            if(!
strlen(tmp))
            {
                
SendClientMessage(playeridCOLOR_GRAD2"USAGE: /ajail [playerid/PartOfName] [time(minutes)] [reason]");
                return 
1;
            }
            if(
GetPVarInt(playerid"AdminLogged") == 0)
            {
                
SendClientMessage(playeridCOLOR_GRAD2"Your not logged in through the admin panel, /adminlogin.");
                return 
1;
            }
            new 
playa;
            new 
money;
            
playa ReturnUser(tmp);
            
tmp strtok(cmdtextidx);
            if(!
strlen(tmp))
            {
                
SendClientMessage(playeridCOLOR_GRAD2"USAGE: /ajail [playerid/PartOfName] [time(minutes)] [reason]");
                return 
1;
            }
            
money strval(tmp);
            if (
PlayerInfo[playerid][pAdmin] >= 1)
            {
                if(
IsPlayerConnected(playa))
                {
                    if(
playa != INVALID_PLAYER_ID)
                    {
                        
GetPlayerName(playagiveplayersizeof(giveplayer));
                        
GetPlayerName(playeridsendernamesizeof(sendername));
                        
GiveNameSpace(sendername);
                        
GiveNameSpace(giveplayer);
                        if(
PlayerInfo[playa][pAdmin]>&& playa!=playerid) {
                            if(
PlayerInfo[playerid][pAdmin] < 10)
                            {
                                
SendClientMessage(playeridCOLOR_GRAD2"Your admin level is too low to jail other admins.");
                                return 
1;
                            }
                        }
                        if(
PlayerInfo[playerid][pHidden] == 1) { sendername "Hidden Admin"; }
                        else if(
PlayerInfo[playerid][pAdmin] == 11) { sendername "Hidden Admin"; }
                        new 
length strlen(cmdtext);
                        while ((
idx length) && (cmdtext[idx] <= ' '))
                        {
                            
idx++;
                        }
                        new 
offset idx;
                        new 
result[128];
                        while ((
idx length) && ((idx offset) < (sizeof(result) - 1)))
                        {
                            
result[idx offset] = cmdtext[idx];
                            
idx++;
                        }
                        
result[idx offset] = EOS;
                        if(!
strlen(result))
                        {
                            
SendClientMessage(playeridCOLOR_GRAD2"USAGE: /ajail [playerid/PartOfName] [time(minutes)] [reason]");
                            return 
1;
                        }
                        
GetPlayerName(playeridnamesizeof(name));
                        
CMDLog(name,cmdtext);
                        
format(stringsizeof(string), "* You Jailed %s."giveplayer);
                        
SendClientMessage(playeridCOLOR_LIGHTREDstring);
                        
format(stringsizeof(string), "* You were Jailed by Admin %s."sendername);
                        
SendClientMessage(playaCOLOR_LIGHTREDstring);
                        
ResetPlayerWeaponsEx(playa);
                        
PlayerInfo[playa][pJailed] = 2;
                        
PlayerInfo[playa][pJailTime] = money*60;
                        
PlayerInfo2[Mute][playa] = 1;
                        
SetPlayerInterior(playa0);
                        
SetPlayerVirtualWorld(playaplaya);
                        
PlayerInfo[playa][pInt] = 0;
                        
DOO_SetPlayerPos(playa,2523.9197,-1673.8944,14.8589);
                        
format(stringsizeof(string), "You are jailed for %d minutes."money);
                        
SendClientMessage(playaCOLOR_WHITEstring);
                        
format(stringsizeof(string), "AdmCmd: %s has been jailed by Admin %s [Reason: %s]"giveplayersendername, (result));
                        
SendClientMessageToAll(COLOR_LIGHTREDstring);
                        
strmid(PlayerInfo[playa][pJailReason], result0strlen(result), 255);
                        
OnPlayerDataSave(playa);
                        
GetPlayerName(playeridsendernamesizeof(sendername));
                        
format(stringsizeof(string), "AdmCmd: %s has been jailed by Admin %s for %i mins [Reason: %s]"giveplayersendername,money,(result));
                        
PlayerInfo[playa][pAJails] += 1;
                        
//JailLog(string);
                    
}
                }
            }
            else
            {
                
SendClientMessage(playeridCOLOR_GRAD1"   you are not authorized to use that command!");
            }
        }
        return 
1;
    } 
Also /unjail crashing it

PHP код:
if(strcmp(cmd"/unjail"true) == 0)
    {
        if(
IsPlayerConnected(playerid))
        {
            
tmp strtok(cmdtextidx);
            if(!
strlen(tmp))
            {
                
SendClientMessage(playeridCOLOR_GRAD2"USAGE: /un [playerid/PartOfName]");
                return 
1;
            }
            new 
plo;
            
plo ReturnUser(tmp);
            if (
IsPlayerConnected(plo))
            {
                if(
plo != INVALID_PLAYER_ID)
                {
                    if (
PlayerInfo[playerid][pAdmin] >= 1)
                    {
                        if (
PlayerInfo[plo][pJailTime] == 0) return 1;
                        
GetPlayerName(playeridnamesizeof(name));
                        
CMDLog(name,cmdtext);
                        
format(stringsizeof(string), "* You Un-Jailed %s."giveplayer);
                        
SendClientMessage(playeridCOLOR_LIGHTREDstring);
                        
format(stringsizeof(string), "* You were Un-Jailed by Admin %s."sendername);
                        
SendClientMessage(ploCOLOR_LIGHTREDstring);
                        
ResetPlayerWeaponsEx(plo);
                        
PlayerInfo[plo][pJailed] = 0;
                        
PlayerInfo[plo][pJailTime] = 0;
                        
PlayerInfo2[Mute][plo] = 0;
                        
DOO_SetPlayerPos(plo, -212.9436,979.2974,19.3298);
                        
SetPlayerInterior(plo,0);
                        
SendClientMessage(ploCOLOR_GRAD1,"   You have paid Your debt to society.");
                        
GameTextForPlayer(plo"~g~Freedom~n~~w~Try to be a better citizen"50001);
                        
SetPlayerVirtualWorld(plo,0);
                        
PlayerInfo2[Mute][plo] = 0;
                        
SetPlayerInterior(plo0);
                        
SetPlayerVirtualWorld(plo0);
                        
PlayerInfo[plo][pInt] = 0;
                        
TogglePlayerControllableEx(plo0);
                        
format(stringsizeof(string), "AdmCmd: %s has been un-jailed by Admin Silent Admin"giveplayer);
                        
ABroadCast(JB_RED,string,1);
                        
PlayerInfo[plo][pAJails] -= 1;
                        
GetPlayerName(playeridsendernamesizeof(sendername));
                        
OnPlayerDataSave(plo);
                    }
                    else
                    {
                        
SendClientMessage(playeridCOLOR_GRAD1"   you are not authorized to use that command!");
                    }
                }
            }
            else
            {
                
format(stringsizeof(string), "   %d is not an active player."plo);
                
SendClientMessage(playeridCOLOR_GRAD1string);
            }
        }
        return 
1;
    } 



Re: Need help /ajail - Max_Coldheart - 30.07.2011

pawn Код:
playa = ReturnUser(tmp);
Could I see the code of ReturnUser(id) ?
And
pawn Код:
GiveNameSpace(sendername);
Could I see code of GiveNameSpace(id) too?

__________________________________________________ _____________________________________
|This forum requires that you wait 120 seconds between posts. Please try again in 15 seconds. |
---------------------------------------------------------------------------------------------------


Re: Need help /ajail - Flo_White - 30.07.2011

could be that "OnPlayerDataSave " is causing the crashes.
you got all required files, etc?