Raised This Month: $ Target: $400
 0% 

Ammo pack for Admins


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Regedents
Member
Join Date: Aug 2009
Old 09-16-2009 , 06:45   Ammo pack for Admins
Reply With Quote #1

Hi, i search plugin Ammo Pack for Admins. When admin kill zombie, he obtained 50 ammo pack. Or every round start he obtained ammo pack. But only Admins with Flag H. Please help ...
Regedents is offline
NiHiLaNTh
Way Past Expiration
Join Date: May 2009
Location: Latvia
Old 09-16-2009 , 08:18   Re: Ammo pack for Admins
Reply With Quote #2

Code:
#include <amxmodx>
#include <hamsandwich>
#include <zombieplague>

#define ACCESS_FLAG ADMIN_CFG

public plugin_init()
{
    register_plugin("[ADMIN] Zombie kill reward", "1.0", "NiHiLaNTh")
    
    RegisterHam(Ham_Killed, "player", "fw_PlayerKilled")
}

public fw_PlayerKilled(victim, attacker, shouldgib)
{
    if (zp_get_user_zombie(victim))
    {
        if (get_user_flags(attacker) & ACCESS_FLAG)
        {
            zp_set_user_ammo_packs(attacker, zp_get_user_ammo_packs(attacker) + 50)
        }
    }
}
This should work(untested)
__________________

NiHiLaNTh is offline
Send a message via Skype™ to NiHiLaNTh
Regedents
Member
Join Date: Aug 2009
Old 09-16-2009 , 09:44   Re: Ammo pack for Admins
Reply With Quote #3

Quote:
Originally Posted by NiHiLaNTh View Post
Code:
#include <amxmodx>
#include <hamsandwich>
#include <zombieplague>
 
#define ACCESS_FLAG ADMIN_CFG
 
public plugin_init()
{
    register_plugin("[ADMIN] Zombie kill reward", "1.0", "NiHiLaNTh")
 
    RegisterHam(Ham_Killed, "player", "fw_PlayerKilled")
}
 
public fw_PlayerKilled(victim, attacker, shouldgib)
{
    if (zp_get_user_zombie(victim))
    {
        if (get_user_flags(attacker) & ACCESS_FLAG)
        {
            zp_set_user_ammo_packs(attacker, zp_get_user_ammo_packs(attacker) + 50)
        }
    }
}
This should work(untested)
Thx, when i will go home at work, i tested. But where is admin flag ?i am blind?

Last edited by Regedents; 09-16-2009 at 09:47.
Regedents is offline
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 09-16-2009 , 11:03   Re: Ammo pack for Admins
Reply With Quote #4

PHP Code:
#define ACCESS_FLAG ADMIN_CFG 
Exactly is this :
PHP Code:
ADMIN_CFG 
Flags:
PHP Code:
#define ADMIN_IMMUNITY        (1<<0)    /* flag "a" */
#define ADMIN_RESERVATION    (1<<1)    /* flag "b" */
#define ADMIN_KICK        (1<<2)    /* flag "c" */
#define ADMIN_BAN        (1<<3)    /* flag "d" */
#define ADMIN_SLAY        (1<<4)    /* flag "e" */
#define ADMIN_MAP        (1<<5)    /* flag "f" */
#define ADMIN_CVAR        (1<<6)    /* flag "g" */
#define ADMIN_CFG        (1<<7)    /* flag "h" */
#define ADMIN_CHAT        (1<<8)    /* flag "i" */
#define ADMIN_VOTE        (1<<9)    /* flag "j" */
#define ADMIN_PASSWORD        (1<<10)    /* flag "k" */
#define ADMIN_RCON        (1<<11)    /* flag "l" */
#define ADMIN_LEVEL_A        (1<<12)    /* flag "m" */
#define ADMIN_LEVEL_B        (1<<13)    /* flag "n" */
#define ADMIN_LEVEL_C        (1<<14)    /* flag "o" */
#define ADMIN_LEVEL_D        (1<<15)    /* flag "p" */
#define ADMIN_LEVEL_E        (1<<16)    /* flag "q" */
#define ADMIN_LEVEL_F        (1<<17)    /* flag "r" */
#define ADMIN_LEVEL_G        (1<<18)    /* flag "s" */
#define ADMIN_LEVEL_H        (1<<19)    /* flag "t" */
#define ADMIN_MENU        (1<<20)    /* flag "u" */
#define ADMIN_ADMIN        (1<<24)    /* flag "y" */
#define ADMIN_USER        (1<<25)    /* flag "z" */ 
__________________
xbatista is offline
Send a message via Skype™ to xbatista
Regedents
Member
Join Date: Aug 2009
Old 09-18-2009 , 11:42   Re: Ammo pack for Admins
Reply With Quote #5

