PM Command for ZCMD
#8

Quote:
Originally Posted by Joe Torran C
Do you think you could add a thing stopping the player from sending a PM to himself
pawn Code:
COMMAND:pm(playerid, params[])
{
    new string[128], name[MAX_PLAYER_NAME], tmp[128], index;
    tmp = strtok(params, index);
    new otherid = strval(tmp);
   
    if (strlen(tmp) && strlen(params[2]))
    {
      if (IsPlayerConnected(otherid))
      {
          if (playerid != otherid)
          {
              // Message to "otherid"
              GetPlayerName(playerid, name, sizeof(name));
              format(string, sizeof(string), "PM from %s: %s", name, params[2]);
              SendClientMessage(otherid, YELLOW, string);
       
              //Message to sender
              GetPlayerName(otherid, name, sizeof(name));
              format(string, sizeof(string), "PM to %s: %s", name, params[2]);
              SendClientMessage(playerid, WHITE, string);
          }
          else
          {
              SendClientMessage(playerid, RED, "You cannot sent a PM to yourself.");
          }
      }
      else
      {
        SendClientMessage(playerid, WHITE, "Invalid player id.");
      }
    }
    else
    {
      SendClientMessage(playerid, WHITE, "USAGE: /pm [playerid] [message]");
    }
    return 1;
}
Should work.
Reply


Messages In This Thread
PM Command for ZCMD - by Torran - 09.03.2010, 22:45
Re: PM Command for ZCMD - by [SF]RobMob - 09.03.2010, 23:19
Re: PM Command for ZCMD - by Anwix - 10.03.2010, 00:05
Re: PM Command for ZCMD - by cessil - 10.03.2010, 01:38
Re: PM Command for ZCMD - by Torran - 10.03.2010, 10:02
Re: PM Command for ZCMD - by [SF]RobMob - 10.03.2010, 12:49
Re: PM Command for ZCMD - by Torran - 10.03.2010, 12:53
Re: PM Command for ZCMD - by Anwix - 10.03.2010, 14:19

Forum Jump:


Users browsing this thread: 1 Guest(s)