[FilterScript] How to Create /Aduty ,/Offduty USING <ZCMD> [ GOOD FOR STUNTING SERVER ]
#1

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"
Reply
#2

good work +1rep
Reply
#3

Whys the prefix set as Filterscript?
Reply
#4

Quote:
Originally Posted by -Luis
Посмотреть сообщение
Whys the prefix set as Filterscript?
Well thanks for your notification.Chould'nt change it
Reply
#5

This is okay, but it's not very well explained.

Try adding more explanation about things.
Reply
#6

Lol .. i have explain it with my best
Reply
#7

You never added loading/saving for the admin variable.
Reply
#8

Quote:
Originally Posted by SuperViper
Посмотреть сообщение
You never added loading/saving for the admin variable.
What saving ? No need to save this
Reply
#9

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
Reply
#10

Why would you set the ammo to 100k?? I'm sure the max is only like 10k. That's just a waste.
Reply


Forum Jump:


Users browsing this thread: