[HELP] 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP] Admin Chat (
/showthread.php?tid=211832)
[HELP] Admin Chat - Larsey123IsMe - 16.01.2011
Lust look ater some mistakes :P it colpile fine but when i do "/am hello" then the player who sent the message dont get the message, but the other admin does, Hope you understand it xD
And, LoL, im tierd now, i should be in bed for like 5 hours ago :O!
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/am", cmdtext, true, 3) == 0)
{
new message[255];
strmid(message, cmdtext, 3, strlen(cmdtext));
new name[MAX_PLAYER_NAME], string[128];
GetPlayerName(playerid, name, sizeof(name));
for(new i; i < GetMaxPlayers(); i++)
{
if(IsPlayerAdmin(i))
{
format(string, sizeof(string), "ADMIN MESSAGE: %s(%d) %s",name, playerid, message);
SendClientMessage(i,0xFF0000FF,string);
return 1;
}
}
}
return 0;
}
Re: [HELP] Admin Chat -
Marricio - 16.01.2011
pawn Код:
if(strcmp(cmd, "/admin", true) == 0 || strcmp(cmd, "/a", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new sendername[28];
new string[128];
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[128];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_LIGHTRED, "USAGE: (/a)dmin [admin chat]");
return 1;
}
format(string,sizeof(string), "** Administrator %s: %s", sendername, result);
if (IsPlayerAdmin(playerid))
{
SendAdminMessage(COLOR_LIGHTBLUE, string);
}
}
return 1;
}
pawn Код:
stock SendAdminMessage(color,const string[])
{
foreach (Player, i) // if foreach is not used replace with regular loops
{
if(!IsPlayerConnected(i)) continue;
if(IsPlayerAdmin(i)) SendClientMessage(i, color, string);
}
}
Re: [HELP] Admin Chat - Larsey123IsMe - 16.01.2011
Other ideas please :P i dont want so long code :O
Re: [HELP] Admin Chat -
Joe Staff - 16.01.2011
pawn Код:
public OnPlayerCommandText(playerid,cmdtext[])
{
if(!strcmp(cmdtext,"/am",true,3))
{
if(!IsPlayerAdmin(playerid))return SendClientMessage(playerid,0xFF0000FF,"You must be an admin to utilize that command.");
new tmpstr[256];
GetPlayerName(playerid,tmpstr,24);
format(tmpstr,256,"ADMIN MESSSAGE: %s(%d): %s",tmpstr,playerid,cmdtext[5]);
for(new player;player<MAX_PLAYERS;player++)
{
if(!IsPlayerConnected(player))continue;
SendClientMessage(player,0xAAFFAA,tmpstr);
}
return 1;
}
return 0;
}
Re: [HELP] Admin Chat -
alpha500delta - 16.01.2011
It is needed LOL now its going to send admin chat to every person on the server
Re: [HELP] Admin Chat - Larsey123IsMe - 16.01.2011
Thx for help xD
Ill solved the problem by myself :P