dcmd_pm(playerid,params[])
{
new string[128];
new ID;
new cmdreason[100];
if(sscanf(params, "us[100]", ID, cmdreason))
{
SendClientMessage(playerid,COLOR_ERROR,"USAGE: /pm (Player Name/ID) (Message)");
return 1;
}
if(IsMuted[playerid] == 1)
{
SendClientMessage(playerid,COLOR_ERROR,"You are Muted. You Cannot Use This Command");
return 1;
}
if(udb_Exists(PlayerName(playerid)) && !PLAYERLIST_authed[playerid])
{
SendClientMessage(playerid,COLOR_ERROR,"You must login before you can talk");
return 1;
}
if(!IsPlayerConnected(ID))
{
format(string, sizeof(string), "The Player ID (%d) is not connected to the server.",ID);
SendClientMessage(playerid,COLOR_ERROR,string);
return 1;
}
format(string, sizeof(string), "PM Sent to: %s (%d): %s",PlayerName(ID),ID,cmdreason);
SendClientMessage(playerid,COLOR_YELLOW,string);
format(string, sizeof(string), "PM From: %s (%d) %s",PlayerName(playerid),playerid,cmdreason);
SendClientMessage(ID,COLOR_YELLOW,string);
format(string, sizeof(string), "3[PM] From %s (%d) to %s (%d): %s",PlayerName(playerid),playerid,PlayerName(ID),ID,cmdreason); // [0] <jacob> hi
IRC_GroupSay(gGroupAdminID,IRC_ADMINCHANNEL,string);
SpamStrings[playerid] ++;
PlayerPlaySound(ID,1085,0.0,0.0,0.0);
return 1;
}
dcmd_r(playerid,params[]) return dcmd_pm(playerid, params);
Try This.
pawn Код:
|
dcmd_pm(playerid,params[])
{
new string[128];
new ID;
new cmdreason[100];
if(sscanf(params, "us[100]", ID, cmdreason))
{
SendClientMessage(playerid,COLOR_ERROR,"USAGE: /pm (Player Name/ID) (Message)");
return 1;
}
if(IsMuted[playerid] == 1)
{
SendClientMessage(playerid,COLOR_ERROR,"You are Muted. You Cannot Use This Command");
return 1;
}
if(udb_Exists(PlayerName(playerid)) && !PLAYERLIST_authed[playerid])
{
SendClientMessage(playerid,COLOR_ERROR,"You must login before you can talk");
return 1;
}
if(!IsPlayerConnected(ID))
{
format(string, sizeof(string), "The Player ID (%d) is not connected to the server.",ID);
SendClientMessage(playerid,COLOR_ERROR,string);
return 1;
}
format(string, sizeof(string), "PM Sent to: %s (%d): %s",PlayerName(ID),ID,cmdreason);
SendClientMessage(playerid,COLOR_YELLOW,string);
format(string, sizeof(string), "PM From: %s (%d) %s",PlayerName(playerid),playerid,cmdreason);
SendClientMessage(ID,COLOR_YELLOW,string);
format(string, sizeof(string), "3[PM] From %s (%d) to %s (%d): %s",PlayerName(playerid),playerid,PlayerName(ID),ID,cmdreason); // [0] <jacob> hi
IRC_GroupSay(gGroupAdminID,IRC_ADMINCHANNEL,string);
SpamStrings[playerid] ++;
PlayerPlaySound(ID,1085,0.0,0.0,0.0);
return 1;
}
dcmd_r(playerid,params[]) return dcmd_pm(playerid, params);
// top
new LastSender[MAX_PLAYERS]; // a player global var to store the id of the last pm sender
// Under OnPlayerConnect, when they connect set it to -1 which means they didn't receiver any messages
LastSender[playerid] = -1;
// then put this into your pm command
LastSender[ID] = playerid; // means the last one who sent a pm to "ID" is "playerid"
// So now you can make a reply command .. /reply [message] and use the LastSender var to know
// who was the last player who sent this player a pm.
dcmd_reply(playerid, params[])
{
new ID = LastSender[playerid];
// also you can check if the var equals to -1 then return an error message.
if(ID == -1) return SendClientMessage(playerid, -1, "You didn't receiver any pms!");
/*
Your command stuff
*/
// And when your done formatting the message and everything send this message to ID
SendClientMessage(ID, -1, TheFormattedMessage);
return 1;
}
new ReplyId[MAX_PLAYERS];
ReplyId[playerid] = INVALID_PLAYER_ID;
//add this where you send pm.
ReplyId[targetid] = playerid;//id of the target.
dcmd_r(playerid,params[])
{
new targetid = ReplyId[playerid];
//All the PM stuff and after you send the PM.
ReplyId[targetid] = playerid;
}
C:\Users\sofie's\Desktop\CCNRRPG\gamemodes\SFCRRPG.pwn(4175) : error 017: undefined symbol "TheFormattedMessage"
C:\Users\sofie's\Desktop\CCNRRPG\gamemodes\SFCRRPG.pwn(4166) : warning 203: symbol is never used: "params"
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
1 Error.
dcmd_r(playerid, params[])
{
new ID = LastSender[playerid];
// also you can check if the var equals to -1 then return an error message.
if(ID == -1) return SendClientMessage(playerid, -1, "You didn't receiver any pms!");
/*
Your command stuff
*/
// And when your done formatting the message and everything send this message to ID
SendClientMessage(ID, -1, TheFormattedMessage);
return 1;
}