help..?
#1

PHP код:
#include <a_samp>
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(
PRESSED(KEY_SUBMISSION))
    {
        if(
IsPlayerInAnyVehicle(playerid))
        {
            new 
vehid;
            
vehid = GetPlayerVehicleID(playerid);
            new
            
iEngine, iLights, iAlarm,
            
iDoors, iBonnet, iBoot,
            
iObjective;
            
GetVehicleParamsEx(vehid, iEngine, iLights, iAlarm, iDoors, iBonnet, iBoot, iObjective);
            if(
iEngine == 1) // Engine is on
            
{
                
SetVehicleParamsEx(vehid, 0, iLights, iAlarm, iDoors, iBonnet, iBoot, iObjective); // Turn it off
                
return 1;
            }
            else 
// Engine is off
            
{
                
SetVehicleParamsEx(vehid, 1, iLights, iAlarm, iDoors, iBonnet, iBoot, iObjective); // 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 ?
Reply
#2

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

thanks +rep
Reply
#4

You're welcome.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)