15.03.2015, 17:39
Hey guys. I want make a command about /ignore (playerid) for my pm system. Is it possible? If it is possible, How can I make this?
new bool:ignore[MAX_PLAYERS][MAX_PLAYERS];
for(new i=0; i< MAX_PLAYERS; i++) ignore[playerid][i] = false;
|
Make a boolean:
Код:
new bool:ignore[MAX_PLAYERS][MAX_PLAYERS]; Код:
for(new i=0; i< MAX_PLAYERS; i++) ignore[playerid][i] = false; |
dcmd_pm(playerid, params[])
{
new pID, text[128], string[128];
if(sscanf(params, "us", pID, text)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /pm (nick/id) (message) - Enter a valid Nick / ID");
if(!IsPlayerConnected(pID)) return SendClientMessage(playerid, COLOR_RED, "Player is not connected.");
if(pID == playerid) return SendClientMessage(playerid, COLOR_RED, "You cannot PM yourself.");
format(string, sizeof(string), "%s (%d) is not accepting private messages at the moment.", PlayerName(pID), pID);
if(pInfo[pID][NoPM] == 1) return SendClientMessage(playerid, COLOR_RED, string);
format(string, sizeof(string), "PM to %s: %s", PlayerName(pID), text);
SendClientMessage(playerid, COLOR_YELLOW, string);
format(string, sizeof(string), "PM from %s: %s", PlayerName(playerid), text);
SendClientMessage(pID, COLOR_YELLOW, string);
pInfo[pID][Last] = playerid;
return 1;
}
dcmd_pm(playerid, params[])
{
new pID, text[128], string[128];
if(sscanf(params, "us", pID, text)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /pm (nick/id) (message) - Enter a valid Nick / ID");
if(!IsPlayerConnected(pID)) return SendClientMessage(playerid, COLOR_RED, "Player is not connected.");
if(pID == playerid) return SendClientMessage(playerid, COLOR_RED, "You cannot PM yourself.");
format(string, sizeof(string), "%s (%d) is not accepting private messages at the moment.", PlayerName(pID), pID);
if(pInfo[pID][NoPM] == 1) return SendClientMessage(playerid, COLOR_RED, string);
// here
if(ignore[pID][playerid] == true) return SendClientMessage(playerid, COLOR_RED, "That player rejects your /pm");
format(string, sizeof(string), "PM to %s: %s", PlayerName(pID), text);
SendClientMessage(playerid, COLOR_YELLOW, string);
format(string, sizeof(string), "PM from %s: %s", PlayerName(playerid), text);
SendClientMessage(pID, COLOR_YELLOW, string);
pInfo[pID][Last] = playerid;
return 1;
}
|
Код:
dcmd_pm(playerid, params[])
{
new pID, text[128], string[128];
if(sscanf(params, "us", pID, text)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /pm (nick/id) (message) - Enter a valid Nick / ID");
if(!IsPlayerConnected(pID)) return SendClientMessage(playerid, COLOR_RED, "Player is not connected.");
if(pID == playerid) return SendClientMessage(playerid, COLOR_RED, "You cannot PM yourself.");
format(string, sizeof(string), "%s (%d) is not accepting private messages at the moment.", PlayerName(pID), pID);
if(pInfo[pID][NoPM] == 1) return SendClientMessage(playerid, COLOR_RED, string);
// here
if(ignore[pID][playerid] == true) return SendClientMessage(playerid, COLOR_RED, "That player rejects your /pm");
format(string, sizeof(string), "PM to %s: %s", PlayerName(pID), text);
SendClientMessage(playerid, COLOR_YELLOW, string);
format(string, sizeof(string), "PM from %s: %s", PlayerName(playerid), text);
SendClientMessage(pID, COLOR_YELLOW, string);
pInfo[pID][Last] = playerid;
return 1;
}
|
dcmd_ignore(playerid, params[])
{
#pragma unused params
if(pInfo[playerid][NoPM] == 0)
{
pInfo[playerid][NoPM] = 1;
SendClientMessage(playerid, COLOR_YELLOW, "You are no longer accepting private messages.");
}
else
{
pInfo[playerid][NoPM] = 0;
SendClientMessage(playerid, COLOR_YELLOW, "You are now accepting private messages.");
}
}
dcmd_ignoreid(playerid, params[])
{
if(sscanf(params, "u", params[0])) return SendClientMessage(playerid, COLOR_RED, "USAGE: /ignoreid [id] - Enter a valid id");
new string[128], sender = strval(params);
if(ignore[playerid][sender] == true)
{
ignore[playerid][sender] == false;
format(string,sizeof(string),"YOU ACCEPT {FFFFFF}private messages from id %d",sender);
SendClientMessage(playerid, COLOR_GREEN, string);
}
else
{
ignore[playerid][sender] == true;
format(string,sizeof(string),"YOU REJECT {FFFFFF}private messages from id %d",sender);
SendClientMessage(playerid, COLOR_RED, string);
}
return 1;
}
#define COLOR_GREEN 0x00A000FF