SA-MP Forums Archive
[FilterScript] How to Create /Aduty ,/Offduty USING <ZCMD> [ GOOD FOR STUNTING SERVER ] - 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: [FilterScript] How to Create /Aduty ,/Offduty USING <ZCMD> [ GOOD FOR STUNTING SERVER ] (/showthread.php?tid=411977)



[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
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(playeridparams[])

PHP код:

enum Player_Data
{
      
pLevel,
};
new 
P_DATA[MAX_PLAYERS][Player_Data]; 
Now we will Use this now our command
PHP код:
CMD:aduty(playeridprams[])
{
    if (
P_DATAplayerid ][ P_Level ] < 1)return SendClientMessageplayerid,RED"You are not high enough level to use this commands"); 
Function
PHP код:
if (P_DATAplayerid ][ P_Level ] < 1
were in used from
Код:
new P_DATA[MAX_PLAYERS][Player_Data];
PHP код:
CMD:aduty(playeridparams[])
{
    if (
P_DATAplayerid ][ P_Level ] < 1)return SendClientMessageplayerid"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.
PHP код:
    new string[256]; // create String
    
format(stringsizeof(string), "[CAUTION]: Administrator %s Is Now On-Duty."); // Send info to server
    
SendClientMessageToAll(REDstring);
    
SendClientMesageplayeridCOLOR_YELLOW"You are now on duty mode.USe /offduty to offduty !"); // Send information to %s player (command user)
    
SetPlayerHealth(playerid9999); // Set health to 9999 - As godmode
    
SetPlayerArmour(playerid9999); // 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
    
GivePlayerWeaponplayerid30100000); // guns 
    
GivePlayerWeaponplayerid38100000); // guns
    
GivePlayerWeaponplayerid35100000); // guns
    
GivePlayerWeaponplayerid24100000); // guns
    
GivePlayerWeaponplayerid26100000); //guns
    
Aduty[playerid] =1
    
Adutycount++;
    return 
1;

Код:
Aduty[playerid] =1; 
    Adutycount++;
This will set the player duty +1 mean counted
Код:
In /offduty all function are as same as /duty so No need to explain again and again
PHP код:
CMD:offduty(playeridparams[])
{
    if (
P_DATAplayerid ][ P_Level ] < 1)return SendClientMessageplayerid"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(stringsizeof(string), "[CAUTION]: Administrator %s Is Now Off-Duty.");
    
SendClientMessageToAll(REDstring);
    
SetPlayerHealth(playerid100); // 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.