[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


Messages In This Thread
Making a few very simple commands - by bensmart469 - 01.12.2012, 12:17
Re: Making a few very simple commands - by zohartrejx - 01.12.2012, 12:18
Re: Making a few very simple commands - by [GF]Logic - 01.12.2012, 13:08
Re: Making a few very simple commands - by bensmart469 - 01.12.2012, 13:31
Re: Making a few very simple commands - by IceBilizard - 03.12.2012, 06:20
Re: Making a few very simple commands - by Guest4390857394857 - 24.02.2014, 17:01
Re: Making a few very simple commands - by ACI - 24.02.2014, 17:43
Re: Making a few very simple commands - by Ozil - 26.02.2014, 13:13
Re: Making a few very simple commands - by OnPlayerText - 26.02.2014, 14:09
Re: Making a few very simple commands - by alimash - 27.02.2014, 15:18

Forum Jump:


Users browsing this thread: 1 Guest(s)