01.05.2012, 19:44
(
Последний раз редактировалось NewerthRoleplay; 01.05.2012 в 21:40.
)
Hello everyone today i will be presenting you with a NOOB friendly tutorial, in this tutorial i will teach you how to create a /afix command for admins only, this is based around my admin variable which is pAdmin, please change it to the variable that your script uses! Without further adue, lets start the tutorial step by step!
First of all we are going to need a include, the include is ZCMD which is a command processor, a link can be found here: https://sampforum.blast.hk/showthread.php?tid=91354 .
To add this include into your script, we will put it into /yourserver/pawno/includes, then we will also use this code which goes underneath your:
Now that we have our command processor into the script we are going to setup a basic command like this:
Inside this command above the ( return 1; ) we are going to put this:
This piece of code ensures us that the player is a admin, otherwise it will tell them that they have to be a level 5 admin.
Inside the 2 curly brackets ( {} ) we are going to place the main code which will fix the visual and engine damage to the car.
This code is:
Ok, let me break that down for you, the
this will ensure that the player is in a vehicle, otherwise it will tell them that they have to be in a vehicle.
The next piece of code is:
this repairs the visual and engine damage of the vehicle.
Finally we will send the player a message tell them that there vehicle has been fixed
So overall your whole command should look like this:
Thanks for taking your time to read this, hope i helped! -Connor
P.S. This is my first tutorial, tell me whether or not i explained everything well enough, also i know that a similar script is available on the wiki, i just wanted to teach how you would do it when hecking of the player is a admin! thank -.-
First of all we are going to need a include, the include is ZCMD which is a command processor, a link can be found here: https://sampforum.blast.hk/showthread.php?tid=91354 .
To add this include into your script, we will put it into /yourserver/pawno/includes, then we will also use this code which goes underneath your:
pawn Код:
#include <a_samp>
#include <ZCMD> //Like so!
pawn Код:
CMD:afix(playerid, params[])
{
//The code for our command goes here.
return 1;
}
pawn Код:
if(PlayerInfo[playerid][pAdmin] >= 4)
{
//Rest of the script goes here
}
else return SendClientMessage, 0xFFFFFFFF, " **You must be a level 4 admin to use that!");
Inside the 2 curly brackets ( {} ) we are going to place the main code which will fix the visual and engine damage to the car.
This code is:
pawn Код:
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xFFFFFFFF, "You are not in a vehicle!");
RepairVehicle(GetPlayerVehicleID(playerid));
SendClientMessage(playerid, 0xFFFFFFFF, "Your vehicle has been successfully repaired!");
pawn Код:
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xFFFFFFFF, "You are not in a vehicle!");
The next piece of code is:
pawn Код:
RepairVehicle(GetPlayerVehicleID(playerid));
Finally we will send the player a message tell them that there vehicle has been fixed
pawn Код:
SendClientMessage(playerid, 0xFFFFFFFF, "Your vehicle has been successfully repaired!");
pawn Код:
CMD:afix(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 4)
{
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xFFFFFFFF, "You are not in a vehicle!");
RepairVehicle(GetPlayerVehicleID(playerid));
SendClientMessage(playerid, 0xFFFFFFFF, "Your vehicle has been successfully repaired!");
}
else return SendClientMessage, 0xFFFFFFFF, " **You must be a level 4 admin to use that!");
return 1;
}
//COPIERS NEVER LEARN!
Thanks for taking your time to read this, hope i helped! -Connor
P.S. This is my first tutorial, tell me whether or not i explained everything well enough, also i know that a similar script is available on the wiki, i just wanted to teach how you would do it when hecking of the player is a admin! thank -.-