PM to specific username.
#2

You could make such a command I think, although I really, really wouldn't recommend it.
Keep in mind you'll be creating commands to the amount of your player base (Which could be well over 800, but that is doubtful).

As result, it's way better to make a /pm command, that's only one thing to check for on user input. It just generally is way faster and less prone to duplicate commands (E.g., you have a command /test, a player with the name test joins, then you'll have two test commands, to avoid this, you should add return 1;, but generally, this is really not recommended).

Additionally, to achieve what you want to achieve. I think you would need something like this:
Note, I have not myself tested this code.
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  new name[MAX_PLAYER_NAME]; //Create a new name variable that temporarily holds every players' name.
  for (new i=0; i < MAX_PLAYERS; i++)  //initiate a loop to check all players
  {
    if (IsPlayerConnected(i)) //Is the player connected?
    {
       GetPlayerName(i, name, MAX_PLAYER_NAME); //Fetch the player name for comparison
       if (!strcmp(cmdtext, name, true)) SendClientMessage(i, -1, "Hello!"); //If the command matches the name, we send him a message "Hello!"
    }
  }
  return 1;
}
Reply


Messages In This Thread
PM to specific username. - by se7evolution - 04.04.2013, 20:12
Re: PM to specific username. - by Revo - 04.04.2013, 20:16
Re: PM to specific username. - by Vince - 04.04.2013, 20:23
Re: PM to specific username. - by Babul - 04.04.2013, 20:29
Re: PM to specific username. - by RiChArD_A - 04.04.2013, 20:38
Re: PM to specific username. - by Revo - 04.04.2013, 21:41

Forum Jump:


Users browsing this thread: 1 Guest(s)