How to make Admin Chat - 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)
+--- Thread: How to make Admin Chat (
/showthread.php?tid=516042)
How to make Admin Chat -
xFirex - 29.05.2014
How to make Admin Chat With '# chat'
variable -
PHP код:
PlayerInfo[playerid][pAdmin]
help
Re: How to make Admin Chat -
R0 - 29.05.2014
easy,use this:
pawn Код:
public OnPlayerText(playerid, text[])
{
if(PlayerInfo[playerid][pAdmin] > 0 && text[0] == '#')
{
new message[128], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
format(message, sizeof(message), "Admin Chat: %s: %s", pName, text[1]);
for(new i = 0, i < MAX_PLAYERS, i++)
{
if(PlayerInfo[playerid][pAdmin] > 0 && IsPlayerConnected(i))
{
SendClientMessage(i, -1, text);
}
}
}
return 1;
}
Re: How to make Admin Chat -
Threshold - 29.05.2014
pawn Код:
public OnPlayerText(playerid, text[])
{
if(text[0] == '#' && PlayerInfo[playerid][pAdmin])
{
new str[128], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(str, sizeof(str), "(ADMIN CHAT) %s: {FFFFFF}%s", name, text[1]);
//If you have a SendAdminMessage or something, use it here instead of the loop
for(new i = 0; i < MAX_PLAYERS; i++) //foreach is better :)
{
if(!IsPlayerConnected(i)) continue;
if(!PlayerInfo[playerid][pAdmin]) continue;
SendClientMessage(i, -1, str); //'-1' is the color, change that to whatever you want your admin chat to be
}
return 0;
}
return 1;
}
Re: How to make Admin Chat -
Rittik - 29.05.2014
I don't know about '# chat'
but yes you can make like this too
Код:
CMD:achat(playerid,params[])
{
if(IsPlayerAdmin(playerid))
{
new str[144];
if(sscanf(params,"s[144]",str))
{
SendClientMessage(playerid,-1,"/achat [text]");
return 1;
}
else
{
new str1[128];
new name[128];
GetPlayerName(playerid,name,sizeof(name));
format(str1,sizeof(str1),"*Admin %s:%s",name,str);
SendClientMessageToAll(-1,str1);
}
}
else
{
SendClientMessage(playerid,-1,"You are not an Admin");
return 1;
}
return1;
}
Re: How to make Admin Chat -
xFirex - 29.05.2014
thanks