SA-MP Forums Archive
Key bind - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Key bind (/showthread.php?tid=67184)



Key bind - Mrkrabz - 27.02.2009


How can i make a command which will be /engine so we can start the engine, in to a key like CTRL or something?

Here is the command:

pawn Код:
if(strcmp(cmd, "/engine", true) == 0)
    {
        if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
          if(EngineStatus[GetPlayerVehicleID(playerid)] == 0)
            {
                TogglePlayerControllable(playerid,1);
                EngineStatus[GetPlayerVehicleID(playerid)] = 1;
                if(PlayerInfo[playerid][pSex] == 1)
                {
                    PlayerActionMessage(playerid,15.0,"has just started the engine of his vehicle.");
                }
                else
                {
                    PlayerActionMessage(playerid,15.0,"has just started the engine of her vehicle.");
                }
            }
            else
            {
                TogglePlayerControllable(playerid,0);
                EngineStatus[GetPlayerVehicleID(playerid)] = 0;

                if(PlayerInfo[playerid][pSex] == 1)
                {
                    PlayerActionMessage(playerid,15.0,"has just stopped the engine of his vehicle.");
                }
                else
                {
                    PlayerActionMessage(playerid,15.0,"has just stopped the engine of her vehicle.");
                }
            }
        }
        else
        {
          SendClientMessage(playerid,COLOR_LIGHTYELLOW2,"[ERROR:] You are not even in a car!");
        }
        return 1;
    }



Re: Key bind - zyx - 27.02.2009

https://sampwiki.blast.hk/wiki/OnPlayerKeyStateChange
https://sampwiki.blast.hk/wiki/GetPlayerKeys


Re: Key bind - CracK - 27.02.2009

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
   if(newkeys == KEY_JUMP) OnPlayerCommandText(playerid,"/engine");
}
KEY_JUMP is ctrl usually if I am not mistaken.


Re: Key bind - MenaceX^ - 27.02.2009

I think you would be asking it in Carlito's Roleplay script.


Re: Key bind - CracK - 27.02.2009

That's why I said usually...