How to create a /forcerules command?
#4

Yeah, that was what I wanted, the code would be;

pawn Код:
CMD:forcerules(playerid,params[])
{
new targetID,string[128],pName[MAX_PLAYER_NAME],tName[MAX_PLAYER_NAME];
if(User[playerid][accountAdmin] == 0) return SendClientMessage(playerid,-1,"You are not authorized enough.");
if(sscanf(params,"i",targetID)) return SendClientMessage(playerid,-1,"[USAGE]: /forcerules [player ID]");
if(!IsPlayerConnected(targetID)) return SendClientMessage(playerid,-1,"You have specified an incorrect ID.");
else
{
GetPlayerName(playerid,pName,sizeof(pName));
GetPlayerName(targetID,tName,sizeof(tName));
format(string,sizeof(string),"%s has forced you to view the /rules!",pName);
SendClientMessage(targetID,-1,string);
format(string,sizeof(string),"%s has forced %s to view the rules!",pName,tName);
AdminMessage(-1,string);
// Put your /rules messages/dialogs here.

}
return 1;
}
and at the end of your script, place this;

pawn Код:
forward AdminMessage(color, string[]);
public AdminMessage(color,string[])
{
    for(new i=0; i < MAX_PLAYERS; i++)
    {
             if(IsPlayerConnected(i))
             {
        if(User[i][accountAdmin] >= 1)
        {
            SendClientMessage(i, color, string);
        }
             }
    }
    return 1;
}
No problem, this should work.

Edit: Eh, sorry about the indentation mistakes as it is hard to write a script at forums.
Reply


Messages In This Thread
nvm - by Alsarty - 06.01.2015, 22:36
Re: How to create a /forcerules command? - by Rufio - 06.01.2015, 22:38
Re: How to create a /forcerules command? - by Alsarty - 06.01.2015, 22:43
Re: How to create a /forcerules command? - by Rufio - 06.01.2015, 22:50
Re: How to create a /forcerules command? - by Alsarty - 06.01.2015, 22:54
Re: How to create a /forcerules command? - by Rufio - 06.01.2015, 22:56
Re: How to create a /forcerules command? - by Alsarty - 06.01.2015, 22:57
Re: How to create a /forcerules command? - by Rufio - 06.01.2015, 22:59
Re: How to create a /forcerules command? - by Dignity - 06.01.2015, 23:23
Re: How to create a /forcerules command? - by Alsarty - 06.01.2015, 23:34

Forum Jump:


Users browsing this thread: 1 Guest(s)