24.09.2013, 12:14
Hi,
So I am trying to add a "/nopm" command to my gamemode, where when the player enters "/nopm", they won't be able to receive PMs, and if someone tries to PM that person, they get a message saying that the player is not accepting PMS.
Problem is, when I type the command, it says - "You are no longer accepting PMs", but if I type it again, it just says that same thing over and over, and don't understand why.
So I am trying to add a "/nopm" command to my gamemode, where when the player enters "/nopm", they won't be able to receive PMs, and if someone tries to PM that person, they get a message saying that the player is not accepting PMS.
pawn Код:
// placed top of script
new NoPM[MAX_PLAYERS];
// In OnPlayerConnect
NoPM[playerid] == 0;
// placed along side other commands..
CMD:nopm(playerid, params[])
{
if(NoPM[playerid] == 1)
{
SendClientMessage(playerid, COLOR_WHITE, "You are now accepting PMs");
NoPM[playerid] == 0;
return 1;
}
else if(NoPM[playerid] == 0)
{
SendClientMessage(playerid, COLOR_WHITE, "You are no longer accepting PMs");
NoPM[playerid] == 1;
return 1;
}
}
// placed on bottom of script
public OnPlayerPrivmsg(playerid, recieverid, text[])
{
if(NoPM[recieverid] == 1)
{
SendClientMessage(playerid, COLOR_GREY, "This player has NO PM turned on, Try again later");
return 1;
}
return 0;
}