/pm command help
#1

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

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.
Reply
#3

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;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)