CMD:pm(playerid, params[]) {
AddUsedCommand(playerid, "pm");
new string[128];
if(sscanf(params, "ds", player1, temp)) return SendUsageError(playerid, "/pm [playerid] [message]");
if(!IsPlayerConnected(player1)) return SendCommandError(playerid, 0); // player isnt connected
if(player1 == playerid) return SendErrorMessage(playerid, "You can't send msg to urself");
format(string, sizeof(string), ""_green"» "_yellow"%s [%d]"_green": "_white"%s", PlayerName(player1), player1, temp);
SendClientMessage(playerid, -1, string);
format(string, sizeof(string), ""_blue"« "_yellow"%s [%d]"_blue": "_white"%s", PlayerName(playerid), playerid, temp);
SendClientMessage(player1, -1, string);
PlayerPlaySound(player1, 1085, 0.0, 0.0, 0.0);
if(ServerInfo[ReadPMs] == 1) {
format(string, sizeof(string), ""_white"PM: "_yellow"%s to %s: "_white"%s", PlayerName(playerid), PlayerName(player1), temp);
MessageToAdmins(string);
format(string, sizeof(string), "%s to %s: %s", PlayerName(playerid), PlayerName(player1), temp);
SaveLog("PM", string);
}
return 1;
}
|
Why don't you use the "u" specifier? You can only type a playerid, you can't type a partial of the username using just the "d" specifier. You can use the "u" specifier in the stock version of sscanf too.
Also, where do you define "player1"? |