/togpm for donater!
#1

Код:
	if(strcmp(cmd, "/togpm", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
   {
		if(PlayerInfo[targetid][pDonateRank] == 2)
{
  if (!HidePM[playerid])
			{
				HidePM[playerid] = 1;
				SendClientMessage(playerid, COLOR_GRAD2, "  Private messages has been Disabled !");
			}
			else if (HidePM[playerid])
			{
				HidePM[playerid] = 0;
				SendClientMessage(playerid, COLOR_GRAD2, "  Private messages has been Enabled !");
			}
		}
		return 1;
	}
Hello. i would like to toggle /togpm for donaters only And i would like to hear what exactly i am doing wrong.
Reply
#2

How does your /pm look like?
I mean you got to change your /pm to suit your toggle pm
Reply
#3

It is for donates already.
pawn Код:
if(PlayerInfo[targetid][pDonateRank] == 2)
Reply
#4

Код:
	if(strcmp(cmd, "/pme", true) == 0 || strcmp(cmd, "/p", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
	    if(gPlayerLogged[playerid] == 0)
	    {
	      SendClientMessage(playerid, COLOR_GREY, "  You havent logged in yet!");
	      return 1;
	    }
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/p)me [playerid/PartOfName] [text]");
				return 1;
			}
			giveplayerid = ReturnUser(tmp);
			if (IsPlayerConnected(giveplayerid))
			{
			  if(giveplayerid != INVALID_PLAYER_ID)
			  {
			    if(HidePM[giveplayerid] > 0)
			    {
			      SendClientMessage(playerid, COLOR_GREY, "  That player is blocking messages!");
			      return 1;
			    }
					GetPlayerName(playerid, sendername, sizeof(sendername));
					GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
					if(giveplayerid == playerid)
					{
						format(string, sizeof(string), "* %s mutters something to himself.", sendername);
						ProxDetector(5.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
					}
					new length = strlen(cmdtext);
					while ((idx < length) && (cmdtext[idx] <= ' '))
					{
						idx++;
					}
					new offset = idx;
					new result[64];
					while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
					{
						result[idx - offset] = cmdtext[idx];
						idx++;
					}
					result[idx - offset] = EOS;
					if(!strlen(result))
					{
						SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/p)me [playerid/PartOfName] [text]");
						return 1;
					}
					format(string, sizeof(string), "[ID:%d] %s pm: %s", playerid, sendername, (result));
					SendClientMessage(giveplayerid, 0xBBA033AA, string);
					format(string, sizeof(string), "PM sent to [ID:%d]%s: %s", giveplayerid, giveplayer, (result));
					SendClientMessage(playerid, 0xE5C43EAA, string);
					return 1;
				}
			}
			else
			{
					format(string, sizeof(string), "  %d is not an active player.", giveplayerid);
					SendClientMessage(playerid, COLOR_GRAD1, string);
			}
		}
		return 1;
	}
Reply
#5

Quote:
Originally Posted by MenaceX^
It is for donates already.
pawn Код:
if(PlayerInfo[targetid][pDonateRank] == 2)
I did that myself. but its fucking up with alot of implemented errors.
Reply
#6

pawn Код:
if(strcmp(cmd, "/togpm", true) == 0)
{
    if(IsPlayerConnected(playerid))
    {
        if(PlayerInfo[playerid][pDonateRank] == 2)
        {
            if (!HidePM[playerid])
            {
                HidePM[playerid] = 1;
                SendClientMessage(playerid, COLOR_GRAD2, "  Private messages has been Disabled !");
            }
            else if (HidePM[playerid])
            {
                HidePM[playerid] = 0;
                SendClientMessage(playerid, COLOR_GRAD2, "  Private messages has been Enabled !");
            }
        }
    }
    return 1;
}
Because is targetid and it should be playerid.
pawn Код:
if(PlayerInfo[playerid][pDonateRank] == 2)
Reply
#7

Quote:
Originally Posted by guaid
Код:
	if(strcmp(cmd, "/pme", true) == 0 || strcmp(cmd, "/p", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
	    if(gPlayerLogged[playerid] == 0)
	    {
	      SendClientMessage(playerid, COLOR_GREY, " You havent logged in yet!");
	      return 1;
	    }
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/p)me [playerid/PartOfName] [text]");
				return 1;
			}
			giveplayerid = ReturnUser(tmp);
			if (IsPlayerConnected(giveplayerid))
			{
			  if(giveplayerid != INVALID_PLAYER_ID)
			  {
			    if(HidePM[giveplayerid] > 0)
			    {
			      SendClientMessage(playerid, COLOR_GREY, " That player is blocking messages!");
			      return 1;
			    }
					GetPlayerName(playerid, sendername, sizeof(sendername));
					GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
					if(giveplayerid == playerid)
					{
						format(string, sizeof(string), "* %s mutters something to himself.", sendername);
						ProxDetector(5.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
					}
					new length = strlen(cmdtext);
					while ((idx < length) && (cmdtext[idx] <= ' '))
					{
						idx++;
					}
					new offset = idx;
					new result[64];
					while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
					{
						result[idx - offset] = cmdtext[idx];
						idx++;
					}
					result[idx - offset] = EOS;
					if(!strlen(result))
					{
						SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/p)me [playerid/PartOfName] [text]");
						return 1;
					}
					format(string, sizeof(string), "[ID:%d] %s pm: %s", playerid, sendername, (result));
					SendClientMessage(giveplayerid, 0xBBA033AA, string);
					format(string, sizeof(string), "PM sent to [ID:%d]%s: %s", giveplayerid, giveplayer, (result));
					SendClientMessage(playerid, 0xE5C43EAA, string);
					return 1;
				}
			}
			else
			{
					format(string, sizeof(string), " %d is not an active player.", giveplayerid);
					SendClientMessage(playerid, COLOR_GRAD1, string);
			}
		}
		return 1;
	}
Quote:
Originally Posted by guaid
pawn Код:
if(strcmp(cmd, "/pme", true) == 0 || strcmp(cmd, "/p", true) == 0)
    {
      if(IsPlayerConnected(playerid))
      {
        if(gPlayerLogged[playerid] == 0)
        {
          SendClientMessage(playerid, COLOR_GREY, "  You havent logged in yet!");
          return 1;
        }
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/p)me [playerid/PartOfName] [text]");
                return 1;
            }
            giveplayerid = ReturnUser(tmp);
            if (IsPlayerConnected(giveplayerid))
            {
              if(giveplayerid != INVALID_PLAYER_ID)
              {
                if(HidePM[giveplayerid] > 0)
                {
                  SendClientMessage(playerid, COLOR_GREY, "  That player is blocking messages!");
                  return 1;
                }
                else //you send the message erven if hes blocking it so u need to add thise else so its if he hide then send this else(if not) send
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)