/commands cmd
#1

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!
Reply
#2

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");
Reply
#3

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

Reply
#4

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...
Reply
#5

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

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.
Reply
#7

oh, ok solved. thank you all!
Reply
#8

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.
Reply
#9

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

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.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)