SA-MP Forums Archive
/commands cmd - 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: /commands cmd (/showthread.php?tid=586570)



/commands cmd - saffierr - 23.08.2015

I ******d it, and couldn't find any tutorial or something.
I really got no clue about how you make an /commands cmd, so all your commands will show up in the main chat...
Everything is welcome!


Re: /commands cmd - ghost556 - 23.08.2015

You just need to send the player messages with the commands in it.
Код:
SendClientMessage(playerid, COLOR, "|_____________|Server Commands|_____________|");
SendClientMessage(playerid, COLOR, "General: /commands /enter. etc");
SendClientMessage(playerid, COLOR, "More commands");



Re: /commands cmd - Luke_James - 23.08.2015

PHP код:
CMD:commands(playeridparams[])
{
    
SendClientMessage(playeridWHITE"/command1, /command2... etc");
    return 
1;




Re: /commands cmd - saffierr - 23.08.2015

Thanks guys, just 1 prob,
PHP код:
CMD:acmds(playeridparams[])
{
   if(
IsPlayerAdmin(playerid))
   {
   
SendClientMessage(playeridCOLOR_YELLOW"~ Admin Commands ~");
   
SendClientMessage(playeridCOLOR_WHITE"Guns: /Eagle  /Minigun  /RPG");
   
SendClientMessage(playeridCOLOR_AQUA"General: /Heal  /Armor  /Jetpack  /Getping  /Getip  /Ban  /Kick  /Kickme  /Givemoney  /Resetcash  /Getcash  /Setcolor  /Spawn  /Spawnall  /Godmode  /Godmodeoff  /Getammo");
   }
   else
   {
   
SendClientMessage(playerid, -1"SERVER: Unknown command.");
   }
   return 
1
In the server everything is correct except, it doesn't show the third SCM line... where actually all the acmds are stated in...


Re: /commands cmd - rymax99 - 23.08.2015

I'd recommend reading the following: https://sampwiki.blast.hk/wiki/PAWN_for_Begginers


Re: /commands cmd - Luke_James - 23.08.2015

Quote:
Originally Posted by saffierr
Посмотреть сообщение
Thanks guys, just 1 prob,
PHP код:
CMD:acmds(playeridparams[])
{
   if(
IsPlayerAdmin(playerid))
   {
   
SendClientMessage(playeridCOLOR_YELLOW"~ Admin Commands ~");
   
SendClientMessage(playeridCOLOR_WHITE"Guns: /Eagle  /Minigun  /RPG");
   
SendClientMessage(playeridCOLOR_AQUA"General: /Heal  /Armor  /Jetpack  /Getping  /Getip  /Ban  /Kick  /Kickme  /Givemoney  /Resetcash  /Getcash  /Setcolor  /Spawn  /Spawnall  /Godmode  /Godmodeoff  /Getammo");
   }
   else
   {
   
SendClientMessage(playerid, -1"SERVER: Unknown command.");
   }
   return 
1
In the server everything is correct except, it doesn't show the third SCM line... where actually all the acmds are stated in...
The line is far too long, break it down.


Re: /commands cmd - saffierr - 23.08.2015

oh, ok solved. thank you all!


Re: /commands cmd - Luke_James - 23.08.2015

This is a better way to do the command though, it looks nicer...

PHP код:
CMD:acmds(playeridparams[])
{
    if(!
IsPlayerAdmin(playerid))
        return 
SendClientMessage(playerid, -1"SERVER: Unknown command."); 
    
SendClientMessage(playeridCOLOR"Message");
    return 
1;

Remember to include the exclamation mark (!), that means IS NOT or DOES NOT, so it is saying "IF playerid IS NOT admin RETURN SendClientMessage..." else if a player is an admin it will send the commands.

It's a personal preference, both work equally as well.


Re: /commands cmd - Roberto80 - 23.08.2015

Just this
Код:
if(!IsPlayerAdmin(playerid)) return 0;
It will send unkown command if he isn't


Re: /commands cmd - Cookland - 23.08.2015

Quote:
Originally Posted by Roberto80
Посмотреть сообщение
Just this
Код:
if(!IsPlayerAdmin(playerid)) return 0;
It will send unkown command if he isn't
you basically copied the post above yours, lol.