Please help me with this tiny bit of admin script? - 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: Please help me with this tiny bit of admin script? (
/showthread.php?tid=90384)
Please help me with this tiny bit of admin script? -
ThePS3Guy - 07.08.2009
Hi, I have a common admin command that does this: you type /say and it sends a message to everyone, but it looks like its written from someone named "admin" (lol dont know how to describe it better hopefully you understand). Here it is:
http://samp.pastebin.com/m7cfd6cd6
But I would like to know this: say my username is Username and I'm an admin, how do I make it do that when i do /say [message], it sends a message to all from Admin Username, instead of just Admin.
Re: Please help me with this tiny bit of admin script? -
coole210 - 08.08.2009
pawn Код:
if(strcmp(cmd, "/say", true) == 0) // Publicly says an admin message. Exact same as RCON's 'say' but in a red color.
{
if (AccountInfo[playerid][AdminLevel] >= 3 || IsPlayerAdmin(playerid))
{
GetPlayerName(playerid, sendername, sizeof(sendername));
new result[128];
result = bigstrtok(cmdtext, idx);
if(!strlen(result))
{
SendClientMessage(playerid, ORANGE, "USAGE: /say [message]");
SendClientMessage(playerid, ORANGE, "FUNCTION: Will broadcast an admin message.");
return 1;
}
new AdminName[MAX_PLAYER_NAME];
GetPlayerName(playerid,AdminName,sizeof(AdminName));
format(string, sizeof(string), "* Admin %s: %s", AdminName,result);
SendClientMessageToAll(LIGHTRED, string);
printf("%s", string);
}
else SendClientMessage(playerid, RED, "You are not an admin with the required level.");
return 1;
}
Re: Please help me with this tiny bit of admin script? -
ThePS3Guy - 08.08.2009
Thanks coole210. I am new to scripting so I dont know much. But when I compile that I get two "loose indentation" errors. I tried moving over the "new AdminName[MAX_PLAYER_NAME];" and "GetPlayerName(playerid,AdminName,sizeof(AdminName ));" lines because they look out of line..
it looks pretty simple, what you changed in the script. im guessing that "new adminname[MAX_PLAYER_NAME];" basically makes it so that when you write AdminName in the script, it replaces that with the admins name. (trying to learn as i go along)
thanks for the help