SA-MP Forums Archive
[Tutorial] How to make basic Zcmd commands - 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)
+---- Forum: Tutorials (https://sampforum.blast.hk/forumdisplay.php?fid=70)
+---- Thread: [Tutorial] How to make basic Zcmd commands (/showthread.php?tid=373288)



How to make basic Zcmd commands - Juan_Viz - 29.08.2012

Basic Zcmd tutorial

Hi there, i am Phantom and today I will be teaching you how to make simple Zcmd commands such as /healme, /armourme, /m4 and so.

Lets get started!

Okay, so first what you have to do is download the Zcmd include, wich can be found on this url -> https://sampforum.blast.hk/showthread.php?tid=91354

After downloading it add it to [ServerFolder/pawno/includes] Then open pawno, then click on "new", after that you can delete everything then at the first line make the #defines and the #includes, It would be like this
Code:
#include <a_samp>
#include <zcmd>
//Color Defines
#define COLOR_GREEN 0x008000FF
#define COLOR_BLUE 0x0000FFFF
#define COLOR_BRIGHTRED 0xFF000AAA
#define COLOR_AQUA 0x00FFFFAA
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_BEIGE 0xFFF8DCAA
#define COLOR_BLACK 0x000000AA
#define COLOR_LIGHTERBLUE 0x00BFFFAA
#define COLOR_BLUELIGHT 0x1E90FFAA
#define COLOR_BLUEMEDIUM 0x0000CDAA
#define COLOR_BLUEDARK 0x00008BAA
#define COLOR_PINK 0xFF1493AA
#define COLOR_PINKDARK 0xFF00FFAA
#define COLOR_GREENLIGHT 0x00FF00AA
#define COLOR_GREENDARK 0x006400AA
#define COLOR_MAROON 0x800000AA
#define COLOR_OKER 0x808000AA
#define COLOR_ORANGE 0xFF4500AA
#define COLOR_ORANGELIGHT 0xFF8C00AA
#define COLOR_PURPLE 0x800080AA
#define COLOR_VIOLETDARK 0x9400D3AA
#define COLOR_INDIGO 0xAB0082AA
#define COLOR_RED 0xFF0000AA
#define COLOR_SAND 0xFFDEADAA
#define COLOR_SILVER 0xC0C0C0AA
#define COLOR_TEAL 0x008080AA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_GOLD 0xFFD700AA
#define COLOR_BROWN 0x8B4513AA
#define COLOR_BROWNLIGHT 0xA0522DAA
#define COLOR_GRAY 0xA9A9A9AA
#define COLOR_GRAYDARK 0x696969AA
#define COLOR_INVISIBLE 0xFFFFFF00
//Color Defines
As you can see, i left you a big variety of color defines so you dont have to ****** them, now lets continue!
Now lets make a simple "Healme" command.
Code:
CMD:healme(playerid,params[])
{ //This wil open the command
	SendClientMessage(playerid,COLOR_RED,"You have healed yourself"); //This will send you a message saying "You have healed yourself.
	SetPlayerHealth(playerid,100); //"100" Is the ammount of HP it will add to the user who makes /healme, you can edit it.
	return 1; //This will let the server know the CMD was done successfully.
} //This will close the command, as it was successfully processed.
Want to add more things? Just make your code below "SetPlayerHealth"!

Now, lets make a simple armour command!
Code:
CMD:armourme(playerid,params[])
{ //This wil open the command
	SendClientMessage(playerid,COLOR_RED,"You have refilled your armour"); //This will send you a message saying "You have refilled your armour.
	SetPlayerArmour(playerid,100); //"100" Is the ammount of armour it will setto the user who makes /armourme, you can edit it.
	return 1; //This will let the server know the CMD was done successfully.
} //This will close the command, as it was successfully processed.
Good job! Now lets make a basic weapon command!
Code:
CMD:weaponset(playerid,params[])
{ //This wil open the command
	SendClientMessage(playerid,COLOR_RED,"You have spawned a weapon set"); //It will send a message saying that you have spawned a weapon set to you.
	GivePlayerWeapon(playerid,24,9999); // 24 = The id of the weapon, in this case a Deagle and "9999" is the ammount of ammo.
	GivePlayerWeapon(playerid,31,9999); //31 = The id of the weapon, in this case a M4 and "9999" is the ammount of ammo.
	return 1; //This will let the server know the CMD was done successfully.
} //This will close the command, as it was successfully processed.
Now, you have learned how to make a weapon, healing and armour commands, i will leave more types of commands below.

Code:
GivePlayerMoney(playerid,#); =In # you must add the ammount, you can allso add negative ammount, wich can be made placing a "-" Before the number
SendClientMessageToAll(playerid,%,"#"); % = The color, you might be using the colors you defined at the top.
# is the textit will send! Allways make sure the text is between two Of these ", Example:"HELLO! "



Respuesta: How to make basic Zcmd commands - Juan_Viz - 29.08.2012

17 views, no comments?


Re: How to make basic Zcmd commands - Mr.Sanchez - 30.08.2012

Althought i didin't use the tutorial I think It Might be Helpfull for a few newbies like me around the forums


Re: How to make basic Zcmd commands - Cena44 - 30.08.2012

very simple, good job


Respuesta: How to make basic Zcmd commands - Juan_Viz - 30.08.2012

Yeah, its simple but usefull very well explaimed! Thanks


Re: Respuesta: How to make basic Zcmd commands - Steven82 - 30.08.2012

Quote:
Originally Posted by Juan_Viz
View Post
17 views, no comments?
I know you said basic, but a lot of people know how to create all this stuff. They just don't understand the ZCMD syntax, which is why you should create something a bit more advanced like a /healperson [playerid] [health] or something like that.


Respuesta: Re: Respuesta: How to make basic Zcmd commands - Juan_Viz - 30.08.2012

Quote:
Originally Posted by Steven82
View Post
I know you said basic, but a lot of people know how to create all this stuff. They just don't understand the ZCMD syntax, which is why you should create something a bit more advanced like a /healperson [playerid] [health] or something like that.
I get it, thanks! :P


Re: How to make basic Zcmd commands - Zarky - 31.08.2012

Quote:
Code:
#include <a_samp>
#include zcmd
isnt it supposed to be

pawn Code:
#include <zcmd>
not

Code:
#include zcmd
Anyways its useful , Nice


Respuesta: How to make basic Zcmd commands - Juan_Viz - 31.08.2012

Thanks for the feedback!


Re: How to make basic Zcmd commands - [LB]BlAcK_DeViL - 01.09.2012

Well Explained ..