22.08.2016, 12:31
How do I add a cmd to turn on a vehicle's light manually on SAMP 0.3.7?
CMD:lights(playerid,params[])
{
new string[124];
new vehicleid = GetPlayerVehicleID(playerid);
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
if(GetPlayerState(playerid) == 2)
{
if(lights != 1)
{
SetVehicleParamsEx(vehicleid, engine, 1, alarm, doors, bonnet, boot, 0);
format(string, sizeof(string), "* %s turns the lights on.", GetName(playerid));
ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
else if(lights != 0)
{
SetVehicleParamsEx(vehicleid, engine, 0, alarm, doors, bonnet, boot, 0);
format(string, sizeof(string), "* %s turns the lights off.", GetName(playerid));
ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
}
return 1;
}
|
Code i have for it.
Код:
CMD:lights(playerid,params[])
{
new string[124];
new vehicleid = GetPlayerVehicleID(playerid);
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
if(GetPlayerState(playerid) == 2)
{
if(lights != 1)
{
SetVehicleParamsEx(vehicleid, engine, 1, alarm, doors, bonnet, boot, 0);
format(string, sizeof(string), "* %s turns the lights on.", GetName(playerid));
ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
else if(lights != 0)
{
SetVehicleParamsEx(vehicleid, engine, 0, alarm, doors, bonnet, boot, 0);
format(string, sizeof(string), "* %s turns the lights off.", GetName(playerid));
ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
}
return 1;
}
|