AdminChat bug?
#1

I am trying to find the bug, but I can't:

pawn Код:
if(!strcmp(cmdtext, "//", true, 2)) // Admin chat
    {
        if (UserInfo[playerid][AdminLevel] >= 1 || IsPlayerAdmin(playerid))
        {
          if(!strlen(cmdtext[2])) return SendClientMessage(playerid, PINK, "USAGE: // <text>");
            GetPlayerName(playerid, sendername, sizeof(sendername));
          format(string, sizeof(string), "Admin %s(%d): %s" ,sendername,playerid, cmdtext[2]);
            SendClientMessageToAdmins(LIGHTYELLOW, string, 1);
            return 1;
        }
        else return SendClientMessage(playerid, PINK, "You are not an admin!");
    }
If I go ingame, and I type //test
it says: 'Admin name(id): //test' - instead of 'Admin name(id): test' - what is the problem?
Reply
#2

better use OnPlayerText :

Код:
public OnPlayerText(playerid, text[])
{
		new string[128];
 		if (text[0] == '//')
  	     {
         if (UserInfo[playerid][AdminLevel] >= 1 || IsPlayerAdmin(playerid))
	     {
		new name[24];
		GetPlayerName(playerid, name, 24);
		format(string, sizeof(string), "Admin %s(%d): %s" ,name,playerid, text[1]);
		SendClientMessageToAdmins(LIGHTYELLOW, string, 1);
		return 0;
	     }
         } 
		return 1;
	}
Reply
#3

Quote:
Originally Posted by MrDeGekkerd
I am trying to find the bug, but I can't:

pawn Код:
if(!strcmp(cmdtext, "//", true, 2)) // Admin chat
    {
        if (UserInfo[playerid][AdminLevel] >= 1 || IsPlayerAdmin(playerid))
        {
          if(!strlen(cmdtext[2])) return SendClientMessage(playerid, PINK, "USAGE: // <text>");
            GetPlayerName(playerid, sendername, sizeof(sendername));
          format(string, sizeof(string), "Admin %s(%d): %s" ,sendername,playerid, cmdtext[2]);
            SendClientMessageToAdmins(LIGHTYELLOW, string, 1);
            return 1;
        }
        else return SendClientMessage(playerid, PINK, "You are not an admin!");
    }
If I go ingame, and I type //test
it says: 'Admin name(id): //test' - instead of 'Admin name(id): test' - what is the problem?
Working normal on my serwer
Reply
#4

pawn Код:
if (text[0] == '//')
I get:

Quote:
Originally Posted by Pawno
(813) : error 027: invalid character constant
Reply
#5

weird , it compiles fine with me
Reply
#6

Look:

if (text[0] == '//')

It's // disables line.
Reply
#7

Quote:
Originally Posted by Picharelo
Look:

if (text[0] == '//')

It's // disables line.
How you mean it disables the line?
Reply
#8

// will comment that line
Reply
#9

Quote:
Originally Posted by Kurence
// will comment that line
I get the point, so I should change // to for example /@
Reply
#10

Quote:
Originally Posted by Kurence
// will comment that line
Not if it's within " " or ' '
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)