Key bind
#1


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;
    }
Reply
#2

https://sampwiki.blast.hk/wiki/OnPlayerKeyStateChange
https://sampwiki.blast.hk/wiki/GetPlayerKeys
Reply
#3

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

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

That's why I said usually...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)