[HELP]OnPlayerKeyStateChange problem
#1

So,my problem is that I have set when pressing the Up arrow key in vehicle,to start vehicle's engine,but for some reason not Up arrow key does that but Num8.I have read here that Up arrow is defined as KEY_UP,but as I said it actually defines Num 8 key.I use SAMP 0.3x.
Here is the code from my script for starting the vehicle engine when pressing KEY_UP
Код:
	if (((newkeys & KEY_UP) && !(oldkeys & KEY_UP)) && (GetPlayerVehicleID(playerid) != 0))
	{
	    vehicleid = GetPlayerVehicleID(playerid);
		// Get the current status of the vehicle
		GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
	
		// Check if the player is inside a vehicle
		if (vehicleid != 0)
		{
			if (GetPlayerVehicleSeat(playerid) == 0)
			{
				if (engine == 0)
				{
					SetVehicleParamsEx(vehicleid, 1, lights, alarm, doors, bonnet, boot, objective);
				}
			}
		}
	}
and here is the #define for the arrow keys,defined in the a_samp.inc
Код:
#define KEY_UP					(-128)
#define KEY_DOWN				(128)
#define KEY_LEFT				(-128)
#define KEY_RIGHT				(128)
Oh,just to tell that KEY_ANALOG_UP also defines the Num 8 key.I dont know if its normal to have 2 defines for the same key,as it is in my case.
I'm not a scripter,so forgive me if I ask dumb questions.Any help would be appreciated.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)