[Tutorial] Making a few very simple commands
#1

Hello guys! This is bensmart469 presenting you a simple tutorial on how to make simple commands
First of all, you will need to have zcmd, make sure to add this onto the top too
PHP код:
#include <zcmd> 
There are many other command processors but for now, we will use this.

First of all, we will make the simple /help command
Firstly, define color_yellow or any color which you want (replace the color_yellow with color_NAMEHERE and then the html color code)
WARNING, IF USING A FILTERSCRIPT USE #define filterscript
PHP код:
#define COLOR_YELLOW 0xFFFF00FF 
Here is the command, don't worry if you don't understand it! It will be described
PHP код:
CMD:help(playeridparams[])
{
    
SendClientMessage(playeridCOLOR_YELLOW"welcome to the test server!");
    return 
1;

PHP код:
    SendClientMessage(playeridCOLOR_YELLOW"welcome to the test server!"); 
Sends the player a message (playerid)

Now, we will make a /fullhealth command


PHP код:
CMD:fullhealth(playeridparams[])
{
        
SetPlayerHealth(playerid100);
        
SendClientMessage(playeridCOLOR_YELLOW,  "You have set your health to 100");
        return 
1;

PHP код:
        SetPlayerHealth(playerid100); 
This is to set the player's health to 100
PHP код:
    SendClientMessage(playeridCOLOR_YELLOW,  "You have set your health to 100"); 
This is to send the player a message
If you are looking for a few more, better commands, there is one below which takes money from you and gives you full health and armor in exchange
PHP код:
CMD:refillhealth(playerid,params[])
{
      if(
GetPlayerMoney(playerid) < 500) return SendClientMessage(playeridCOLOR_YELLOW"You need 500 dollars in order to use this command");
      
GivePlayerMoney(playerid,-500);
      
SetPlayerHealth(playerid100);
      
SetPlayerArmour(playerid100);
      
SendClientMessage(playeridCOLOR_YELLOW"You have payed 500 dollars to be healed");
      return 
1;

PHP код:
      if(GetPlayerMoney(playerid) < 500) return SendClientMessage(playeridCOLOR_YELLOW"You need 500 dollars in order to use this command"); 
This checks if the player does not have enough money for the health, if they don't, it will send them a message
PHP код:
      GivePlayerMoney(playerid,-500); 
This takes 500 dollars from the player
PHP код:
      SetPlayerHealth(playerid100);
      
SetPlayerArmour(playerid100); 
These set the player's health and armor to 100
PHP код:
      SendClientMessage(playeridCOLOR_YELLOW"You have payed 500 dollars to be healed"); 
This is to send the player a message to say that they have been healed

These commands were only for those who are new to scripting, I may make another tutorial soon for those who are more experienced with scripting.
And any bugs or compiling errors, post below, i will help you as soon as possible
Reply
#2

Nice and useful for newbie
Reply
#3

are you spamming ? cause i can see the same commands on wiki ?!
Reply
#4

i didnt see these cmds on the wiki, post a link please
Reply
#5

Nice tut
Reply
#6

better for newbies!
Reply
#7

Quote:

are you spamming ? cause i can see the same commands on wiki ?!

You're discouraging new people.
Reply
#8

nice tutorial for a beginner...
Reply
#9

Pretty usefull for learners
Reply
#10

Thank you very much
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)