How to add command to ...
#1

How i can add this command to OnplayerCommandText
Код:
if(strcmp(cmdtext,"/home",true)==0)
{
new vehicleid = GetPlayerVehicleID(playerid);
new State = GetPlayerState(playerid);
if(IsPlayerInAnyVehicle(playerid) && State == PLAYER_STATE_DRIVER)
{
GameTextForPlayer(playerid,"Welcome to home !",4000,6);
return SetVehiclePos(vehicleid,387.7016,2590.6699,16.4900,194.4789);
}
SetPlayerPos(playerid,387.7016,2590.6699,16.4900,194.4789);
GameTextForPlayer(playerid,"Welcome to home !",4000,6);
return 1;
}
my onplayyercommand text is :
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  if (strcmp("/cmds", cmdtext, true, 10) == 0)
  {
        SendClientMessage(playerid, 0xFFFFFFFF, "[TELES] /home ,");
  }
  if(strcmp("/help", cmdtext, true, 10) == 0)
  {
        SendClientMessage(playerid, 0xFFFFFFFF, "[HELP] USE /cmds FOR COMMANDS !");
  }
  return 0;
}
Reply
#2

Just add it below the last bracket of the "help" command:

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  if (strcmp("/cmds", cmdtext, true, 10) == 0)
  {
        SendClientMessage(playerid, 0xFFFFFFFF, "[TELES] /home ,");
  }
  if(strcmp("/help", cmdtext, true, 10) == 0)
  {
        SendClientMessage(playerid, 0xFFFFFFFF, "[HELP] USE /cmds FOR COMMANDS !");
  }
  if(strcmp(cmdtext,"/home",true)==0)
  {
        new vehicleid = GetPlayerVehicleID(playerid);
        new State = GetPlayerState(playerid);
        if(IsPlayerInAnyVehicle(playerid) && State == PLAYER_STATE_DRIVER)
        {
                GameTextForPlayer(playerid,"Welcome to home !",4000,6);
                return SetVehiclePos(vehicleid,387.7016,2590.6699,16.4900,194.4789);
        }
        SetPlayerPos(playerid,387.7016,2590.6699,16.4900,194.4789);
    GameTextForPlayer(playerid,"Welcome to home !",4000,6);
    return 1;
  }
  return 0;
}
Reply
#3

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/cmds", cmdtext, true, 10) == 0)
    {
        SendClientMessage(playerid, 0xFFFFFFFF, "[TELES] /home ,");
    }
    if(strcmp("/help", cmdtext, true, 10) == 0)
    {
        SendClientMessage(playerid, 0xFFFFFFFF, "[HELP] USE /cmds FOR COMMANDS !");
    }

    if(strcmp(cmdtext,"/home",true)==0)
    {
        new vehicleid = GetPlayerVehicleID(playerid);
        new State = GetPlayerState(playerid);
        if(IsPlayerInAnyVehicle(playerid) && State == PLAYER_STATE_DRIVER)
        {
            GameTextForPlayer(playerid,"Welcome to home !",4000,6);
            return SetVehiclePos(vehicleid,387.7016,2590.6699,16.4900,194.4789);
        }
        SetPlayerPos(playerid,387.7016,2590.6699,16.4900,194.4789);
        GameTextForPlayer(playerid,"Welcome to home !",4000,6);
    return 1;
    }
  return 0;
}
You just add it to your OnPlayerCommandText callback

Edit: Kwarde was faster
Reply
#4

Thanks for that ! I love you all !
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)