COMMAND:carlights(playerid,params[])
{
if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new veh = GetPlayerVehicleID(playerid);
new param[7];
GetVehicleParamsEx(veh,param[0],param[1],param[2],param[3],param[4],param[5],param[6]);
{
if(!param[1])
{
StartLights(veh);
SendEmote(playerid,"presses an button behind the steering wheel to turn on the lights.");
return 1;
}
else
{
StartLights(veh);
SendEmote(playerid,"presses an button behind the steering wheel to turn off the lights.");
return 1;
}
}
}
else
{
SendErrorMsg(playerid,"You are not in a vehicle.");
return 1;
}
}
public StopLights(vehicleid)
{
new params[7];
GetVehicleParamsEx(vehicleid,params[0],params[1],params[2],params[3],params[4],params[5],params[6]);
SetVehicleParamsEx(vehicleid,params[0],0,params[2],params[3],params[4],params[5],params[6]);
}
public StartLights(vehicleid)
{
new params[7];
GetVehicleParamsEx(vehicleid,params[0],params[1],params[2],params[3],params[4],params[5],params[6]);
SetVehicleParamsEx(vehicleid,params[0],1,params[2],params[3],params[4],params[5],params[6]);
}
CMD:carlights(playerid, params[]) { if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return 1; new variables[7], vehicleid = GetPlayerVehicleID(playerid); GetVehicleParamsEx(vehicleid, variables[0], variables[1], variables[2], variables[3], variables[4], variables[5], variables[6]); if(variables[1] != VEHICLE_PARAMS_ON) { SetVehicleParamsEx(vehicleid, variables[0], VEHICLE_PARAMS_ON, variables[2], variables[3], variables[4], variables[5], variables[6]); } else { SetVehicleParamsEx(vehicleid, variables[0], VEHICLE_PARAMS_OFF, variables[2], variables[3], variables[4], variables[5], variables[6]); } return 1; }
CMD:carlights(playerid,params[])
{
if(GetPlayerState(playerid) == 2)
{
new veh = GetPlayerVehicleID(playerid);
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(veh, engine, lights, alarm, doors, bonnet, boot, objective);
{
if(lights == 0)
{
SetVehicleParamsEx(veh, engine, 1, alarm, doors, bonnet, boot, objective);
SendEmote(playerid,"presses an button behind the steering wheel to turn on the lights.");
return 1;
}
else
{
SetVehicleParamsEx(veh, engine, 0, alarm, doors, bonnet, boot, objective);
SendEmote(playerid,"presses an button behind the steering wheel to turn off the lights.");
return 1;
}
}
}
else
{
SendErrorMsg(playerid,"You are not in a vehicle.");
return 1;
}
}
ManualVehicleEngineAndLights();
ManualVehicleEngineAndLights();
CMD:car(playerid, params[])
{
if(isnull(params))
{
SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /car [name]");
SendClientMessageEx(playerid, COLOR_GREY, "Available names: Status, Engine, Lights, Trunk, Hood, Fuel");
return 1;
}
if(strcmp(params, "engine", true) == 0 && 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) 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(vehicleid, playerid);
}
else if((engine == VEHICLE_PARAMS_OFF || engine == VEHICLE_PARAMS_UNSET))
{
SendClientMessageEx(playerid, COLOR_WHITE, "Vehicle engine starting, please wait...");
SetTimerEx("SetVehicleEngine", 1000, 0, "dd", vehicleid, playerid);
}
}
else if(strcmp(params, "lights", true) == 0 && 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(vehicleid, playerid);
}
else if(strcmp(params, "hood", true) == 0 && 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(vehicleid, playerid);
}
else if(!IsPlayerInAnyVehicle(playerid))
{
new closestcar = GetClosestCar(playerid);
if(IsPlayerInRangeOfVehicle(playerid, closestcar, 5.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(closestcar, playerid);
}
}
}
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(vehicleid, playerid);
}
else if(!IsPlayerInAnyVehicle(playerid))
{
new closestcar = GetClosestCar(playerid);
if(IsPlayerInRangeOfVehicle(playerid, closestcar, 5.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(closestcar, playerid);
}
}
}
else if(strcmp(params, "fuel", true) == 0 && IsPlayerInAnyVehicle(playerid))
{
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 481 || GetVehicleModel(GetPlayerVehicleID(playerid)) == 509 || GetVehicleModel(GetPlayerVehicleID(playerid)) == 510) return SendClientMessageEx(playerid,COLOR_RED,"This vehicle doesn't need fuel.");
if(GetPVarInt(playerid, "fuelonoff") == 0)
{
SendClientMessageEx(playerid, COLOR_WHITE, "You have turned on the fuel indicator (green bar).");
SetPVarInt(playerid, "fuelonoff", 1);
FuelBar[playerid] = CreateProgressBar(548.00, 26.00, 57.50, 3.20, 866792447, 100.0);
textdrawscount++;
SetProgressBarValue(FuelBar[playerid], VehicleFuel[GetPlayerVehicleID(playerid)]);
ShowProgressBarForPlayer(playerid, FuelBar[playerid]);
}
else
{
SendClientMessageEx(playerid, COLOR_WHITE, "You have turned off the fuel indicator (green bar).");
SetPVarInt(playerid, "fuelonoff", 0);
DestroyProgressBar(FuelBar[playerid]);
textdrawscount--;
FuelBar[playerid] = INVALID_BAR_ID;
}
}
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_ON) format(enginestatus, sizeof(enginestatus), "OFF");
else format(enginestatus, sizeof(enginestatus), "ON");
if(lights != VEHICLE_PARAMS_ON) format(lightstatus, sizeof(lightstatus), "OFF");
else format(lightstatus, sizeof(lightstatus), "ON");
format(string, sizeof(string), "Engine: %s | Lights: %s | Fuel: %.2f.",enginestatus,lightstatus,VehicleFuel[vehicleid]);
SendClientMessageEx(playerid, COLOR_WHITE, string);
}
}
return 1;
}
Here we go budy a whole set
PHP Code:
Thomas Williams Owner of Operation Roleplay, Stats Below \/ \/ |