19.08.2017, 15:44
Here is my /pm and /pmreply commad, i hope its usefully as well (Already tested on my server and all good)
Code:
CMD:pm(playerid, params[]) { new tmp[256], giveplayerid, giveplayer[25], playername[25],string[256]; if(adlvl[playerid] < 1 && supportmembers[playerid] == 0) return 0; GetPlayerName(giveplayerid, giveplayer, MAX_PLAYER_NAME); if (sscanf(params, "us[128]", giveplayerid, tmp)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /pm [playerid] [message]"); if (!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, COLOR_RED, "Error: Inactive player id!"); if (giveplayerid == playerid) return SendClientMessage(playerid, COLOR_RED, "Error: You can't send private message to your self!"); GetPlayerName(playerid, playername, MAX_PLAYER_NAME); GetPlayerName(giveplayerid, giveplayer, MAX_PLAYER_NAME); format(string, sizeof(string), "{E6E600}PM received from %s(%d): %s", playername, playerid, tmp); SendClientMessage(giveplayerid, COLOR_YELLOW, string); SendClientMessage(giveplayerid, COLOR_YELLOW, "You can use /pmreply [text] for fast reply."); format(string,sizeof(string), "{FFFF00}PM sent to %s(%d): %s", giveplayer, giveplayerid, tmp); SendClientMessage(playerid, COLOR_WHITE, string); PlayerPlaySound(giveplayerid, 1056, 0.0, 0.0, 0.0); SetPVarInt(giveplayerid, "GotPM", 1); SetPVarInt(giveplayerid, "PmId", playerid); return 1; } CMD:pmreply(playerid, params[]) { new id = GetPVarInt(playerid, "PmId"); new tmp[256], str[1080], name[MAX_PLAYER_NAME], pname[MAX_PLAYER_NAME]; if(GetPVarInt(playerid, "GotPM") == 0) return SendClientMessage(playerid, COLOR_RED, "Error: No one pmmed you to send an reply."); if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_RED, "The person that pmed you has CUTTOFF"); if(sscanf(params, "s", tmp)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /pmreply [message]"); GetPlayerName(id, pname, sizeof(pname)); GetPlayerName(playerid, name, sizeof(name)); format(str, sizeof(str), "{FFFF00}PM delivered to %s(%d): %s",pname, id, tmp); SendClientMessage(playerid, COLOR_YELLOW, str); format(str, sizeof(str), "{E6E600}PM received from %s(%d): %s", name, playerid, tmp); SendClientMessage(id, COLOR_YELLOW, str); PlayerPlaySound(id, 1056, 0.0, 0.0, 0.0); SetPVarInt(playerid, "GotPM", 0); SetPVarInt(playerid, "PmId", -1); return 1; }
