Como encender un vehнculo con una tecla
#3

PHP код:
enum vInfo{
    
bool:pLuces,
    
bool:pMotor,
};
new 
pFunctionVehicles[MAX_VEHICLES][vInfo];
public 
OnPlayerKeyStateChange(playeridnewkeysoldkeys){
    static
        
engine,lights,alarm,doors,bonnet,boot,objective;
    new
        
vehicleid GetPlayerVehicleID(playerid);
    
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
    
// luces
    
if( newkeys KEY_SUBMISSION ){
        if(!
IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1"no estas en un vheiculo");
        if(
GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, -1"no eres conductor");
        if( !
pFunctionVehicles[vehicleid][pLuces] ){
            
pFunctionVehicles[vehicleid][pLuces] = true;
            
SetVehicleParamsEx(vehicleid,engine,VEHICLE_PARAMS_ON,alarm,doors,bonnet,boot,objective);
        }else{
            
pFunctionVehicles[vehicleid][pLuces] = false;
            
SetVehicleParamsEx(vehicleid,engine,VEHICLE_PARAMS_OFF,alarm,doors,bonnet,boot,objective);
        }
    }
    
// motor
    
if( newkeys KEY_FIRE  ){
        if(!
IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1"no estas en un vheiculo");
        if(
GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, -1"no eres conductor");
        if( !
pFunctionVehicles[vehicleid][pMotor] ){
            
pFunctionVehicles[vehicleid][pMotor] = true;
            
SetVehicleParamsEx(vehicleid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
        }else{
            
pFunctionVehicles[vehicleid][pMotor] = false;
            
SetVehicleParamsEx(vehicleid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
        }
    }
    return 
true;

Reply


Messages In This Thread
Como encender un vehнculo con una tecla - by Axl1999 - 27.12.2015, 19:04
Re: Como encender un vehнculo con una tecla - by SickAttack - 27.12.2015, 19:19
Respuesta: Como encender un vehнculo con una tecla - by OTACON - 27.12.2015, 19:36
Respuesta: Como encender un vehнculo con una tecla - by Axl1999 - 27.12.2015, 20:14

Forum Jump:


Users browsing this thread: 1 Guest(s)