Raised This Month: $51 Target: $400
 12% 

[CS 1.6] How to make plugin only for VIP


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Wortexx
Member
Join Date: Apr 2020
Location: Serbia
Old 04-03-2020 , 10:59   [CS 1.6] How to make plugin only for VIP
Reply With Quote #1

So I managed to pull this together, the plugin should add hp when you kill a person and full armor on respawn. Obviously, as you can see in the title, this should be only for VIPs and that I don't know how to do.

This is the plugin:

Quote:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <VIPSystem>
#include <hamsandwich>
#include <fakemeta>
#include <fun>

new gCvarArmor;
new gCvarAmount;
new kill_healed, health_add, health_hs_add, health_max, nKiller, nKiller_hp, nHp_add, nHp_max

public plugin_init() {
register_plugin("hpperkill_and_armor", "1.0", "Wortexx");
register_event("DeathMsg","death","ae")

gCvarArmor = register_cvar( "sv_armor", "2" );
gCvarAmount = register_cvar( "sv_armor_amount", "100" );

kill_healed = register_cvar("amx_killhealed", "1")
health_add = register_cvar("amx_hp", "15")
health_hs_add = register_cvar("amx_hp_hs", "20")
health_max = register_cvar("amx_hp_max", "200")

RegisterHam( Ham_Spawn, "player", "fwdPlayerSpawn", 1 );
}

public fwdPlayerSpawn( id ) {
if( is_user_alive( id ) ) {
new iPluginArmorType = clamp( get_pcvar_num( gCvarArmor ), 0, 2 );

if( iPluginArmorType > 0 ) {
new CsArmorType:iPlayerArmorType;
new iPlayerAmount = cs_get_user_armor( id, iPlayerArmorType );
new iPluginAmount = min( get_pcvar_num( gCvarAmount ), 0xFF );

cs_set_user_armor( id, max( iPluginAmount, iPlayerAmount ), CsArmorType:max( iPluginArmorType, _:iPlayerArmorType ) );
}
}
}

public death()
{
if(get_pcvar_num(kill_healed)!=1) return;

// Killer id
nKiller = read_data(1)

// Change HP Amount when made a Head Shot
if (read_data(3)==1 && read_data(5)==0)
nHp_add = get_pcvar_num(health_hs_add)
else
nHp_add = get_pcvar_num(health_add)

// Updating Killer HP
nHp_max = get_pcvar_num (health_max)
nKiller_hp = get_user_health(nKiller) + nHp_add

// Check Maximum HP
if (nKiller_hp > nHp_max) nKiller_hp = nHp_max
set_user_health(nKiller, nKiller_hp)

// Hud message "Healed +15/+20 hp"
set_hudmessage(0, 255, 0, -1.0, 0.15, 0, 1.0, 1.0, 0.1, 0.1, -1)
show_hudmessage(nKiller,"Healed +%d HP",nHp_add)

// Screen fading
message_begin(MSG_ONE,get_user_msgid("ScreenF ade"),{0,0,0},Killer)
write_short(1<<10)
write_short(1<<10)
write_short(0x0000)
write_byte(0) // red
write_byte(0) // green
write_byte(200) // blue
write_byte(75) // alpha
message_end()
}
Please help, it would mean a lot. Of course the quicker the response the better. ^^

Last edited by Wortexx; 04-03-2020 at 11:07.
Wortexx is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 04-03-2020 , 11:03   Re: [CS 1.6] How to make plugin only for VIP
Reply With Quote #2

PHP Code:
if(get_user_flags(id) & ADMIN_LEVEL_H)
{
    
// Is VIP - change check to your desired flag.

__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
Wortexx
Member
Join Date: Apr 2020
Location: Serbia
Old 04-03-2020 , 11:09   Re: [CS 1.6] How to make plugin only for VIP
Reply With Quote #3

Quote:
Originally Posted by Napoleon_be View Post
PHP Code:
if(get_user_flags(id) & ADMIN_LEVEL_H)
{
    
// Is VIP - change check to your desired flag.

Where to put that in the code?
Wortexx is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 04-03-2020 , 11:14   Re: [CS 1.6] How to make plugin only for VIP
Reply With Quote #4

try this:

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <VIPSystem>
#include <hamsandwich>
#include <fakemeta>
#include <fun>

new gCvarArmor;
new 
gCvarAmount;
new 
kill_healedhealth_addhealth_hs_addhealth_maxnKillernKiller_hpnHp_addnHp_max

public plugin_init() {
    
register_plugin("hpperkill_and_armor""1.0""Wortexx");
    
register_event("DeathMsg","death","ae")
    
    
gCvarArmor register_cvar"sv_armor""2" );
    
gCvarAmount register_cvar"sv_armor_amount""100" );
    
    
kill_healed register_cvar("amx_killhealed""1")
    
health_add register_cvar("amx_hp""15")
    
health_hs_add register_cvar("amx_hp_hs""20")
    
health_max register_cvar("amx_hp_max""200")
    
    
RegisterHamHam_Spawn"player""fwdPlayerSpawn");
}

