How to make a text command?
#1

Hi,

I'm trying to make a command in my cod5.pwn file, something like when you type /advertise, you see ''visit www.cod5gs.tk'' in a redlight color for example. And I want only admins to be able to do this. ADmin level 1 or higher. How to script this exactly? I heard it wasn't that hard to script something like that.
Reply
#2

Is easy, post the variables of admins here, and i help you.
Reply
#3

Something like this:

Код:
if(strcmp(cmd, "/advertise", true) == 0) // Publicly says an admin message. Exact same as RCON's 'say' but in a red color.
	{
	    if (adminlevel[playerid] >= 1)
    	{
			SendClientMessageToAll(LIGHTBLUE, "VISIT WWW.COD5GS.TK! - Don't forget to connect to our Teamspeak 3 server! IP: teamspeak3.i3d.net:10173");
		}
		else SendClientMessage(playerid, RED, "You cannot use this command, sorry.");
		return 1;
But my question is more: How to place this correctly so it will work? Like, where exactly in the .pwn file and how?
Reply
#4

pawn Код:
if(strcmp(cmd, "/advertise", true) == 0) // Publicly says an admin message. Exact same as RCON's 'say' but in a red color.
    {
        if (adminlevel[playerid] >= 1)
        {
            SendClientMessageToAll(LIGHTBLUE, "VISIT http://WWW.COD5GS.TK! - Don't forget to connect to our Teamspeak 3 server! IP: teamspeak3.i3d.net:10173");
                return 1;
        }
        else return SendClientMessage(playerid, RED, "You cannot use this command, sorry.");      
        }
Reply
#5

pawn Код:
if(!strcmp(cmd, "/advertise", true))
{
  if(adminlevel[playerid] == 0) return SendClientMessage(playerid, RED, "You aren't a level 1+ admin!");

  format(cmd, sizeof cmd, "%s", cmdtext[10]);
  SendClientMessageToAll(LIGHTBLUE, string);
  return 1;
}
Reply
#6

Yes, but how to place it in the script correctly?
Reply
#7

Place it in OnPlayerCommandText
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)