SA-MP Forums Archive
help..? - 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: help..? (/showthread.php?tid=592272)



help..? - Rafaeloo - 22.10.2015

PHP код:
#include <a_samp>
public OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
    if(
PRESSED(KEY_SUBMISSION))
    {
        if(
IsPlayerInAnyVehicle(playerid))
        {
            new 
vehid;
            
vehid GetPlayerVehicleID(playerid);
            new
            
iEngineiLightsiAlarm,
            
iDoorsiBonnetiBoot,
            
iObjective;
            
GetVehicleParamsEx(vehidiEngineiLightsiAlarmiDoorsiBonnetiBootiObjective);
            if(
iEngine == 1// Engine is on
            
{
                
SetVehicleParamsEx(vehid0iLightsiAlarmiDoorsiBonnetiBootiObjective); // Turn it off
                
return 1;
            }
            else 
// Engine is off
            
{
                
SetVehicleParamsEx(vehid1iLightsiAlarmiDoorsiBonnetiBootiObjective); // Turn it on
                
return 1;
            }
        }
    }
    return 
1;



i have this code for engine system to turn on with number 2

But , it is showing me one problem when i compile..
Код:
undefined symbol "PRESSED"
How to fix it ?


Re: help..? - ATGOggy - 22.10.2015

Add this line on the top of the script:
PHP код:
#define PRESSED(%0) \
    
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0))) 



Re: help..? - Rafaeloo - 22.10.2015

thanks +rep


Re: help..? - ATGOggy - 22.10.2015

You're welcome.