Light [Rep+] - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Light [Rep+] (
/showthread.php?tid=339232)
Light [Rep+] -
paulll0len - 02.05.2012
How i can make that, if i click number " 2 " then the car or bike lights turns on
Re: Light [Rep+] -
HDFord - 02.05.2012
add something on OnPlayerKeyStateChange and SetVehicleParams should be easy if you know a thing or two but i think i would keep that on a command
Re : Light [Rep+] -
Lenshy - 02.05.2012
use the callback OnPlayerKeyStateChange and the KEY SUBMISSION
Re: Light [Rep+] -
FalconX - 02.05.2012
Quote:
Originally Posted by paulll0len
How i can make that, if i click number " 2 " then the car or bike lights turns on
|
Well I'm not sure about number 2, but you can use any KEYS from the following link.
Scroll down to the keys:
https://sampwiki.blast.hk/wiki/GetPlayerKeys
Now I will write an example for you, you can replace the keys if you want:-
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if (newkeys & KEY_SUBMISSION && IsPlayerInAnyVehicle(playerid))
{
new vid = GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
if(vid != INVALID_VEHICLE_ID)
{
SetVehicleParamsEx(vid, engine, 1, alarm, doors, bonnet, boot, objective); // on light
SendClientMessage(playerid, -1, "Lights on");
}
else
if(vid != INVALID_VEHICLE_ID && lights == 1)
{
SetVehicleParamsEx(vid, engine, 0, alarm, doors, bonnet, boot, objective); // off light
SendClientMessage(playerid, -1, "Lights off");
}
}
return 1;
}
Not sure if it works, but it will compile, have a try.
-FalconX