Help with reading commands - 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: Help with reading commands (
/showthread.php?tid=563899)
Help with reading commands -
Nabster - 18.02.2015
I am trying to get this to work,its from ladmin i want to know how it works so i am testing it on fresh script but it doesn't works,i want to know about the message thing,the messagetoadmins forward works but not cmd one
Код:
CMD:announce(playerid,params[])
{
if(PInfo[playerid][Level] < 4)
return SendClientMessage(playerid,STEALTH_BLUE,"You need to be level 4 to announce.");
new string[128],pText[64];
if(sscanf(params,"s[128]",pText))
return SendClientMessage(playerid,STEALTH_BLUE,"USAGE: /announce [text]");
format(string,sizeof(string),"%s",pText);
GameTextForAll(string,3000,3);
CMDMessageToAdmins(playerid,"ANNOUNCE");
return 1;
}
forward MessageToAdmins(color,const string[]);
public MessageToAdmins(color,const string[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) == 1) if (PInfo[i][Level] >= 1) SendClientMessage(i, color, string);
}
return 1;
}
stock CMDMessageToAdmins(playerid,command[])
{
if(ServerInfo[AdminCmdMsg] == 0) return 1;
new string[128]; GetPlayerName(playerid,string,sizeof(string));
format(string,sizeof(string),"[ADMIN] %s has used the command %s",string,command);
return MessageToAdmins(COLOR_INFOTEXT,string);
}
Re: Help with reading commands -
1fret - 18.02.2015
try this
pawn Код:
stock CMDMessageToAdmins(playerid,command[])
{
new string[200],name[30];
GetPlayerName(playerid,name,30);
format(string,200,"[Admin]: %s has used the command %s",name,command);
return MessageToAdmins(color,string); }
Re: Help with reading commands -
Nabster - 18.02.2015
Thanks mate,works like a charm.