newkey
#1

Hi, how i can use the key "M" for a engine sistem? i need the code from this key
Reply
#2

You can only use certain keys https://sampwiki.blast.hk/wiki/GetPlayerKeys

"M" will only work if the player has one of these keys bound to it.

Note - "2" "KEY_SUBMISSION" is probably a the best key for what you want to do.
Reply
#3

You cannot use the key m You can usr these keys
Reply
#4

Here is an example of how it should work

PHP код:
new engine[MAX_VEHICLES];  //top of script
public OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
    new 
vehicleid;
    
vehicleid GetPlayerVehicleID(playerid);
    if(
PRESSED(KEY_YES))
    {
        if(
GetPlayerState(playerid) == 2) return SendClientMessage(playerid, -1"You are not driving a vehicle.");
        {
            if(
vehicleid == 509 || vehicleid == 481 || vehicleid == 510) return SendClientMessage(playerid, -1"Bycycle have no engine");
            {
                if(
engine[vehicleid] == 0)
                {
                    new 
Enginelightsalarmdoorsbonnetbootobjective;
                    
GetVehicleParamsEx(vehicleidEnginelightsalarmdoorsbonnetbootobjective);
                    
SetVehicleParamsEx(vehicleid1lightsalarmdoorsbonnetbootobjective);
                    
engine[vehicleid] = 1;
                    
SendClientMessage(playerid, -1"You have turn on this vehicle Engine!");
                    }
                    else
                    {
                    new 
Enginelightsalarmdoorsbonnetbootobjective;
                    
GetVehicleParamsEx(vehicleidEnginelightsalarmdoorsbonnetbootobjective);
                    
SetVehicleParamsEx(vehicleid0lightsalarmdoorsbonnetbootobjective);
                    
engine[vehicleid] = 0;
                    
SendClientMessage(playerid, -1"You have turn off this vehicle Engine!");
                }
            }
        }
    }
    return 
1;

Reply
#5

Quote:
Originally Posted by Pawnie
Посмотреть сообщение
Here is an example of how it should work

PHP код:
new engine[MAX_VEHICLES];  //top of script
public OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
    new 
vehicleid;
    
vehicleid GetPlayerVehicleID(playerid);
    if(
PRESSED(KEY_YES))
    {
        if(
GetPlayerState(playerid) == 2) return SendClientMessage(playerid, -1"You are not driving a vehicle.");
        {
            if(
vehicleid == 509 || vehicleid == 481 || vehicleid == 510) return SendClientMessage(playerid, -1"Bycycle have no engine");
            {
                if(
engine[vehicleid] == 0)
                {
                    new 
Enginelightsalarmdoorsbonnetbootobjective;
                    
GetVehicleParamsEx(vehicleidEnginelightsalarmdoorsbonnetbootobjective);
                    
SetVehicleParamsEx(vehicleid1lightsalarmdoorsbonnetbootobjective);
                    
engine[vehicleid] = 1;
                    
SendClientMessage(playerid, -1"You have turn on this vehicle Engine!");
                    }
                    else
                    {
                    new 
Enginelightsalarmdoorsbonnetbootobjective;
                    
GetVehicleParamsEx(vehicleidEnginelightsalarmdoorsbonnetbootobjective);
                    
SetVehicleParamsEx(vehicleid0lightsalarmdoorsbonnetbootobjective);
                    
engine[vehicleid] = 0;
                    
SendClientMessage(playerid, -1"You have turn off this vehicle Engine!");
                }
            }
        }
    }
    return 
1;

This is y key
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)