Some admin chat help please
#1

Hello!

I have searched alot now and tryed many things to get admin chat work..
I using DINI to store users in they user files i have something called "admin" and i have 5 levels.
I'm not sure how i make a admin chat with dini, i can make it off use gTeam, but not with dini..

Need some examples, thanks for your time.
Reply
#2

pawn Код:
for(/*all*/)
{
   if(Adminlevel[playerid] > 0)
   {
     new name[24];
     GetPlayerName(playerid, name, 24);
     format(string, sizeof(string)," %s: %s ",name,text);
     SendClientMessage(COLOR,string);
   }
}
Try it this way

Luxeon
Reply
#3

I tryed a thing here, it kinda work, but not work.. xD
on top off:
Код:
enum pInfo
{
	Admin
}

new PlayerInfo[MAX_PLAYERS][pInfo];
When player login:
Код:
    if(dini_Int(file, "admin") >1)
    {
      PlayerInfo[playerid][Admin] = 1;
    }
The command:
Код:
	if(strcmp(cmdtext, "/a", true, 2) == 0 )
	{
	  if(dini_Int(file, "admin") >1)
	  {
	  	for(new i = 0; i < MAX_PLAYERS; i ++)
			{
				if(PlayerInfo[i][Admin] == PlayerInfo[playerid][Admin])
				{
				  new pname2[256];
				  GetPlayerName(playerid, pname2, sizeof(pname2));
					new string[256];
					format(string, 256, "[ADMIN]%s: %s", pname, cmdtext[3]);
					SendClientMessage(i, COLOR_ORANGE, string);
				}
			}
	  }
	  else
		{
		  SendClientMessage(playerid, COLOR_YELLOW, "You are not admin!");
		}
		return 1;
	}
When I'm in with a friend and i use /a not my name comming but hes.. And i did me self sivilian but then it com on hes screen that he was not a admin. Help?
Reply
#4

GetPlayerName() after for()... eh?(thats hwy it takes his name) :P

Luxeon
Reply
#5

Quote:
Originally Posted by Luxeon
GetPlayerName() after for()... eh?(thats hwy it takes his name) :P

Luxeon
What do you mean? :S
Reply
#6

Quote:
Originally Posted by Danand
Quote:
Originally Posted by Luxeon
GetPlayerName() after for()... eh?(thats hwy it takes his name) :P

Luxeon
What do you mean? :S
Do you understand what code you posted here means ?(fully, not partly)
If yes, then think what for() is for, and what GetPlayerName() after it does.

Luxeon
Reply
#7

Quote:
Originally Posted by Luxeon
Quote:
Originally Posted by Danand
Quote:
Originally Posted by Luxeon
GetPlayerName() after for()... eh?(thats hwy it takes his name) :P

Luxeon
What do you mean? :S
Do you understand what code you posted here means ?(fully, not partly)
If yes, then think what for() is for, and what GetPlayerName() after it does.

Luxeon
Well, i have never seen the for() function before and cant find anything about it on wiki.
Reply
#8

Код:
if(strcmp(cmdtext, "/a", true) == 0)
	{
		if(dini_Int(file, "admin") <1) return SendClientMessage(playerid, COLOR, "You are not admin!");
		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)) return SendClientMessage(playerid, COLOR, "Usage: /a [ur txt here]");
		GetPlayerName(playerid, plyrname, sizeof(plyrname));
		format(string,sizeof(string),"[ADMIN]: %s (lvl:%d): %s", plyrname, PlayerInfo[playerid][Admin], result);
		for(new i=0;i<MAX_PLAYERS;i++)
		{
			if(dini_Int(file, "admin") >= 1)
			SendClientMessage(i,COLOR,string);
		}
		return 1;
	}
try that, it should work
and you can set only LeaD admin chat or something by changing 1 to 5 or max level you have, but if you have cmd spec then try hide that command......
Reply
#9

Okey, i tryed this code and added taked oway all the errors but when i type /a text i get command not found. But then i just type /a i get [ADMIN]Name[lvl thing]:/a ..
Here is the code without error:
pawn Код:
if(strcmp(cmdtext, "/a", true) == 0)
    {
      new idx;
        if(dini_Int(file, "admin") <1) return SendClientMessage(playerid, COLOR_YELLOW, "You are not admin!");
        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)) return SendClientMessage(playerid, COLOR_YELLOW, "Usage: /a [ur txt here]");
        new pname3[256];
        new string[256];
        GetPlayerName(playerid, pname3, sizeof(pname3));
        format(string,sizeof(string),"[ADMIN]: %s (lvl:%d): %s", pname3, PlayerInfo[playerid][Admin], result);
        for(new i=0;i<MAX_PLAYERS;i++)
        {
            if(dini_Int(file, "admin") >= 1)
            SendClientMessage(i,COLOR_ORANGE,string);
        }
        return 1;
    }
Reply
#10

bump
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)