BANNED
Join Date: Apr 2020
Location: Usa
|
![Old](images/statusicon/post_old.svg)
04-03-2020
, 10:59
[CS 1.6] How to make plugin only for VIP
|
#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.
|
|