SA-MP Forums Archive
anyone able to help me with a command - 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)
+--- Thread: anyone able to help me with a command (/showthread.php?tid=635561)



anyone able to help me with a command - IggyKlipz - 09.06.2017

when i use this command it says that is doesnt exist ... but it works only sometimes then it will say that it doesnt work the coding is here for the command


PHP код:
CMD:backup(playeridparams[])
{
    if(
IsACop(playerid) || PlayerInfo[playerid][pFaction] == && PlayerInfo[playerid][pDivision] == || PlayerInfo[playerid][pFaction] == && PlayerInfo[playerid][pRank] >= 5)
    {
        if(
Backup[playerid] != 1)
        {
            new
                
zone[MAX_ZONE_NAME],
                
string[40 MAX_PLAYER_NAME];
            
GetPlayer3DZone(playeridzonesizeof(zone));
            
format(stringsizeof(string), "* %s requests backup over their radio."GetPlayerNameEx(playerid));
            
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            
format(stringsizeof(string), "%s is requesting immediate backup at %s."GetPlayerNameEx(playerid), zone);
            
Backup[playerid] = 1;
            foreach(
Playeri)
            {
                if(
IsACop(i))
                {
                      
SetPlayerMarkerForPlayer(iplayerid0x2641FEAA);
                    
SendClientMessage(iTEAM_BLUE_COLORstring);
                }
            }
            
SendClientMessage(playeridCOLOR_WHITE"Type /nobackup to clear your backup request.");
            
SetTimerEx("BackupClear"180000false"ii"playerid1);
        }
        else
        {
            
SendClientMessage(playeridCOLOR_GREY"  You already have an active backup request!");
        }
    }
    else
    {
        
SendClientMessage(playeridCOLOR_GRAD2"   You're not a Cop / FBI / Coastguard!");
    }
    return 
1;




Re: anyone able to help me with a command - FizzyWalshy - 09.06.2017

Private message me i will fix your code


Re: anyone able to help me with a command - Zmith - 09.06.2017

not tested

PHP код:
CMD:backup(playeridparams[])
{
    if(
IsACop(playerid) || PlayerInfo[playerid][pFaction] == && PlayerInfo[playerid][pDivision] == || PlayerInfo[playerid][pFaction] == && PlayerInfo[playerid][pRank] >= 5)
    {
    if(
Backup[playerid] = 0)
    {
        new
        
zone[MAX_ZONE_NAME],
        
string[40 MAX_PLAYER_NAME];
        
GetPlayer3DZone(playeridzonesizeof(zone));
        
format(stringsizeof(string), "* %s requests backup over their radio."GetPlayerNameEx(playerid));
        
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE);
        
format(stringsizeof(string), "%s is requesting immediate backup at %s."GetPlayerNameEx(playerid), zone);
        
Backup[playerid] = 1;
        foreach(
Playeri)
        if(
IsACop(i))
        {
            
SetPlayerMarkerForPlayer(iplayerid0x2641FEAA);
            
SendClientMessage(iTEAM_BLUE_COLORstring);
            
SendClientMessage(iCOLOR_WHITE"Type /nobackup to clear your backup request.");
            
SetTimerEx("BackupClear"180000false"ii"playerid1);
        }
          return 
1;
    }
    if(
Backup[playerid] == 1)
    {
        
SendClientMessage(playeridCOLOR_GREY" You already have an active backup request!");
          }
    }
    return 
1;




Re: anyone able to help me with a command - Threshold - 09.06.2017

Only thing I can think of that would be causing this is the IsACop function. Can you post that? Try running it again with the crashdetect plugin and see what your console/log says.

Also I don't know if this was like this or maybe you pasted it wrong, but:
PHP код:
COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE 
There's a space before the E.

Quote:
Originally Posted by Zmith
not tested
Nigga... you didn't even 'compile' it...


Re: anyone able to help me with a command - IggyKlipz - 09.06.2017

This is the isacop ..
IsACop(playerid)
{
if(IsPlayerConnected(playerid))
{
new leader = PlayerInfo[playerid][pLeader];
new member = PlayerInfo[playerid][pFaction];
if(member==1 || member==2 || member==6 || member==7)
{
return 1;
}
else if(leader==1 || leader==2 || leader==6 || leader==7)
{
return 1;
}
}
return 0;
}


Re: anyone able to help me with a command - IggyKlipz - 09.06.2017

anyone ??


Re: anyone able to help me with a command - Threshold - 09.06.2017

Have you tried running crashdetect?
https://github.com/Zeex/samp-plugin-...18.1-win32.zip


Re: anyone able to help me with a command - Kane - 10.06.2017

Can you make your code more readable and put it in a [php]?


Re: anyone able to help me with a command - IggyKlipz - 10.06.2017

but the command doesnt crash just stops working after a amount of time the server has started ...... if i start the server and join it works ....... if a later on join it doesnt work at all says the command doesnt exist ..... What do you mean Readable ?... php ?