SA-MP Forums Archive
Help with OnPlayerKey - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help with OnPlayerKey (/showthread.php?tid=124714)



Help with OnPlayerKey - Fedee! - 31.01.2010

I need this to work by pressing number 2 instead of FIRE

Quote:

if (PRESSED(KEY_FIRE))
{
new
v = GetPlayerVehicleID(playerid);
if (v){
#if defined _samp03_
RepairVehicle(v);
#else
SetVehicleHealth(v,1000.0);
PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0);
SendClientMessage(playerid,COLOR_YELLOW,"Car fixed!");
}
else
{
return SendClientMessage(playerid,COLOR_YELLOW,"You need to be in a vehicle!");
#endif
}

Thanks!


Re: Help with OnPlayerKey - bogeymanEST - 31.01.2010

Usually PRESSED(KEY_ACTION) works.
You can't check for a specific key, but a key that has been assigned to the given action. The action key can be assigned to different keys for different people, but usually it is assigned to the 2 key.


Re: Help with OnPlayerKey - Joe Staff - 31.01.2010

in this case you want KEY_SUBMISSION


Re: Help with OnPlayerKey - Fedee! - 31.01.2010

Quote:
Originally Posted by Joe Staff
in this case you want KEY_SUBMISSION
Worked, thanks to you two guys!