Car commands help
#1

I was trying to make a car hood and trunk command that make you be at the front of the car if its the hood and for the trunk the player has to be at the back. I also encounted a problem where when you do the command the hood and trunk does not pop up the client message comes but the cars hood and trunk stay closed.

PHP код:
command(carplayeridparams[])
{
    if(
isnull(params))
    {
        
SendClientMessage(playeridWHITE"SYTNAX: /car [usage]");
        
SendClientMessage(playeridWHITE"USAGES: hood, lights, trunk.");
    }
    else
    {
        new 
closestid GetClosestCar(playerid5);
        new 
vehicleid GetPlayerVehicleID(playerid);
        new 
Float:xFloat:yFloat:z;
        new 
enginelightsalarmdoorsbonnetbootobjective;
        new 
eladbbeo;
        new 
string[256];
        
GetVehicleParamsEx(closestideladbbeo);
        
GetVehicleParamsEx(vehicleidenginelightsalarmdoorsbonnetbootobjective);
        
GetVehiclePos(vehicleidxyz);
        if(
IsPlayerInRangeOfPoint(playerid5xyz-3))
        {
            if(
strcmp(params"hood"true) == 0)
            {
                if(
Vehicles[closestid][Hood] == 0)
                {
                    
Vehicles[closestid][Hood] = 1;
                    
format(string256"* %s opens the hood of their vehicle."GetName(playerid));
                    
NearByMessage(playeridPURPLEstring);
                    
SetVehicleParamsEx(closestidelad1beo);
                }
                else if(
Vehicles[closestid][Hood] == 1)
                {
                    
Vehicles[closestid][Hood] = 0;
                    
format(string256"* %s closes the hood of their vehicle."GetName(playerid));
                    
NearByMessage(playeridPURPLEstring);
                    
SetVehicleParamsEx(closestidelad0beo);
                }
            }
        }
        if(
IsPlayerInRangeOfPoint(playerid5xyz+3))
        {
            if(
strcmp(params"trunk"true) == 0)
            {
                if(
Vehicles[closestid][Trunk] == 0)
                {
                    
Vehicles[closestid][Trunk] = 1;
                    
format(string256"* %s extends his right arm towards the trunk, opening the trunk of their vehicle."GetName(playerid));
                    
NearByMessage(playeridPURPLEstring);
                    
SetVehicleParamsEx(closestideladb1o);
                }
                else if(
Vehicles[closestid][Trunk] == 1)
                {
                    
Vehicles[closestid][Trunk] = 0;
                    
format(string256"* %s closes the hood of their vehicle."GetName(playerid));
                    
NearByMessage(playeridPURPLEstring);
                    
SetVehicleParamsEx(closestideladb0o);
                }
            }
        }
    } 
]

Sorry I didn't know how to put the code t0 pawn
Reply
#2

This Should Do It?


