[Tutorial] Making Player Commands For Beginners
#1

Basic Player Commands

Hey Guys, in this tutorial Im going to show you how to make some Basic Player Commands like /health, /killme, /teleport, etc. Okay in this tutorial, i will use zcmd as my include in making commands. It is simple and easy include, but very helped. Lets Getting Started.

ZCMD <--- Made by Zeex

First of all, you need to download zcmd.inc. You can download the file in above link. After you download it, copy paste zcmd.inc to pawno/include folder.

Okay, if you have done with it, lets start

We need to define the zcmd file first:
pawn Code:
#include <zcmd>
Write it exactly under include <a_samp>

Okay, i wanna introduce you, the simple/basic parameters of using zcmd as your commands.
Example like this:

pawn Code:
CMD:mycommand(playerid, params[])
{
//do something here
return 1;
}
Okay, mycommand is the name of your commands. thats very basic parameters of zcmd using.

Okay Now lets move. We gotta make, example, Health Commands!
Okay type this:

pawn Code:
CMD:health(playerid, params[])
{
SetPlayerHealth(playerid, 100);
SendClientMessage(playerid, -1, "You Have been healed");
return 1;
}
Okay let me explain what i did here.
Once player, type /health, then we set the playerhealth be 100 (100 is full health)
SetPlayerHealth is that function to set the player health. This is one of All function that you need when you are scripting. You can check all full list of function here
And SendClientMessage is the function to send message when Player do something.

pawn Code:
SendClientMessage(playerid, -1, "your message here")
. -1 is color white.


Okay following is some important function that may needed and its parameters:

pawn Code:
SetPlayerHealth(playerid, 100); // 100 means the health become full. if you set 0 the player will be dead
pawn Code:
SetPlayerPos(playerid, X, Y, Z coordinates);
SetPlayerPos is the function to setplayerposition to whatever we want. We gotta need this one when we are making teleport commands. To get your X, Y, Z coordinates, you need to enter samp debug, and then find your location where you want set your player position, then type /save yourname here if you have found the right position.

pawn Code:
GivePlayerWeapon(playerid, idofweapon, ammoofweapon);
This command if need if we gotta give player a weapons. ID of weapon can be checked in wiki samp.

pawn Code:
RepairVehicle(playerid, 100);
This command is needed when we gotta repair our vehicle.
pawn Code:
GivePlayerMoney(playerid, ammountofmoney);
This command is for give player money. we can set the ammounts. example:1000.

Okay, thoose are some basic commands that may you guys need. We've make simple heal commands. Now we gonna make Teleport Commands!!

pawn Code:
CMD:lasventuras(playerid, params[])
{
SetPlayerPos(playerid, 2029.1147,1016.0054,10.8203); //like ive explained above, SetPlayerPos is need when we want make teleport commands. Thoose coordinates will teleport you to las venturas, in front of Four Dragon Casino
return 1;
}
So when we typed /lasventuras, the player will get teleport to las venturas in front of Four Dragon Casino.
pawn Code:
2029.1147,1016.0054,10.8203
is a coordinates. You can get your coordinates like ive explained above:
Quote:

To get your X, Y, Z coordinates, you need to enter samp debug, and then find your location where you want set your player position, then type /save yourname here if you have found the right position.

Okay, Now we have make 2 commands!
Heal, and teleport Commands!

Now lets move on to make simple /kill commands!
Write this:

pawn Code:
CMD:kill(playerid, params[])
{
SetPlayerHealth(playerid, 0); // 0 is to make player's health be 0 and then death
return 1;
}
Now lets move on to make givemoney commands!
pawn Code:
CMD:givemoney(playerid, params[])
{
GivePlayerMoney(playerid, 3000); //3000 is ammount, you can change it.
return 1;
}
Okay that is my tutorial
Wish it helped for newbie or beginners
Reply
#2

How to make a teleportion command to another world?
Reply
#3

Quote:
Originally Posted by -Shifty-
View Post
How to make a teleportion command to another world?
PHP Code:
CMD:wtele(playeridparams[])
{
    new 
world;
    if(
sscanf(params"d"world)) return SendClientMessage(playerid, -1"USAGE: /wtele [world]");
    
SetPlayerVirtualWorld(playeridworld);
    return 
1;

Reply
#4

awosme one but :
just a suggestion :
CMD:godon(playerid, params[])
{
SetPlayerHealth(playerid, 99999999999999999999999999999999);
SendClientMessage(playerid, -1, "God Mod On");
return 1;
}

and
CMD:godoff(playerid, params[])
{
SetPlayerHealth(playerid, 100);
SendClientMessage(playerid, -1, "god mod off");
return 1;
}
does it work
Reply
#5

i quote :
RepairVehicle(playerid, 100);

playerid ? 100 ? yours is ronge , it is
RepairVehicle(vehicleid);
Reply
#6

Quote:
Originally Posted by Chrisis
View Post
i quote :
RepairVehicle(playerid, 100);

playerid ? 100 ? yours is ronge , it is
RepairVehicle(vehicleid);
bro i told u if i did like that does it work :
Quote:

CMD:godoff(playerid, params[])
{
SetPlayerHealth(playerid, 100);
SendClientMessage(playerid, -1, "god mod off");
return 1;
}

CMD:godon(playerid, params[])
{
SetPlayerHealth(playerid, 99999999999999999999999999999999);
SendClientMessage(playerid, -1, "God Mod On");
return 1;
}

Reply
#7

Good job
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)