SA-MP Forums Archive
/pm command help - 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: /pm command help (/showthread.php?tid=272392)



/pm command help - seanny - 28.07.2011

pawn Код:
dcmd_pm(playerid, params[])
{
    new target, msg[128], tmp[128], name[MAX_PLAYER_NAME];
    if(sscanf(params, "us[128]", target, msg)) return SendClientMessage(playerid, -1, "USAGE: /pm [id] [message]");
    if(!IsPlayerConnected(target)) return SendClientMessage(playerid, -1, "That player is offline!");
    GetPlayerName(playerid, name, sizeof(name)); //Might be sizeof(name) before the "name" cant look at wiki atm
    format(tmp, sizeof(tmp), "(( Private Message from %s: %s ))", name, msg);
    SendClientMessage(target, -1, tmp);
    return 1;
}
I Tested this command IG and it does not show the message that you write to you, but the other player sees your message, I want it to be where you see the player and also converted to ZCMD


Re: /pm command help - iPLEOMAX - 28.07.2011

Just an info: If you have the latest version of SAMP Server, the "u" parameter in sscanf won't work.
Please look at the sscanf2 topic.


Re: /pm command help - Kush - 28.07.2011

PHP код:
CMD:pm(playeridparams[])
{
    new 
PIDpName[MAX_PLAYER_NAME], Sender[MAX_PLAYER_NAME];
    if(
sscanf(params"us[128]"PIDparams)) return SendClientMessage(playeridCOLOR_GREY"USAGE: /pm [playerid] [message]");
    if(!
IsPlayerConnected(PID)) return SendClientMessage(playeridCOLOR_GREY"Player is not connected!");
    new 
Str[128];
    
GetPlayerRPName(PIDpNamesizeof(pName));
    
GetPlayerRPName(playeridSendersizeof(Sender));
    
format(Strsizeof(Str), "PM From %s (%d): %s"Senderplayeridparams);
    
SendClientMessage(PIDCOLOR_YELLOWStr);
    
SendClientMessage(playeridCOLOR_YELLOW"Your PM Message has been sent.");
    }
    return 
1;