PHP код:
CMD:car(playeridparams[])
{
    if(
isnull(params))
    {
        
SendClientMessageEx(playeridCOLOR_GREY"USAGE: /car [name]");
        
SendClientMessageEx(playeridCOLOR_GREY"Available names: Status, Engine, Lights, Trunk, Hood, Fuel");
        return 
1;
    }
    if(
strcmp(params"engine"true) == && IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
        new 
engine,lights,alarm,doors,bonnet,boot,objective,vehicleid;
        
vehicleid GetPlayerVehicleID(playerid);
        if(
GetVehicleModel(vehicleid) == 481 || GetVehicleModel(vehicleid) == 509 || GetVehicleModel(vehicleid) == 510 || vehicleid == CrateIslandVehicles[0] || vehicleid == CrateIslandVehicles[1]) return SendClientMessageEx(playerid,COLOR_WHITE,"This command can't be used in this vehicle.");
        
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
        if(
engine == VEHICLE_PARAMS_ON)
        {
            
SetVehicleEngine(vehicleidplayerid);
        }
        else if((
engine == VEHICLE_PARAMS_OFF || engine == VEHICLE_PARAMS_UNSET))
        {
            
SendClientMessageEx(playeridCOLOR_WHITE"Vehicle engine starting, please wait...");
            
SetTimerEx("SetVehicleEngine"10000"dd",  vehicleidplayerid);
        }
    }
    else if(
strcmp(params"lights"true) == && IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
        new 
vehicleid GetPlayerVehicleID(playerid);
        if(
GetVehicleModel(vehicleid) == 481 || GetVehicleModel(vehicleid) == 509 || GetVehicleModel(vehicleid) == 510) return SendClientMessageEx(playerid,COLOR_WHITE,"This command can't be used in this vehicle.");
        
SetVehicleLights(vehicleidplayerid);
    }
    else if(
strcmp(params"hood"true) == && IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
        if(
IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
            new 
vehicleid GetPlayerVehicleID(playerid);
            if(
GetVehicleModel(vehicleid) == 481 || GetVehicleModel(vehicleid) == 509 || GetVehicleModel(vehicleid) == 510 || IsAPlane(vehicleid) || IsABike(vehicleid))
            {
                return 
SendClientMessageEx(playerid,COLOR_WHITE,"This command can't be used in this vehicle.");
            }
            
SetVehicleHood(vehicleidplayerid);
        }
        else if(!
IsPlayerInAnyVehicle(playerid))
        {
            new 
closestcar GetClosestCar(playerid);
            if(
IsPlayerInRangeOfVehicle(playeridclosestcar5.0))
            {
                if(
GetVehicleModel(closestcar) == 481 || GetVehicleModel(closestcar) == 509 || GetVehicleModel(closestcar) == 510 || IsAPlane(closestcar) || IsABike(closestcar))
                {
                    return 
SendClientMessageEx(playerid,COLOR_WHITE,"This command can't be used on this vehicle.");
                }
                
SetVehicleHood(closestcarplayerid);
            }
        }
    }
    else if(
strcmp(params"trunk"true) == 0)
      {
        if(
IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
            new 
vehicleid GetPlayerVehicleID(playerid);
            if(
GetVehicleModel(vehicleid) == 481 || GetVehicleModel(vehicleid) == 509 || GetVehicleModel(vehicleid) == 510)
            {
                return 
SendClientMessageEx(playerid,COLOR_WHITE,"This command can't be used in this vehicle.");
            }
            
SetVehicleTrunk(vehicleidplayerid);
        }
        else if(!
IsPlayerInAnyVehicle(playerid))
        {
            new 
closestcar GetClosestCar(playerid);
            if(
IsPlayerInRangeOfVehicle(playeridclosestcar5.0))
            {
                if(
GetVehicleModel(closestcar) == 481 || GetVehicleModel(closestcar) == 509 || GetVehicleModel(closestcar) == 510)
                {
                    return 
SendClientMessageEx(playerid,COLOR_WHITE,"This command can't be used on this vehicle.");
                }
                
SetVehicleTrunk(closestcarplayerid);
            }
        }
    }
    else if(
strcmp(params"fuel"true) == && IsPlayerInAnyVehicle(playerid))
    {
        if(
IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
            new 
vehicleid GetPlayerVehicleID(playerid);
            new 
engine,lights,alarm,doors,bonnet,boot,objective,enginestatus[4],lightstatus[4], string[48];
            
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
            if(
GetVehicleModel(vehicleid) == 481 || GetVehicleModel(vehicleid) == 509 || GetVehicleModel(vehicleid) == 510) return SendClientMessageEx(playerid,COLOR_RED,"This vehicle doesn't need fuel.");
            if(
engine != VEHICLE_PARAMS_ONstrcpy(enginestatus"OFF"4);
            else 
strcpy(enginestatus"ON"3);
            if(
lights != VEHICLE_PARAMS_ONstrcpy(lightstatus"OFF"4);
            else 
strcpy(lightstatus"ON"3);
            
format(stringsizeof(string), "Engine: %s | Lights: %s | Fuel: %.2f.",enginestatus,lightstatus,VehicleFuel[vehicleid]);
            
SendClientMessageEx(playeridCOLOR_WHITEstring);
        }
    }
    else if(
strcmp(params"status"true) == 0)
    {
        if(
IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
            new 
vehicleid GetPlayerVehicleID(playerid);
            new 
engine,lights,alarm,doors,bonnet,boot,objective,enginestatus[4],lightstatus[4], string[48];
            
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
            if(
GetVehicleModel(vehicleid) == 481 || GetVehicleModel(vehicleid) == 509 || GetVehicleModel(vehicleid) == 510) return SendClientMessageEx(playerid,COLOR_RED,"This vehicle doesn't need fuel.");
            if(
engine != VEHICLE_PARAMS_ONstrcpy(enginestatus"OFF"4);
            else 
strcpy(enginestatus"ON"3);
            if(
lights != VEHICLE_PARAMS_ONstrcpy(lightstatus"OFF"4);
            else 
strcpy(lightstatus"ON"3);
            
format(stringsizeof(string), "Engine: %s | Lights: %s | Fuel: %.2f.",enginestatus,lightstatus,VehicleFuel[vehicleid]);
            
SendClientMessageEx(playeridCOLOR_WHITEstring);
        }
    }
    return 
1;

Reply
#3

Quote:
Originally Posted by ~Pawno~
Посмотреть сообщение
This Should Do It?


PHP код:
CMD:car(playeridparams[])
{
    if(
isnull(params))
    {
        
SendClientMessageEx(playeridCOLOR_GREY"USAGE: /car [name]");
        
SendClientMessageEx(playeridCOLOR_GREY"Available names: Status, Engine, Lights, Trunk, Hood, Fuel");
        return 
1;
    }
    if(
strcmp(params"engine"true) == && IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
        new 
engine,lights,alarm,doors,bonnet,boot,objective,vehicleid;
        
vehicleid GetPlayerVehicleID(playerid);
        if(
GetVehicleModel(vehicleid) == 481 || GetVehicleModel(vehicleid) == 509 || GetVehicleModel(vehicleid) == 510 || vehicleid == CrateIslandVehicles[0] || vehicleid == CrateIslandVehicles[1]) return SendClientMessageEx(playerid,COLOR_WHITE,"This command can't be used in this vehicle.");
        
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
        if(
engine == VEHICLE_PARAMS_ON)
        {
            
SetVehicleEngine(vehicleidplayerid);
        }
        else if((
engine == VEHICLE_PARAMS_OFF || engine == VEHICLE_PARAMS_UNSET))
        {
            
SendClientMessageEx(playeridCOLOR_WHITE"Vehicle engine starting, please wait...");
            
SetTimerEx("SetVehicleEngine"10000"dd",  vehicleidplayerid);
        }
    }
    else if(
strcmp(params"lights"true) == && IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
        new 
vehicleid GetPlayerVehicleID(playerid);
        if(
GetVehicleModel(vehicleid) == 481 || GetVehicleModel(vehicleid) == 509 || GetVehicleModel(vehicleid) == 510) return SendClientMessageEx(playerid,COLOR_WHITE,"This command can't be used in this vehicle.");
        
SetVehicleLights(vehicleidplayerid);
    }
    else if(
strcmp(params"hood"true) == && IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
        if(
IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
            new 
vehicleid GetPlayerVehicleID(playerid);
            if(
GetVehicleModel(vehicleid) == 481 || GetVehicleModel(vehicleid) == 509 || GetVehicleModel(vehicleid) == 510 || IsAPlane(vehicleid) || IsABike(vehicleid))
            {
                return 
SendClientMessageEx(playerid,COLOR_WHITE,"This command can't be used in this vehicle.");
            }
            
SetVehicleHood(vehicleidplayerid);
        }
        else if(!
IsPlayerInAnyVehicle(playerid))
        {
            new 
closestcar GetClosestCar(playerid);
            if(
IsPlayerInRangeOfVehicle(playeridclosestcar5.0))
            {
                if(
GetVehicleModel(closestcar) == 481 || GetVehicleModel(closestcar) == 509 || GetVehicleModel(closestcar) == 510 || IsAPlane(closestcar) || IsABike(closestcar))
                {
                    return 
SendClientMessageEx(playerid,COLOR_WHITE,"This command can't be used on this vehicle.");
                }
                
SetVehicleHood(closestcarplayerid);
            }
        }
    }
    else if(
strcmp(params"trunk"true) == 0)
      {
        if(
IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
            new 
vehicleid GetPlayerVehicleID(playerid);
            if(
GetVehicleModel(vehicleid) == 481 || GetVehicleModel(vehicleid) == 509 || GetVehicleModel(vehicleid) == 510)
            {
                return 
SendClientMessageEx(playerid,COLOR_WHITE,"This command can't be used in this vehicle.");
            }
            
SetVehicleTrunk(vehicleidplayerid);
        }
        else if(!
IsPlayerInAnyVehicle(playerid))
        {
            new 
closestcar GetClosestCar(playerid);
            if(
IsPlayerInRangeOfVehicle(playeridclosestcar5.0))
            {
                if(
GetVehicleModel(closestcar) == 481 || GetVehicleModel(closestcar) == 509 || GetVehicleModel(closestcar) == 510)
                {
                    return 
SendClientMessageEx(playerid,COLOR_WHITE,"This command can't be used on this vehicle.");
                }
                
SetVehicleTrunk(closestcarplayerid);
            }
        }
    }
    else if(
strcmp(params"fuel"true) == && IsPlayerInAnyVehicle(playerid))
    {
        if(
IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
            new 
vehicleid GetPlayerVehicleID(playerid);
            new 
engine,lights,alarm,doors,bonnet,boot,objective,enginestatus[4],lightstatus[4], string[48];
            
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
            if(
GetVehicleModel(vehicleid) == 481 || GetVehicleModel(vehicleid) == 509 || GetVehicleModel(vehicleid) == 510) return SendClientMessageEx(playerid,COLOR_RED,"This vehicle doesn't need fuel.");
            if(
engine != VEHICLE_PARAMS_ONstrcpy(enginestatus"OFF"4);
            else 
strcpy(enginestatus"ON"3);
            if(
lights != VEHICLE_PARAMS_ONstrcpy(lightstatus"OFF"4);
            else 
strcpy(lightstatus"ON"3);
            
format(stringsizeof(string), "Engine: %s | Lights: %s | Fuel: %.2f.",enginestatus,lightstatus,VehicleFuel[vehicleid]);
            
SendClientMessageEx(playeridCOLOR_WHITEstring);
        }
    }
    else if(
strcmp(params"status"true) == 0)
    {
        if(
IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
            new 
vehicleid GetPlayerVehicleID(playerid);
            new 
engine,lights,alarm,doors,bonnet,boot,objective,enginestatus[4],lightstatus[4], string[48];
            
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
            if(
GetVehicleModel(vehicleid) == 481 || GetVehicleModel(vehicleid) == 509 || GetVehicleModel(vehicleid) == 510) return SendClientMessageEx(playerid,COLOR_RED,"This vehicle doesn't need fuel.");
            if(
engine != VEHICLE_PARAMS_ONstrcpy(enginestatus"OFF"4);
            else 
strcpy(enginestatus"ON"3);
            if(
lights != VEHICLE_PARAMS_ONstrcpy(lightstatus"OFF"4);
            else 
strcpy(lightstatus"ON"3);
            
format(stringsizeof(string), "Engine: %s | Lights: %s | Fuel: %.2f.",enginestatus,lightstatus,VehicleFuel[vehicleid]);
            
SendClientMessageEx(playeridCOLOR_WHITEstring);
        }
    }
    return 
1;

Is this even my code?
Reply
#4

pawn Код:
command(car, playerid, params[])
{
    if(isnull(params))
    {
        SendClientMessage(playerid, WHITE, "SYTNAX: /car [usage]");
        SendClientMessage(playerid, WHITE, "USAGES: hood, lights, trunk.");
    }
    else
    {
        new closestid = GetClosestCar(playerid, 5);
        new vehicleid = GetPlayerVehicleID(playerid);


        new Float:x, Float:y, Float:z;

        new engine, lights, alarm, doors, bonnet, boot, objective;
        new e, l, a, d, b, be, o;

        new string[256];

        GetVehicleParamsEx(closestid, vid,engine,lights,alarm,doors,bonnet, boot,objective);
        GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);


        GetVehiclePos(vehicleid, x, y, z);

        if(IsPlayerInRangeOfPoint(playerid, 5, x, y, z-3))
        {
            if(strcmp(params, "hood", true) == 0)
            {
                if(Vehicles[closestid][Hood] == 0)
                {
                    Vehicles[closestid][Hood] = 1;
                    format(string, 256, "* %s opens the hood of their vehicle.", GetName(playerid));
                    NearByMessage(playerid, PURPLE, string);
                    SetVehicleParamsEx(closestid, engine, lights, alarm, doors, 1, boot, objective);
                }
                else if(Vehicles[closestid][Hood] == 1)
                {
                    Vehicles[closestid][Hood] = 0;
                    format(string, 256, "* %s closes the hood of their vehicle.", GetName(playerid));
                    NearByMessage(playerid, PURPLE, string);
                    SetVehicleParamsEx(closestid, engine, lights, alarm, doors, 0, boot, objective);
                }
            }
        }
        if(IsPlayerInRangeOfPoint(playerid, 5, x, y, z+3))
        {
            if(strcmp(params, "trunk", true) == 0)
            {
                if(Vehicles[closestid][Trunk] == 0)
                {
                    Vehicles[closestid][Trunk] = 1;
                    format(string, 256, "* %s extends his right arm towards the trunk, opening the trunk of their vehicle.", GetName(playerid));
                    NearByMessage(playerid, PURPLE, string);
                    SetVehicleParamsEx(closestid, engine, lights, alarm, doors, bonnet, 1, objective);
                }
                else if(Vehicles[closestid][Trunk] == 1)
                {
                    Vehicles[closestid][Trunk] = 0;
                    format(string, 256, "* %s closes the hood of their vehicle.", GetName(playerid));
                    NearByMessage(playerid, PURPLE, string);
                    SetVehicleParamsEx(closestid, engine, lights, alarm, doors, bonnet, 0, objective);
                }
            }
        }
    }
Not tested - should work.
Reply
#5

Quote:
Originally Posted by Lido
Посмотреть сообщение
pawn Код:
command(car, playerid, params[])
{
    if(isnull(params))
    {
        SendClientMessage(playerid, WHITE, "SYTNAX: /car [usage]");
        SendClientMessage(playerid, WHITE, "USAGES: hood, lights, trunk.");
    }
    else
    {
        new closestid = GetClosestCar(playerid, 5);
        new vehicleid = GetPlayerVehicleID(playerid);


        new Float:x, Float:y, Float:z;

        new engine, lights, alarm, doors, bonnet, boot, objective;
        new e, l, a, d, b, be, o;

        new string[256];

        GetVehicleParamsEx(closestid, vid,engine,lights,alarm,doors,bonnet, boot,objective);
        GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);


        GetVehiclePos(vehicleid, x, y, z);

        if(IsPlayerInRangeOfPoint(playerid, 5, x, y, z-3))
        {
            if(strcmp(params, "hood", true) == 0)
            {
                if(Vehicles[closestid][Hood] == 0)
                {
                    Vehicles[closestid][Hood] = 1;
                    format(string, 256, "* %s opens the hood of their vehicle.", GetName(playerid));
                    NearByMessage(playerid, PURPLE, string);
                    SetVehicleParamsEx(closestid, engine, lights, alarm, doors, 1, boot, objective);
                }
                else if(Vehicles[closestid][Hood] == 1)
                {
                    Vehicles[closestid][Hood] = 0;
                    format(string, 256, "* %s closes the hood of their vehicle.", GetName(playerid));
                    NearByMessage(playerid, PURPLE, string);
                    SetVehicleParamsEx(closestid, engine, lights, alarm, doors, 0, boot, objective);
                }
            }
        }
        if(IsPlayerInRangeOfPoint(playerid, 5, x, y, z+3))
        {
            if(strcmp(params, "trunk", true) == 0)
            {
                if(Vehicles[closestid][Trunk] == 0)
                {
                    Vehicles[closestid][Trunk] = 1;
                    format(string, 256, "* %s extends his right arm towards the trunk, opening the trunk of their vehicle.", GetName(playerid));
                    NearByMessage(playerid, PURPLE, string);
                    SetVehicleParamsEx(closestid, engine, lights, alarm, doors, bonnet, 1, objective);
                }
                else if(Vehicles[closestid][Trunk] == 1)
                {
                    Vehicles[closestid][Trunk] = 0;
                    format(string, 256, "* %s closes the hood of their vehicle.", GetName(playerid));
                    NearByMessage(playerid, PURPLE, string);
                    SetVehicleParamsEx(closestid, engine, lights, alarm, doors, bonnet, 0, objective);
                }
            }
        }
    }
Not tested - should work.
Some warnings and one error please could you fix it?

Arko.pwn:error 017: undefined symbol "vid"
Arko.pwn(12055) : warning 203: symbol is never used: "o"
Arko.pwn(12055) : warning 203: symbol is never used: "be"
Arko.pwn(12055) : warning 203: symbol is never used: "b"
Arko.pwn(12055) : warning 203: symbol is never used: "d"
rko.pwn(12055) : warning 203: symbol is never used: "a"
Arko.pwn(12055) : warning 203: symbol is never used: "l"
Arko.pwn(12055) : warning 203: symbol is never used: "e
Reply
#6

PHP код:
command(carplayeridparams[]) 

    if(
isnull(params)) 
    { 
        
SendClientMessage(playeridWHITE"SYTNAX: /car [usage]"); 
        
SendClientMessage(playeridWHITE"USAGES: hood, lights, trunk."); 
    } 
    else 
    { 
        new 
closestid GetClosestCar(playerid5); 
        new 
vehicleid GetPlayerVehicleID(playerid); 


        new 
Float:xFloat:yFloat:z

        new 
enginelightsalarmdoorsbonnetbootobjective
       

        new 
string[256]; 

        
GetVehicleParamsEx(closestidengine,lights,alarm,doors,bonnetboot,objective); 
        
GetVehicleParamsEx(vehicleidenginelightsalarmdoorsbonnetbootobjective); 


        
GetVehiclePos(vehicleidxyz); 

        if(
IsPlayerInRangeOfPoint(playerid5xyz-3)) 
        { 
            if(
strcmp(params"hood"true) == 0
            { 
                if(
Vehicles[closestid][Hood] == 0
                { 
                    
Vehicles[closestid][Hood] = 1
                    
format(string256"* %s opens the hood of their vehicle."GetName(playerid)); 
                    
NearByMessage(playeridPURPLEstring); 
                    
SetVehicleParamsEx(closestidenginelightsalarmdoors1bootobjective); 
                } 
                else if(
Vehicles[closestid][Hood] == 1
                { 
                    
Vehicles[closestid][Hood] = 0
                    
format(string256"* %s closes the hood of their vehicle."GetName(playerid)); 
                    
NearByMessage(playeridPURPLEstring); 
                    
SetVehicleParamsEx(closestidenginelightsalarmdoors0bootobjective); 
                } 
            } 
        } 
        if(
IsPlayerInRangeOfPoint(playerid5xyz+3)) 
        { 
            if(
strcmp(params"trunk"true) == 0
            { 
                if(
Vehicles[closestid][Trunk] == 0
                { 
                    
Vehicles[closestid][Trunk] = 1
                    
format(string256"* %s extends his right arm towards the trunk, opening the trunk of their vehicle."GetName(playerid)); 
                    
NearByMessage(playeridPURPLEstring); 
                    
SetVehicleParamsEx(closestidenginelightsalarmdoorsbonnet1objective); 
                } 
                else if(
Vehicles[closestid][Trunk] == 1
                { 
                    
Vehicles[closestid][Trunk] = 0
                    
format(string256"* %s closes the hood of their vehicle."GetName(playerid)); 
                    
NearByMessage(playeridPURPLEstring); 
                    
SetVehicleParamsEx(closestidenginelightsalarmdoorsbonnet0objective); 
                } 
            } 
        } 
    } 
Reply
#7

Quote:
Originally Posted by Lido
Посмотреть сообщение
PHP код:
command(carplayeridparams[]) 

    if(
isnull(params)) 
    { 
        
SendClientMessage(playeridWHITE"SYTNAX: /car [usage]"); 
        
SendClientMessage(playeridWHITE"USAGES: hood, lights, trunk."); 
    } 
    else 
    { 
        new 
closestid GetClosestCar(playerid5); 
        new 
vehicleid GetPlayerVehicleID(playerid); 
        new 
Float:xFloat:yFloat:z
        new 
enginelightsalarmdoorsbonnetbootobjective
       
        new 
string[256]; 
        
GetVehicleParamsEx(closestidengine,lights,alarm,doors,bonnetboot,objective); 
        
GetVehicleParamsEx(vehicleidenginelightsalarmdoorsbonnetbootobjective); 
        
GetVehiclePos(vehicleidxyz); 
        if(
IsPlayerInRangeOfPoint(playerid5xyz-3)) 
        { 
            if(
strcmp(params"hood"true) == 0
            { 
                if(
Vehicles[closestid][Hood] == 0
                { 
                    
Vehicles[closestid][Hood] = 1
                    
format(string256"* %s opens the hood of their vehicle."GetName(playerid)); 
                    
NearByMessage(playeridPURPLEstring); 
                    
SetVehicleParamsEx(closestidenginelightsalarmdoors1bootobjective); 
                } 
                else if(
Vehicles[closestid][Hood] == 1
                { 
                    
Vehicles[closestid][Hood] = 0
                    
format(string256"* %s closes the hood of their vehicle."GetName(playerid)); 
                    
NearByMessage(playeridPURPLEstring); 
                    
SetVehicleParamsEx(closestidenginelightsalarmdoors0bootobjective); 
                } 
            } 
        } 
        if(
IsPlayerInRangeOfPoint(playerid5xyz+3)) 
        { 
            if(
strcmp(params"trunk"true) == 0
            { 
                if(
Vehicles[closestid][Trunk] == 0
                { 
                    
Vehicles[closestid][Trunk] = 1
                    
format(string256"* %s extends his right arm towards the trunk, opening the trunk of their vehicle."GetName(playerid)); 
                    
NearByMessage(playeridPURPLEstring); 
                    
SetVehicleParamsEx(closestidenginelightsalarmdoorsbonnet1objective); 
                } 
                else if(
Vehicles[closestid][Trunk] == 1
                { 
                    
Vehicles[closestid][Trunk] = 0
                    
format(string256"* %s closes the hood of their vehicle."GetName(playerid)); 
                    
NearByMessage(playeridPURPLEstring); 
                    
SetVehicleParamsEx(closestidenginelightsalarmdoorsbonnet0objective); 
                } 
            } 
        } 
    } 
Thank you
Reply
#8

Does it work in game?
Reply
#9

Quote:
Originally Posted by Lido
Посмотреть сообщение
Does it work in game?
Nope the hood and truck are still closed
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)