25.08.2013, 19:07
Help me to make /car engine PLease
#define SCM SendClientMessage
new bool:Engine[MAX_VEHICLES],engine,lights,alarm,doors,bonnet,boot,objective;
public OnGameModeInit()
{
for(new i;i<MAX_VEHICLES;i++)
{
Engine[i] = false;
}
ManualVehicleEngineAndLights();
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext,"/engine",true))
{
new vehicle = GetPlayerVehicleID(playerid);
if(vehicle)
{
if(Engine[vehicle] == false)
{
GetVehicleParamsEx(vehicle,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vehicle,1,lights,alarm,doors,bonnet,boot,objective);
Engine[vehicle] = true;
SCM(playerid,-1,"You Started your vehicle's Engine");
}
else
{
GetVehicleParamsEx(vehicle,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vehicle,0,lights,alarm,doors,bonnet,boot,objective);
Engine[vehicle] = false;
SCM(playerid,-1,"You stopped your vehicle's Engine");
}
}
return 1;
}
return 0;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER)
{
new vehicle = GetPlayerVehicleID(playerid);
if(Engine[vehicle] == false)
{
GetVehicleParamsEx(vehicle,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vehicle,1,lights,alarm,doors,bonnet,boot,objective);
}
else
{
GetVehicleParamsEx(vehicle,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vehicle,0,lights,alarm,doors,bonnet,boot,objective);
}
}
return 1;
}
public OnVehicleSpawn(vehicleid)
{
Engine[vehicleid] = false;
return 1;
}
//scripted by ali on sa-mp forum on 2 minutes :D