public 
fwdPlayerSpawnid ) {
    if( 
is_user_aliveid ) && get_user_flags(id) & ADMIN_LEVEL_H) {
        new 
iPluginArmorType clampget_pcvar_numgCvarArmor ), 0);
        
        if( 
iPluginArmorType ) {
            new 
CsArmorType:iPlayerArmorType;
            new 
iPlayerAmount cs_get_user_armoridiPlayerArmorType );
            new 
iPluginAmount minget_pcvar_numgCvarAmount ), 0xFF );
            
            
cs_set_user_armoridmaxiPluginAmountiPlayerAmount ), CsArmorType:maxiPluginArmorType_:iPlayerArmorType ) );
        }
    }
}

public 
death()
{
    if(
get_pcvar_num(kill_healed)!=1) return;
    
    
// Killer id
    
nKiller read_data(1)
    
    if(~
get_user_flags(nKiller) & ADMIN_LEVEL_H) return;
    
    
// Change HP Amount when made a Head Shot
    
if (read_data(3)==&& read_data(5)==0)
        
nHp_add get_pcvar_num(health_hs_add)
    else
        
nHp_add get_pcvar_num(health_add)
    
    
// Updating Killer HP
    
nHp_max get_pcvar_num (health_max)
    
nKiller_hp get_user_health(nKiller) + nHp_add
    
    
// Check Maximum HP
    
if (nKiller_hp nHp_maxnKiller_hp nHp_max
    set_user_health
(nKillernKiller_hp)
    
    
// Hud message "Healed +15/+20 hp"
    
set_hudmessage(02550, -1.00.1501.01.00.10.1, -1)
    
show_hudmessage(nKiller,"Healed +%d HP",nHp_add)
    
    
// Screen fading
    
message_begin(MSG_ONE,get_user_msgid("ScreenF ade"),{0,0,0},Killer)
    
write_short(1<<10)
    
write_short(1<<10)
    
write_short(0x0000)
    
write_byte(0// red
    
write_byte(0// green
    
write_byte(200// blue
    
write_byte(75// alpha
    
message_end()

__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
Wortexx
Member
Join Date: Apr 2020
Location: Serbia
Old 04-03-2020 , 12:28   Re: [CS 1.6] How to make plugin only for VIP
Reply With Quote #5

Thank you brother it works perfectly.
Wortexx is offline
Wortexx
Member
Join Date: Apr 2020
Location: Serbia
Old 04-04-2020 , 11:21   Re: [CS 1.6] How to make plugin only for VIP
Reply With Quote #6

Just one more question. Does "ADMIN_LEVEL_H" represent flag h?
Wortexx is offline
Xalus
Veteran Member
Join Date: Dec 2009
Location: Belgium
Old 04-04-2020 , 11:28   Re: [CS 1.6] How to make plugin only for VIP
Reply With Quote #7

; t - custom level H

"t"
__________________
Retired.
Xalus is offline
alferd
Veteran Member
Join Date: Dec 2019
Location: Iran is Always Eternal
Old 04-04-2020 , 11:28   Re: [CS 1.6] How to make plugin only for VIP
Reply With Quote #8

Quote:
Originally Posted by Wortexx View Post
Just one more question. Does "ADMIN_LEVEL_H" represent flag h?
ADMIN_LEVEL_H = Flag: t
alferd is offline
Wortexx
Member
Join Date: Apr 2020
Location: Serbia
Old 04-04-2020 , 11:32   Re: [CS 1.6] How to make plugin only for VIP
Reply With Quote #9

Can I see is any other plugin connected to flag h, because I am going to give the plugin to all vips.
Wortexx is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 04-04-2020 , 12:03   Re: [CS 1.6] How to make plugin only for VIP
Reply With Quote #10

Quote:
Originally Posted by Wortexx View Post
Can I see is any other plugin connected to flag h, because I am going to give the plugin to all vips.
users.ini file
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
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 06:51.


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