Admin chat with @ [text] Help
#1

So I found a tutorial how to chat with admins using @ [text]
And I tried to change so it would work with my admin system but not workig so help please?
Posting whole OnPlayerText

NOTE: this is on the admin system not the gamemode! // No errors or warnings!
Код:
public OnPlayerText(playerid, text[])
{
	if(P_Data[playerid][pMute] == 1) {
	SCM(playerid, COLOR_RED, "You are muted, noone can hear you!");
	return 0; }
	for(new words; words<sizeof(SwearWords); words++)
	{
	  if(strfind(text,SwearWords[words],true) != -1 ) { SCM(playerid, COLOR_RED,"You can not swear"); return 0;}
	}
	P_Data[playerid][pSpam] += 1;
	if(P_Data[playerid][pSpam] == 4) {
		new string[128];
		format(string, 128, "%s muted for flooding attempt.", GetName(playerid));
		SCMToAll(-1,string);
        P_Data[playerid][pMute] = 1;
        return 0;
	}
	else if(P_Data[playerid][pSpam] == 3) {
		SCM(playerid,COLOR_RED,"Stop with spam or you will be muted!");
		return 0;
	}
    if(P_Data[playerid][pAdmin] > 1 && text[0] == '#')
    {
         new msg[128];
         format(msg, sizeof(msg), "[ADMIN CHAT] %s: %s", GetName(playerid), text[1]);
    }
	return 1;
}

stock SendMessageToAdmins(text[])//ACHAT
{
    for(new i = 0, i < MAX_PLAYERS, i++)
    {
        if(P_Data[i][pAdmin] > 1)
        {
            SendClientMessage(i, -1, text);
        }
    }
}
The tutorial I found.

Thanks!
Reply
#2

You miss SendMessageToAdmins(msg); under format.. ah, this is with "# message" not "@ message"
Reply
#3

Код:
C:\Users\Andreas\Desktop\SA-MP Server NEW\filterscripts\Admin_System.pwn(1615) : error 021: symbol already defined: "i"
C:\Users\Andreas\Desktop\SA-MP Server NEW\filterscripts\Admin_System.pwn(1615) : warning 204: symbol is assigned a value that is never used: "i"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#4

pawn Код:
//find
for(new i = 0, i < MAX_PLAYERS, i++)
//replace with
for(new i = 0; i < MAX_PLAYERS; i++)
Reply
#5

Thats working but it's also sending the message to all players
Reply
#6

for(new i = 0; i < MAX_PLAYERS; i++)

#Edit: All players? you want just admin no?

#EDIT2: if(P_Data[i][pAdmin] > 0) try this
Reply
#7

Dude it's working I added return 0; under
Код:
format(msg, sizeof(msg), "[ADMIN CHAT] %s: %s", GetName(playerid), text[1]);
SendMessageToAdmins(msg);
return 0;
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)