Admin chat with @ [text] Help -
mrsamp - 31.07.2012
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!
Re: Admin chat with @ [text] Help -
ReVo_ - 31.07.2012
You miss SendMessageToAdmins(msg); under format.. ah, this is with "# message" not "@ message"
Re: Admin chat with @ [text] Help -
mrsamp - 31.07.2012
Код:
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.
Re: Admin chat with @ [text] Help -
Misiur - 31.07.2012
pawn Код:
//find
for(new i = 0, i < MAX_PLAYERS, i++)
//replace with
for(new i = 0; i < MAX_PLAYERS; i++)
Re: Admin chat with @ [text] Help -
mrsamp - 31.07.2012
Thats working but it's also sending the message to all players
Re: Admin chat with @ [text] Help -
ReVo_ - 31.07.2012
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
Re: Admin chat with @ [text] Help -
mrsamp - 31.07.2012
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;