SA-MP Forums Archive
AdminChat bug? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: AdminChat bug? (/showthread.php?tid=151974)



AdminChat bug? - MastahServers - 01.06.2010

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?


Re: AdminChat bug? - aircombat - 01.06.2010

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;
	}



Re: AdminChat bug? - Jefff - 01.06.2010

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


Re: AdminChat bug? - MastahServers - 02.06.2010

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

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



Re: AdminChat bug? - aircombat - 02.06.2010

weird , it compiles fine with me


Re: AdminChat bug? - Mechscape - 02.06.2010

Look:

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

It's // disables line.


Re: AdminChat bug? - MastahServers - 02.06.2010

Quote:
Originally Posted by Picharelo
Look:

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

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


Re: AdminChat bug? - Kurence - 02.06.2010

// will comment that line


Re: AdminChat bug? - MastahServers - 02.06.2010

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


Re: AdminChat bug? - Correlli - 02.06.2010

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