[Tutorial] How to Create /Aduty ,/Offduty USING <ZCMD> [ GOOD FOR STUNTING SERVER ] -
M3mPHi$_S3 - 31.01.2013
Starting...
First We Will Define includes and other simple things
PHP код:
#include <a_samp>
#include <zcmd> // The command Creator
#define RED 0xE60000FF // color red defination
new Aduty[MAX_PLAYERS];
new Adutycount;
In Case- Now We will create a enum function which will not allow a simple player to use this command.0nly for admins
PHP код:
enum Player_Data
{
P_Level,
};
new P_DATA[MAX_PLAYERS][Player_Data];
When we will define it on command so this will not allow a player to use command if he will not be an admin
Now we will start Creating our Command
PHP код:
CMD:duty(playerid, params[])
{
- Now we will define if a player is not admin he cant use a command FOr that we already created this
PHP код:
enum Player_Data
{
pLevel,
};
new P_DATA[MAX_PLAYERS][Player_Data];
Now we will Use this now our command
PHP код:
CMD:aduty(playerid, prams[])
{
if (P_DATA[ playerid ][ P_Level ] < 1)return SendClientMessage( playerid,RED, "You are not high enough level to use this commands");
Function
PHP код:
if (P_DATA[ playerid ][ P_Level ] < 1)
were in used from
Код:
new P_DATA[MAX_PLAYERS][Player_Data];
- Now we will create a function which will not allowed a player to Spam the server repeating using the command so for that we will use this funtion
Код:
new Aduty[MAX_PLAYERS];
PHP код:
CMD:aduty(playerid, params[])
{
if (P_DATA[ playerid ][ P_Level ] < 1)return SendClientMessage( playerid, "You are not high enough level to use this commands");
if(Aduty[playerid] == 1) // -- No need to explain about this ..
{
return GameTextForPlayer(playerid, "You are already in Duty-Mode. Use /offduty",3000,3);
}
This "1" Mean once a player is on-duty he cant use /duty command again.
- This was soem importante part of command In-case this all Now we will Function the command
PHP код:
new string[256]; // create String
format(string, sizeof(string), "[CAUTION]: Administrator %s Is Now On-Duty."); // Send info to server
SendClientMessageToAll(RED, string);
SendClientMesage( playerid, COLOR_YELLOW, "You are now on duty mode.USe /offduty to offduty !"); // Send information to %s player (command user)
SetPlayerHealth(playerid, 9999); // Set health to 9999 - As godmode
SetPlayerArmour(playerid, 9999); // set armour to 9999 - full armour
new Float:X;
new Float:Y;
new Float:Z;
GetPlayerPos(playerid,X,Y,Z);
CreateVehicle(425,X,Y+5,Z,1,1,1,90000); // This is spawn a HUNTER near %s Player
GivePlayerWeapon( playerid, 30, 100000); // guns
GivePlayerWeapon( playerid, 38, 100000); // guns
GivePlayerWeapon( playerid, 35, 100000); // guns
GivePlayerWeapon( playerid, 24, 100000); // guns
GivePlayerWeapon( playerid, 26, 100000); //guns
Aduty[playerid] =1;
Adutycount++;
return 1;
}
Код:
Aduty[playerid] =1;
Adutycount++;
This will set the player duty +1 mean counted
- Now we will create /offduty command
Код:
In /offduty all function are as same as /duty so No need to explain again and again
PHP код:
CMD:offduty(playerid, params[])
{
if (P_DATA[ playerid ][ P_Level ] < 1)return SendClientMessage( playerid, "You are not high enough level to use this commands");
if(Aduty[playerid] == 0)
{
return GameTextForPlayer(playerid, "You are not in Duty-Mode. Use /aduty",3000,3);
}
new string[256];
format(string, sizeof(string), "[CAUTION]: Administrator %s Is Now Off-Duty.");
SendClientMessageToAll(RED, string);
SetPlayerHealth(playerid, 100); // set player health to normal 100
ResetPlayerWeapons(playerid); // disarm the %s player
Aduty[playerid] =0; // in-active the %s player duty
Adutycount--; // Same
return 1;
}
Hope you'll like it .
"FULL CODE CAN BE FOUND HERE"
Re: How to Create /Aduty ,/Offduty USING <ZCMD> [ GOOD FOR STUNTING SERVER ] -
DemonRider - 31.01.2013
good work +1rep
Re: How to Create /Aduty ,/Offduty USING <ZCMD> [ GOOD FOR STUNTING SERVER ] -
Luis- - 31.01.2013
Whys the prefix set as Filterscript?
Re: How to Create /Aduty ,/Offduty USING <ZCMD> [ GOOD FOR STUNTING SERVER ] -
M3mPHi$_S3 - 31.01.2013
Quote:
Originally Posted by -Luis
Whys the prefix set as Filterscript?
|
Well thanks for your notification.Chould'nt change it
Re: How to Create /Aduty ,/Offduty USING <ZCMD> [ GOOD FOR STUNTING SERVER ] -
iGetty - 31.01.2013
This is okay, but it's not very well explained.
Try adding more explanation about things.
Re: How to Create /Aduty ,/Offduty USING <ZCMD> [ GOOD FOR STUNTING SERVER ] -
M3mPHi$_S3 - 01.02.2013
Lol .. i have explain it with my best
Re: How to Create /Aduty ,/Offduty USING <ZCMD> [ GOOD FOR STUNTING SERVER ] -
SuperViper - 01.02.2013
You never added loading/saving for the admin variable.
Re: How to Create /Aduty ,/Offduty USING <ZCMD> [ GOOD FOR STUNTING SERVER ] -
M3mPHi$_S3 - 01.02.2013
Quote:
Originally Posted by SuperViper
You never added loading/saving for the admin variable.
|
What saving ? No need to save this
Re: How to Create /Aduty ,/Offduty USING <ZCMD> [ GOOD FOR STUNTING SERVER ] -
BigDee - 06.04.2013
Um, do I need to add that in the bottom of the Zadmin script? I'm sorry for asking I'm just kinda' new in scripting
Re: How to Create /Aduty ,/Offduty USING <ZCMD> [ GOOD FOR STUNTING SERVER ] -
Isolated - 06.04.2013
Why would you set the ammo to 100k?? I'm sure the max is only like 10k. That's just a waste.