SA-MP Forums Archive
How to make a text command? - 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: How to make a text command? (/showthread.php?tid=173763)



How to make a text command? - Alphos - 03.09.2010

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.


Re: How to make a text command? - CyNiC - 03.09.2010

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


Re: How to make a text command? - Alphos - 03.09.2010

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?


Re: How to make a text command? - CyNiC - 03.09.2010

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.");      
        }



Re: How to make a text command? - Hiddos - 03.09.2010

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;
}



Re: How to make a text command? - Alphos - 03.09.2010

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


Re: How to make a text command? - LarzI - 03.09.2010

Place it in OnPlayerCommandText