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



newkey - TuTh - 28.03.2013

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


Re: newkey - Pottus - 28.03.2013

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.


Re: newkey - TomatoRage - 28.03.2013

You cannot use the key m You can usr these keys


Re: newkey - Pawnie - 28.03.2013

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;




Re: newkey - TomatoRage - 28.03.2013

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