Car Lights and Engine System -
Uberanwar - 14.08.2013
Hi guys, I'm trying to make a car lights and engine system, what functions should I use and how do I do it? I'm trying to make it dcmd+sscanf but I'm new in sscanf. Oh and I'm trying to make like ''Uberanwar has turned on his vehicle's ignition'' to the nearest player. (Not globally) Hope you guys can help me, thnks.
Re: Car Lights and Engine System -
dEcooR - 14.08.2013
I will show you now an example for alarm
Код:
new eng,ligh,alarm,door,bonn,boot,objective;
GetVehicleParamsEx(GetPlayerVehicleID(playerid),eng,ligh,alarm,door,bonn,boot,objective);
SetVehicleParamsEx(GetPlayerVehicleID(playerid),eng,ligh,VEHICLE_PARAMS_ON,door,bonn,boot,objective);
Re: Car Lights and Engine System -
Stefand - 14.08.2013
This is from my own script, change it to whatever you need:
pawn Код:
command(lights, playerid, params[])
{
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return 1;
new engine,lights,alarm,doors,bonnet,boot,objective;
new vid = GetPlayerVehicleID(playerid);
new string[128];
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
if(vid != INVALID_VEHICLE_ID)
{
if(lights == VEHICLE_PARAMS_ON)
{
SetVehicleParamsEx(vid,engine,VEHICLE_PARAMS_OFF,alarm,doors,bonnet,boot,objective);
format(string, sizeof(string), "* %s turns off the vehicle lights.", RPName(playerid));
NearByMessage(playerid, NICESKY, string);
}
else
{
if(Vehicles[vid][Battery] >= 1)
{
SetVehicleParamsEx(vid,engine,VEHICLE_PARAMS_ON,alarm,doors,bonnet,boot,objective);
format(string, sizeof(string), "* %s turns on the vehicle lights.", RPName(playerid));
NearByMessage(playerid, NICESKY, string);
}
else
{
RemoveTextMessage(playerid);
TextDrawShowForPlayer(playerid, Text:OutOfBattery);
SetTimerEx("RemoveTextMessage", 3500, false, "d", playerid);
}
}
}
return 1;
}
forward NearByMessage(playerid, colour, string[]);
public NearByMessage(playerid, colour, string[])
{
new Float: PlayerX, Float: PlayerY, Float: PlayerZ;
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
GetPlayerPos(playerid, PlayerX, PlayerY, PlayerZ);
if(IsPlayerInRangeOfPoint(i, 12, PlayerX, PlayerY, PlayerZ))
{
if(GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i) && GetPlayerInterior(playerid) == GetPlayerInterior(i))
{
SendClientMessage(i, colour, string);
}
}
}
}
return 1;
}
Re: Car Lights and Engine System -
Vanter - 14.08.2013
http://forum.sa-mp.com/showthread.ph...82#post2650782