NRG/INF command
#1

Hi, someone give me this code:

PHP код:
new
    
infernus[MAX_PLAYERS],
    
nrg[MAX_PLAYERS];
public 
OnPlayerCommandText(playeridcmdtext[])
{
    if(!
strcmp(cmdtext,"/inf",true))
    {
        if(
infernus[playerid] == 0)
        {
            static
                
Float:pos[3];
                
            
GetPlayerPos(playerid,pos[0],pos[1],pos[2]);
            
infernus[playerid] = CreateVehicle(411pos[0], pos[1], pos[2], 0, -1, -110);
            
infernus[playerid]++; // If the vehicle is ID "0", he can't destroy him, so I fix this bug with incrementation of the variable.
            
            
PutPlayerInVehicle(playeridinfernus[playerid]-10);
            
SendClientMessage(playerid,0xFF641AFF,"SERVER: You have Spawned An Infernus.");
            return 
1;
        }
        else
        {
            
DestroyVehicle(infernus[playerid]-1);
            
infernus[playerid] = 0;
        }
        return 
1;
    }
    if(!
strcmp(cmdtext"/nrg"true))
    {
        if(
nrg[playerid] == 0)
        {
            static
                
Float:pos[3];
                
            
GetPlayerPos(playeridpos[0], pos[1], pos[2]);
            
nrg[playerid] = CreateVehicle(522pos[0], pos[1], pos[2], 0, -1, -110);
            
nrg[playerid]++; // If the vehicle is ID "0", he can't destroy him, so I fix this bug with incrementation of the variable.
            
            
PutPlayerInVehicle(playeridnrg[playerid]-10);
            
SendClientMessage(playerid0xFF641AFF"SERVER: You have Spawned A NRG-500.");
            return 
1;
        }
        else if(
nrg[playerid] > 0)
        {
            
DestroyVehicle(nrg[playerid]-1);
            
nrg[playerid] = 0;
        }
        return 
1;
    }
    return 
0;

My problem is, i need to type the command 2 times to destroy the vehicle, but i want to use only one time
Reply


Messages In This Thread
NRG/INF command - by MonSterLikeHD - 02.04.2016, 11:04
Re: NRG/INF command - by SamJust - 02.04.2016, 11:11
Re: NRG/INF command - by SyS - 02.04.2016, 11:19
Re: NRG/INF command - by Vince - 02.04.2016, 11:31
Re: NRG/INF command - by Loinal - 02.04.2016, 11:42

Forum Jump:


Users browsing this thread: 1 Guest(s)