Raised This Month: $32 Target: $400
 8% 

plugin gives armor to zombie


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
nunuxer
Junior Member
Join Date: Jan 2021
Old 01-20-2021 , 08:07   plugin gives armor to zombie
Reply With Quote #1

Hello, modders !

So I have an armour free plugin it works fine, but if a VIP is zombie, die and then respawn it gives 200 armor to him (as a zombie), I tried to make it so if it has admin_level_G to give no armor but it didn't worked. What should I do ?

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

#define ACCESS ADMIN_LEVEL_G

new cvar_armor_valueg_SayText
 
new sound_armor[] = { "items/tr_kevlar.wav" }
 
public 
plugin_init() 
{
    
register_plugin("[CSO] Free Armor for Players""1.0""Carbon")
    
    
RegisterHam(Ham_Spawn"player""fw_Give_Armor"1)
    
cvar_armor_value register_cvar("zp_armor""50")
    
    
g_SayText get_user_msgid("SayText")
}

public 
fw_Give_Armor(id)
{
    if (
is_user_alive(id) && !zp_get_user_zombie(id))
    {
        if (
get_user_flags(id) != ACCESS)
        {
            
set_user_armor(idget_pcvar_num(cvar_armor_value))
            
ColorPrint(id"^x04[CSO]^x01 You got free 50 Armor!"get_pcvar_num(cvar_armor_value))
            
client_cmd(id"spk %s"sound_armor)
        }
    }
}
  

stock ColorPrint(const id, const input[], any:...)
{
    if( !
is_user_connectedid ) )
        return

    static 
msg[191]
    
vformat(msg190input3)
    
    
replace_all(msg190"!g""^4")
    
replace_all(msg190"!y""^1")
    
replace_all(msg190"!t""^3")
    
    
message_begin(MSG_ONE_UNRELIABLEg_SayText_id)
    
write_byte(id)
    
write_string(msg)
    
message_end()

nunuxer is offline
GasmoN
Member
Join Date: Jul 2014
Old 01-20-2021 , 08:17   Re: plugin gives armor to zombie
Reply With Quote #2

Do you want to give free armor to humans only when they spawn or even if they use antidote as zombie, etc?
To give armor every time, not only on spawn, just use zp_user_humanized_post forward.
If you want to give armor only on spawn, try to give it with a bit of a delay (For example set task to 1.0 when player spawn)
GasmoN is offline
nunuxer
Junior Member
Join Date: Jan 2021
Old 01-20-2021 , 08:19   Re: plugin gives armor to zombie
Reply With Quote #3

Quote:
Originally Posted by GasmoN View Post
Do you want to give free armor to humans only when they spawn or even if they use antidote as zombie, etc?
To give armor every time, not only on spawn, just use zp_user_humanized_post forward.
If you want to give armor only on spawn, try to give it with a bit of a delay (For example set task to 1.0 when player spawn)

Yes, but the thing is that the plugin works, it gives armor to humans but for example if you are a zombie and you have VIP, if I kill you and you respawn you will get 200 armor as a zombie. How can I make it so it won't give you armor if you are a zombie ?

Last edited by nunuxer; 01-20-2021 at 08:19.
nunuxer is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 01-21-2021 , 13:07   Re: plugin gives armor to zombie
Reply With Quote #4

Try replacing the following
Code:
public fw_Give_Armor(id) {     if (is_user_alive(id) && !zp_get_user_zombie(id))     {         if (get_user_flags(id) != ACCESS)         {             set_user_armor(id, get_pcvar_num(cvar_armor_value))             ColorPrint(id, "^x04[CSO]^x01 You got free 50 Armor!", get_pcvar_num(cvar_armor_value))             client_cmd(id, "spk %s", sound_armor)         }     } }

with this
Code:
const TASK_GIVE_ARMOR = 5555 public fw_Give_Armor(id) {     set_task(0.2, "task_Give_Armor", id+TASK_GIVE_ARMOR) } public task_Give_Armor(taskid) {     new id = taskid - TASK_GIVE_ARMOR     if (is_user_alive(id) && !zp_get_user_zombie(id))     {         if (get_user_flags(id) != ACCESS)         {             set_user_armor(id, get_pcvar_num(cvar_armor_value))             ColorPrint(id, "^x04[CSO]^x01 You got free 50 Armor!", get_pcvar_num(cvar_armor_value))             client_cmd(id, "spk %s", sound_armor)         }     } }
__________________








CrazY. is offline
Reply


Thread Tools
Display Modes

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 03:37.


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