OnPlayerKeyStateChange
#1

Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	if(newkeys == KEY_NO)
	{
		if (IsPlayerInAnyVehicle(playerid))
		{
			    new vehicleid = GetVehicleModel(vehicleid);
 				new engine, lights, alarm, doors, bonnet, boot, objective;
            	GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
				SetVehicleParamsEx(vehicleid, 1, lights, alarm, doors, bonnet, boot, objective);
		}
	}
	return 1;
}
Reply
#2

no work
Reply
#3

Why you ever want all ready..? Try to study sometimes.. facepalm
https://sampwiki.blast.hk/wiki/OnPlayerK...pressing_a_key
Reply
#4

pawn Код:
#define PRESSED(%0) \
    (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
   
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if (PRESSED(KEY_NO))
    {
        if (IsPlayerInAnyVehicle(playerid))
        {
            new vehicleid = GetPlayerVehicleID(vehicleid);
            new engine, lights, alarm, doors, bonnet, boot, objective;
            GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
            SetVehicleParamsEx(vehicleid, 1, lights, alarm, doors, bonnet, boot, objective);
        }
    }
    return 1;
}
Reply
#5


you get vehicle model !!
but you need to get vehciel id !

try this:

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys == KEY_NO)
    {
        if (IsPlayerInAnyVehicle(playerid))
        {
                new vehicleid = GetPlayerVehicleID(playerid); //~~~~>this line was your problem i changed "GetVehicleModel" with GetPlayerVehicleID
                new engine, lights, alarm, doors, bonnet, boot, objective;
                GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
                SetVehicleParamsEx(vehicleid, 1, lights, alarm, doors, bonnet, boot, objective);
        }
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)