Nice !! Thx ... this plugin worked perfectly! I would like you to next editing. I need set MAXIMUM ammopack what can you get. Maybe to: You will have max 30 Ammopack !
Regedents is offline
NiHiLaNTh
Way Past Expiration
Join Date: May 2009
Location: Latvia
Old 09-18-2009 , 13:14   Re: Ammo pack for Admins
Reply With Quote #6

You mean, that player can't get more than 30 Ammo Packs?Hmm, I don't know is it possible
__________________

NiHiLaNTh is offline
Send a message via Skype™ to NiHiLaNTh
Regedents
Member
Join Date: Aug 2009
Old 09-18-2009 , 14:26   Re: Ammo pack for Admins
Reply With Quote #7

Quote:
Originally Posted by NiHiLaNTh View Post
You mean, that player can't get more than 30 Ammo Packs?Hmm, I don't know is it possible
Yes .. If i have 30 ammopack (maximum) and i kill next zombies, i will havent 30+ ammopack but still 30 ...
Regedents is offline
NiHiLaNTh
Way Past Expiration
Join Date: May 2009
Location: Latvia
Old 09-18-2009 , 14:53   Re: Ammo pack for Admins
Reply With Quote #8

Quote:
Originally Posted by Regedents View Post
Yes .. If i have 30 ammopack (maximum) and i kill next zombies, i will havent 30+ ammopack but still 30 ...
It is possible, but plugin written below will conflict with Admin ammo packs reward plugin.
Anyway...
Code:
#include <amxmodx>
#include <hamsandwich>
#include <zombieplague>

public plugin_init()
{
    register_plugin("No more than 30 Ammo Packs", "1.0", "NiHiLaNTh")
    
    RegisterHam(Ham_Killed, "player", "fw_PlayerKilled")
}

public fw_PlayerKilled(victim, attacker, shouldgib)
{
    if (zp_get_user_ammo_packs(attacker) >= 30)
    {
        zp_set_user_ammo_packs(attacker, 30)
    }
}
Untested
__________________

NiHiLaNTh is offline
Send a message via Skype™ to NiHiLaNTh
Regedents
Member
Join Date: Aug 2009
Old 09-18-2009 , 14:55   Re: Ammo pack for Admins
Reply With Quote #9

Quote:
Originally Posted by NiHiLaNTh View Post
It is possible, but plugin written below will conflict with Admin ammo packs reward plugin.
Anyway...
Code:
#include <amxmodx>
#include <hamsandwich>
#include <zombieplague>
 
public plugin_init()
{
    register_plugin("No more than 30 Ammo Packs", "1.0", "NiHiLaNTh")
 
    RegisterHam(Ham_Killed, "player", "fw_PlayerKilled")
}
 
public fw_PlayerKilled(victim, attacker, shouldgib)
{
    if (zp_get_user_ammo_packs(attacker) >= 30)
    {
        zp_set_user_ammo_packs(attacker, 30)
    }
}
Untested
Hmm you are genius And its possible to connect through with admin ammo pack? Will be only 1 plugin with all scriptes
Regedents is offline
NiHiLaNTh
Way Past Expiration
Join Date: May 2009
Location: Latvia
Old 09-19-2009 , 02:45   Re: Ammo pack for Admins
Reply With Quote #10

Code:
#include <amxmodx>
#include <hamsandwich>
#include <zombieplague>

#define ACCESS_FLAG ADMIN_CFG

public plugin_init()
{
    register_plugin("No more than 30 Ammo Packs", "1.0", "NiHiLaNTh")
    
    RegisterHam(Ham_Killed, "player", "fw_PlayerKilled")
}

public fw_PlayerKilled(victim, attacker, shouldgib)
{
    if (zp_get_user_zombie(victim))
    {
        if (get_user_flags(attacker) & ACCESS_FLAG)
        {
            zp_set_user_ammo_packs(attacker, zp_get_user_ammo_packs(attacker) + 50)
        }
        else if (zp_get_user_ammo_packs(attacker) >= 30)
        {          
            zp_set_user_ammo_packs(attacker, 30)
        }
    }
}
In this plugin, admin is able to get more than 30 Ammo packs, other players aren't able to do this
__________________

NiHiLaNTh is offline
Send a message via Skype™ to NiHiLaNTh
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 23:44.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode