22.08.2013, 20:56
(
Last edited by kjek98; 22/08/2013 at 10:12 PM.
)
Ok so this is my first tutorial so please tell me if i make any errors because I'm new to scripting.
Ok so the first command what we are going to make is /buyhealth
so what we will need is a zcmd include it can be found here.
we will place this at the top of our script so we get the cmds to work.
We need to add this to start the cmd
ok so now were going to add this, what it is it takes the money off the player when they use the cmd /buyhealth
now we are going to add the player 100 health.
now we are going to make a message to the player after he has bought the health
now we are going to add a message that will send if the player does not have the required money amount.
Ok we are nearly done but we need to add this before we finish the command
and here is how the command should look like
i hope this helped im sorry if i did it wrong as i said its my first tutorial and im new at scripting.
Ok so the first command what we are going to make is /buyhealth
so what we will need is a zcmd include it can be found here.
we will place this at the top of our script so we get the cmds to work.
Code:
#include <zcmd>
Code:
CMD:buyhealth(playerid, params[]) {
Code:
if(GetPlayerMoney(playerid) > 5500) { GivePlayerMoney(playerid, -5500); }
Code:
SetPlayerHealth(playerid,100); // this give him full health
Code:
SendClientMessage(playerid,-1,"You paid 5500$ to heal your self !"); // changeme : the color you wan't , COLOR_GREEN for example
Code:
} else SendClientMessage(playerid,-1,"You don't have 5500$ !");
Code:
return 1; }
Code:
CMD:buyhealth(playerid, params[]) { if(GetPlayerMoney(playerid) > 5500) { GivePlayerMoney(playerid, -5500); } SetPlayerHealth(playerid,100); // we heal him a.k.a give him full health SendClientMessage(playerid,-1,"You paid 5500$ to heal your self !"); } else SendClientMessage(playerid,-1,"You don't have 5500$ !"); return 1; }