Car Engine
#1

Hello,

I have one older Car Engine System,
Its alredy maked that i can turn on car with command /engine or button,
But when i press F and come in to car he automaticly put engine on (( I cant drive it, its only Engine on ))

So i want make that when i write /engine turning engine on, without that if i sit in car engine automaticly on,

What is function for car engine on/off,

PS sorry for my bad english
Reply
#2

at OnFilterScriptInit or OnGameModeInit put this ManualVehicleEngineAndLights();
Reply
#3

Quote:
Originally Posted by RogueDrifter
Посмотреть сообщение
at OnFilterScriptInit or OnGameModeInit put this ManualVehicleEngineAndLights();
It works, but now when i try to turn it on, hes not start hehe
Reply
#4

Quote:
Originally Posted by RoX123
Посмотреть сообщение
It works, but now when i try to turn it on, hes not start hehe
I use this one, you might want to edit it but works fine.

PHP код:
CMD:engine(playerid,params[])
{
    if(
GetPlayerState(playerid) != PLAYER_STATE_DRIVER)return ShowErrorDialog(playerid"You are not driving a vehicle");
    new 
vehicleid=GetPlayerVehicleID(playerid),engine,lights,alarm,doors,bonnet,boot,objective;
    new 
Float:health;
    
GetVehicleHealth(vehicleid,health);
    
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
    if(
Fuel[vehicleid] <= 0) return ShowErrorDialog(playerid"This vehicle is out of fuel!");
    if(
health <= 650) return ShowErrorDialog(playerid"The car does not start anymore!");
    new 
Float:xFloat:yFloat:zname[MAX_PLAYER_NAME], string[100];
    
GetPlayerName(playeridnamesizeof(name));
    
GetPlayerPos(playeridxyz);
    for(new 
i=0i<GetMaxPlayers(); i++)
    {
        if(
IsPlayerInRangeOfPoint(i20.00xyz)) 
        {
            if(
engine == 1)
            {
                
SetVehicleParamsEx(vehicleid,0,0,alarm,doors,bonnet,boot,objective);
                if(
Gender[playerid] == 1)
                {
                    
format(string,sizeof(string),"%s(%i) switches the engine of his %s off.",PlayerName(playerid),playerid,VehicleNames[GetVehicleModel(vehicleid)-400]);
                    
SendClientMessage(iORANGEstring);
                }
                else if(
Gender[playerid] == 2)
                { 
                    
format(string,sizeof(string),"%s(%i) switches the engine of her %s off.",PlayerName(playerid),playerid);
                    
SendClientMessage(iORANGEstring);
                }
            }
            else
            {
                
SetVehicleParamsEx(vehicleid,1,lights,alarm,doors,bonnet,boot,objective);
                if(
Gender[playerid] == 1)
                {
                    
format(string,sizeof(string),"%s(%i) switches the engine of his %s on.",PlayerName(playerid),playerid,VehicleNames[GetVehicleModel(vehicleid)-400]);
                    
SendClientMessage(iORANGEstring);
                }
                else if(
Gender[playerid] == 2)
                {
                    
format(string,sizeof(string),"%s(%i) switches the engine of her %s on.",PlayerName(playerid),playerid,VehicleNames[GetVehicleModel(vehicleid)-400]);
                    
SendClientMessage(iORANGEstring);
                }
            }
        }
    }
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)