Raised This Month: $ Target: $400
 0% 

Adding HP (don't know how to call this properly)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Unkolix
Veteran Member
Join Date: Sep 2012
Old 02-27-2013 , 13:52   Adding HP (don't know how to call this properly)
Reply With Quote #1

I have this code:
PHP Code:
public hook_death()
{
    
// Killer id
    
nKiller read_data(1)
    if(
is_user_alive(nKiller)) 
    {
        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)
        
nHp_max get_pcvar_num (health_max)
        
// Updating Killer HP
        
if(!(get_user_flags(nKiller) & ADMIN_LEVEL_H))
        return;
    
        
nKiller_hp get_user_health(nKiller)
        
nKiller_hp += nHp_add
        
// Maximum HP check
        
if (nKiller_hp nHp_maxnKiller_hp nHp_max
        set_user_health
(nKillernKiller_hp)
        
// Hud message "Healed +15/+30 hp"
        
if(nKiller_hp nHp_max)
        {
            
set_hudmessage(02550, -1.00.1501.01.00.10.1, -1)
            
show_hudmessage(nKiller"Healed +%d hp"nHp_add)
        }
        
// Screen fading
        
if(!is_user_flashed(nKiller)) //Checks if user is not flashed
        
{
            
message_begin(MSG_ONEget_user_msgid("ScreenFade"), {0,0,0}, nKiller)
            
write_short(1<<10)
            
write_short(1<<10)
            
write_short(0x0000)
            
write_byte(0)
            
write_byte(0)
            
write_byte(200)
            
write_byte(75)
            
message_end()
        }
    }

And when hud message is sent, f.e. if you have 90 hp (maximum is 100) and you kill someone it still shows that you got 15 HP, but you got only 10... (30hp if kill with head shot). So... I can't figure out how should I do that.

I am thinking of getting user health, then adding nHp_add and - 100? But I believe that I might get lots of errors... If someone can do it, please do it

Last edited by Unkolix; 02-27-2013 at 14:06.
Unkolix is offline
wizz
Member
Join Date: Mar 2010
Old 02-27-2013 , 14:38   Re: Adding HP (don't know how to call this properly)
Reply With Quote #2

Quote:
Originally Posted by Unkolix View Post
I have this code:
PHP Code:
public hook_death()
{
    
// Killer id
    
nKiller read_data(1)
    if(
is_user_alive(nKiller)) 
    {
        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)
        
nHp_max get_pcvar_num (health_max)
        
// Updating Killer HP
        
if(!(get_user_flags(nKiller) & ADMIN_LEVEL_H))
        return;
    
        
nKiller_hp get_user_health(nKiller)
        
nKiller_hp += nHp_add
        
// Maximum HP check
        
if (nKiller_hp nHp_maxnKiller_hp nHp_max
        set_user_health
(nKillernKiller_hp)
        
// Hud message "Healed +15/+30 hp"
        
if(nKiller_hp nHp_max)
        {
            
set_hudmessage(02550, -1.00.1501.01.00.10.1, -1)
            
show_hudmessage(nKiller"Healed +%d hp"nHp_add)
        }
        
// Screen fading
        
if(!is_user_flashed(nKiller)) //Checks if user is not flashed
        
{
            
message_begin(MSG_ONEget_user_msgid("ScreenFade"), {0,0,0}, nKiller)
            
write_short(1<<10)
            
write_short(1<<10)
            
write_short(0x0000)
            
write_byte(0)
            
write_byte(0)
            
write_byte(200)
            
write_byte(75)
            
message_end()
        }
    }

And when hud message is sent, f.e. if you have 90 hp (maximum is 100) and you kill someone it still shows that you got 15 HP, but you got only 10... (30hp if kill with head shot). So... I can't figure out how should I do that.

I am thinking of getting user health, then adding nHp_add and - 100? But I believe that I might get lots of errors... If someone can do it, please do it
try this
set_user_health(id, get_user_health(id)+50)

+50 = Adding +50hp you can change this
wizz is offline
naven
Veteran Member
Join Date: Jun 2008
Location: Poland, Cieszyn
Old 02-27-2013 , 17:46   Re: Adding HP (don't know how to call this properly)
Reply With Quote #3

btw.
if (nKiller_hp > nHp_max) nKiller_hp = nHp_max

if nHp_max is 100 it should be
if (nKiller_hp >= nHp_max) nKiller_hp = nHp_max
__________________
naven.com.pl
"At the end of the day, there are always going to be mental disorders and people who cause violence for no other reason than the fact that they're fucked up and lost. And all we can do is try to learn from it." Corey Taylor.

Last edited by naven; 02-27-2013 at 17:46.
naven is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 02-28-2013 , 00:37   Re: Adding HP (don't know how to call this properly)
Reply With Quote #4

Quote:
Originally Posted by naven View Post
btw.
if (nKiller_hp > nHp_max) nKiller_hp = nHp_max

if nHp_max is 100 it should be
if (nKiller_hp >= nHp_max) nKiller_hp = nHp_max
NO, was fine.


Show your full code, this plugin contains some useless stuff.
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 02-28-2013 at 00:40.
ConnorMcLeod is offline
Unkolix
Veteran Member
Join Date: Sep 2012
Old 02-28-2013 , 00:58   Re: Adding HP (don't know how to call this properly)
Reply With Quote #5

Useless? It might be
PHP Code:
/* Plugin generated by AMXX-Studio 
    Original creator: Dunn0
    Remade by: Unkolix
    
    Known bugs/glitches:
    When you are not fully flashed and you kill someone, due to this plugin you will have 
    blue fading screen and the flash (not full flashed) effect will disappear.
    Shield bug.
    
    Changelog by me, Unkolix:
    v5.2.1 - Not using stripweapons include anymore, just to get rid of that shield bug.
    v5.2 - Several fixes, optimization. New cvar to control if only VIP's can pick up snipers.
    v5.1 - Fixed shield bug.
    v5.0 - Multi-lingual added!
    v4.9.2 - New cvar, awp_active. 1 - VIP can get AWP choice; 0 - cann't
    v4.9.1 - AWP choice improvement. New Cvar, awp_menu_round, set the round from which VIP can see AWP choice.
    v4.8 - Fixed VIP menu dilsplay after player death. Thanks to vitorrossi.
    v4.7 - Fixed fading bug/glitch that was removing flashbang effect. Thanks to ConnorMcLeod.
    v4.6 - Fixed log error. Thanks to wickedd.
    v4.5 - OPTIMISATION, thanks to Backstabnoob.
    v4.4 - New Cvars awp_ct and awp_tr, how mant counter-terrorists and terrorists must be in each team to get AWP choice in VIP menu
    v4.3 - New feature, AWP only from sertain amount of players. Thanks to Emp`.
    v4.2 - Added new Cvar, vip_menu_uses. Thanks to Erox902.
    v4.1 - mapnames and awpmapnames consts are now readed from 2 files, awpmanames.ini and mapnames.ini. Thanks to fysiks.
    v4.0 - New feature, awp an't be used in maps that are mentioned in awpmapnames const. UPDATE: awpmapnames.ini
    v3.9 - Added new menu item, AWP.
    v3.8 - Improved v3.7 update. Thanks to Bugsy.
    v3.7 - New feature, VIP menu can't be shown on maps which are listed in mapnames const. UPDATED: mapnames.ini
    v3.6 - Small part is rewrited with drekes help, he made stripweapons.inc
    v3.5 - Fixed triple VIP message. Thanks jimaway!
    v3.4 - Fixed a bug/glitch which didn't let player to have AWP, even on awp maps! Now, they can't buy it, but if they find it, they can have it.
    v3.3 - Completely remade menu
    v3.2 - Fixed a bug/glitch when all VIP players was getting defuse kit on all maps. Now only on maps which has bombsites and only for CT. Thanks ConnorMcLeod
    v3.1 -  Added commands to call VIP menu. Thanks Stereo!
    
    Changelog by original author Dunn0:
    Updates on 3.0version
    Granates bug fixed, give it when round starts only. Removed hamsandwich module becouse i removed event witch was usualess.
    
    Updates on 2.06version
    Fixed C4 Planting just need'ed remove 1 simbol... Remove'd AWP pick up now only VIP can buy awp and non VIP can pick up it from ground. Fixed Bug whit menu was giving in first round I changed some events and it works just fine.
    
    Updates on 2.05version
    Was not working /wantvip , /vips command it got fixed. Was removed "pickup_active 1" cvar (couse was to much commands in registrations. Was removed some useless commands. Now changed that Only VIPS can buy awp weapons but normal players can pick up awp if VIPS drop it.
    
    Updates on 2.04version
    Menu Fixed now it always shows only from 3rd round. Nades , armor will give when u spawn not from round start. Some small fixes on Event_curweapons. 
    Add cvar pickup_active 1 so now if u write pickup_active 0 not vips will can pick up AWP weapons just wont be able to buy.
    
    Updated at 2.03version
    Repaired C4 bug now u can plant it
    
    Updated at 2.02version
    Repaired C4 bug
    
    UPDATE's at 2.01version
    Well i add'ed 2 new cvar's becouse people was asking it
    First is "menu_active 1" so now u can turn off menu when u will one.
    Second is "sniper_active 1" well if u will do it 0 all people will can buy awp.
*/

#define DAMAGE_RECIEVED
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fakemeta>
#include <fakemeta_util>
#include <hamsandwich>
#include <fun>
#include <colorchat>


#define MAXPLAYERS 32 + 1
static const COLOR[] = "^x04" //green
static const CONTACT[] = ""
const m_flFlashedUntil 514
new maxplayers
new gmsgSayText
new mpdmkbmhb
new health_addhealth_hs_addhealth_max
new nKillernKiller_hpnHp_addnHp_max
new g_sniper_activeg_menu_activeg_map_activeg_awp_activeawp_active
new g_menu_usesg_awp_ctg_awp_trg_menu_roundg_awp_menu_roundg_sniper_pickup
new map_activeCTTRmenu_roundawp_menu_roundmenu_uses
new CurrentRound
new bool:g_bHasBombSite;
new 
bool:g_freezetime
new bool:bAwpMap false
new gMenuUsed[33]
new 
g_iMenuiNewMenuId
new bool:g_bCurrentMapIsInList false
new 
bool:g_bCurrentAWPMapIsInList false;
const 
m_flFlashDuration 517;
new 
iTCountiCTCount;
new 
g_MsgSync
#if defined DAMAGE_RECIEVED
new g_MsgSync2
#endif
#define find_ent_by_class(%1,%2) engfunc(EngFunc_FindEntityByString, %1, "classname", %2)
new const vipmenu[][] =
{
    
"say /vipmenu""say vipmenu""say_team /vipmenu""say_team vipmenu""say vmenu""say_team vmenu"   //Commands to call VIP menu

new const 
VIPweapons[][] =
{
    
"awp""sg550""g3sg1" //Weapons which normal players can't pick up.
}

public 
plugin_init()
{
    
register_plugin("VIP""5.2.1""Unkolix")
    
mpd register_cvar("money_per_damage","3"//How many $ VIP will get per 1 damage 
    
mkb register_cvar("money_kill_bonus","200"//How many $ VIP will get per kill
    
mhb register_cvar("money_hs_bonus","500"//How many $ VIP will get per head shot kill 
    
health_add register_cvar("amx_vip_hp""15"//How many hp VIP will get per kill 
    
health_hs_add register_cvar("amx_vip_hp_hs""30"//How many hp VIP will get per head shot kill 
    
health_max register_cvar("amx_vip_max_hp""100"//How many hp VIP can have in total 
    
g_sniper_active register_cvar("sniper_active""1"//Who can buy SNIPERS? 0 - everyone, 1 - only VIP
    
g_menu_active register_cvar("menu_active""1"//Will VIP get VIP menu? 0 - won't get the menu, 1 - will get the menu.
    
g_map_active register_cvar("map_active""1"//VIP menu works on the maps in mapnames.ini? 0 - Yes (VIP will get VIP menu), 1 - No
    
g_awp_active register_cvar("awp_active""1"// 1 - VIP can get AWP choice; 0 - cann't
    
g_menu_uses register_cvar("vip_menu_uses""1"// How many times VIP can use VIP menu per round?
    
g_awp_ct register_cvar("awp_ct""5"//How many counter terrorist must be in a team to AWP choice show up
    
g_awp_tr register_cvar("awp_tr""5"//How many terrorist must be in a team to AWP choice show up
    
g_menu_round register_cvar("menu_round""2"//Round from which VIP will get VIP menu
    
g_awp_menu_round register_cvar("awp_menu_round""3"//Round from which VIP will get AWP choice
    
g_sniper_pickup register_cvar("sniper_pickup""1"//0 - everyone can pickup snipers, 1 - only VIP
    
gmsgSayText get_user_msgid("SayText")
    
g_MsgSync CreateHudSyncObj()
    
#if defined DAMAGE_RECIEVED
    
g_MsgSync2 CreateHudSyncObj()
    
#endif
    
maxplayers get_maxplayers() //Gets servers maxplayer slots
    
RegisterHam(Ham_Spawn"player""fwHamPlayerSpawnPost"1//Player spawn
    
RegisterHam(Ham_Killed"player""PlayerDies"1//0 = before death 1 = after 
    
register_logevent("LogEvent_GameCommencing"2"0=World triggered""1=Game_Commencing")  //Game commencing event
    
register_logevent("LogEvent_RoundStart"2"1=Round_Start" ); //Round start event
    
register_logevent"EventRoundEnd"2"1=Round_End" ); //Round end event
    
for(new 0sizeof vipmenui++)
    
register_clcmd(vipmenu[i], "cmdvipmenu"//Checks const vipmenu, that is above plugin_init
    
for(new 0sizeof VIPweaponsi++)
    
register_clcmd(VIPweapons[i], "HandleCmd"//Checks const VIPweapons, that is above plugin_init
    
register_clcmd("say /wantvip""ENShowMotd"//When player types /wantvip he gets enlish motd
    
register_clcmd("say /noriuvip""LTShowMotd"//When player types /wantvip he gets lithuanian motd
    
register_clcmd("say /volouirvip""ENShowMotd"//When player types /wantvip he gets english motd
    
register_clcmd("say /chiechvip""ENShowMotd"//When player types /wantvip he gets english motd
    
register_clcmd("say /vips","print_adminlist"//If someone says /vips it starts the function print_adminlist
    
register_event("HLTV""event_new_round""a""1=0""2=0")  //New round event
    
register_event("TextMsg","Event_RoundRestart","a","2&#Game_w"//Round restart event
    
register_event("CurWeapon""Event_CurSnipers""be""1=1"//Drops users snipers if map is not in mapnames.ini and sniper_pickup is 1
    
register_event("DeathMsg""hook_death""a""1>0")  
    
register_event("Damage""on_damage""b""2!0""3=0""4!0")
    
register_event("Damage","Damage","b")
    
register_event("DeathMsg","death_msg","a")
    
register_cvar("amx_contactinfo"CONTACTFCVAR_SERVER)
    if( 
find_ent_by_class(-1"func_bomb_target") || find_ent_by_class(-1"info_bomb_target") ) //Checks if the map has bombsite
    
{
        
g_bHasBombSite true//If the map has bombsite it is set to true
    
}
    
get_user_msgid("ScreenFade")
    
register_dictionary_colored"vip.txt" );
}
public 
plugin_cfg()
{
    
map_active get_pcvar_num (g_map_active//Gets the value of g_map_active 
    
awp_active get_pcvar_num (g_awp_active//Gets the value of g_awp_active 
    
CT get_pcvar_num (g_awp_ct//Gets the value of g_awp_ct
    
TR get_pcvar_num (g_awp_tr//Gets the value of g_awp_tr
    
menu_round get_pcvar_num (g_menu_round)
    
awp_menu_round get_pcvar_num (g_awp_menu_round)
    
menu_uses get_pcvar_num (g_menu_uses)
    new 
szmapnames[128], szData[32], szCurrentMap[32], szawpmapnames[128];
    
get_configsdir(szmapnamescharsmax(szmapnames)); // Get the AMX Mod X configs directory (folder). 
    
add(szmapnamescharsmax(szmapnames), "/mapnames.ini"); // Add your filename to the filepath. 
    
get_mapname(szCurrentMapcharsmax(szCurrentMap)); // Get the current map. 
     
    
new fopen(szmapnames"rt"); // Open the file. 
    
while( !feof(f) ) // Loop until it finds the End Of the File (aka EOF). 
    

        
fgets(fszDatacharsmax(szData)); // Get all text from current line.
        
trim(szData); // Trim off the new line and carriage return characters.
        
if( containi(szCurrentMapszData) != -)   // Check if the current map is equal to the map listed on this line. 
        

            
g_bCurrentMapIsInList true// Set boolean to true so that you know if the map was in the file. 
            
break; // Stop looping (reading the file) because you found what you came for. 
        

    } 
    
fclose(f); // Close the file.

    //Now lets check if current map is in awpmapnames.ini
    
get_configsdir(szawpmapnamescharsmax(szawpmapnames)); // Get the AMX Mod X configs directory (folder). 
    
add(szawpmapnamescharsmax(szawpmapnames), "/awpmapnames.ini"); // Add your filename to the filepath. 
    
get_mapname(szCurrentMapcharsmax(szCurrentMap)); // Get the current map. 
    
    
fopen(szawpmapnames"rt"); // Open the file. 
    
while( !feof(f) ) // Loop until it finds the End Of the File (aka EOF). 
    

        
fgets(fszDatacharsmax(szData)); // Get all text from current line. 
        
trim(szData); // Trim off the new line and carriage return characters. 
        
if( containi(szCurrentMapszData) != -)   // Check if the current map is equal to the map listed on this line. 
        

            
g_bCurrentAWPMapIsInList true// Set boolean to true so that you know if the map was in the file. 
            
break; // Stop looping (reading the file) because you found what you came for. 
        

    } 
    
fclose(f); // Close the file.
}
public 
on_damage(id)
{
    new 
attacker get_user_attacker(id)
    
    
#if defined DAMAGE_RECIEVED
    
if ( is_user_connected(id) && is_user_connected(attacker) )
        if (
get_user_flags(attacker) & ADMIN_LEVEL_H)
        {
            new 
damage read_data(2)
        
            
set_hudmessage(255000.450.5020.14.00.10.1, -1)
            
ShowSyncHudMsg(idg_MsgSync2"%i^n"damage)
            
#else
            
if ( is_user_connected(attacker) && if (get_user_flags(attacker) & ADMIN_LEVEL_H) )
            {
                new 
damage read_data(2)
                
#endif
                
set_hudmessage(0100200, -1.00.5520.14.00.020.02, -1)
                
ShowSyncHudMsg(attackerg_MsgSync"%i^n"damage)
            }
        }
public 
death_msg()
{
    if(
read_data(1)<=maxplayers && read_data(1) && read_data(1)!=read_data(2)) cs_set_user_money(read_data(1),cs_get_user_money(read_data(1)) + get_pcvar_num(mkb) - 300)
}
public 
Damage(id)
{
    new 
weaponhitpointattacker get_user_attacker(id,weapon,hitpoint)
    if(
attacker<=maxplayers && is_user_alive(attacker) && attacker!=id)
    if (
get_user_flags(attacker) & ADMIN_LEVEL_H
    {
        new 
money read_data(2) * get_pcvar_num(mpd)
        if(
hitpoint==1money += get_pcvar_num(mhb)
        
cs_set_user_money(attacker,cs_get_user_money(attacker) + money)
    }
}
public 
event_new_round(id)
{
    
g_freezetime false;
}
is_user_flashedid )
{
    return 
get_gametime() < get_pdata_float(idm_flFlashedUntil)
}
public 
LogEvent_RoundStart(id)
{
    
g_freezetime true;
    
gMenuUsed[id] = 0;
    
iTCount 0;
    
iCTCount 0;
    
CurrentRound++;
    new 
players[32], playerpnum
    
get_players(playerspnum"a");
    for ( new 
ipnumi++ )
    {
        switch( 
cs_get_user_teamplayers[i] ) )
        {
            case 
CS_TEAM_TiTCount++;
            case 
CS_TEAM_CTiCTCount++;
        }
    }
    for(new 
0pnumi++)
    {
        
player players[i];
        if (!
get_pcvar_num(g_menu_active))
            return 
PLUGIN_CONTINUE
        
        
if( CurrentRound >= menu_round && get_user_flags(id) & ADMIN_LEVEL_H )
        {
            
Showrod(player);
        }
    }
    return 
PLUGIN_CONTINUE
}
public 
fwHamPlayerSpawnPost(id)
{
    
gMenuUsed[id] = 0//Make sure that VIP didn't use VIP menu on his spawn
    
if(!g_bCurrentMapIsInList && is_user_alive(id) && get_user_flags(id) & ADMIN_LEVEL_H//Checks if map is not the one written in mapnames.ini, if user is alive and if e has flag H
    
{
        
give_item(id"weapon_hegrenade"); //Gives HE grenade
        
give_item(id"weapon_flashbang"); //Gives FB grenade
        
give_item(id"weapon_flashbang"); //Gives BF grenade
        
give_item(id"weapon_smokegrenade"); //Gives SG grenade
        
give_item(id"item_assaultsuit"); //Gives armor
        
if(g_bHasBombSite//Checks if current map has bombsite
        
{
            
give_item(id"item_thighpack"); //Gives defuse kit
        
}
    }
}
public 
Event_RoundRestart(id)
{
    
CurrentRound=0;
    
player_menu_info(idg_iMenuiNewMenuId
    if( 
g_iMenu|| iNewMenuId!= -
    { 
        
show_menu(id0"^n"1);
    }
}
public 
LogEvent_GameCommencing(id)
{
    
CurrentRound=0;
    
player_menu_info(idg_iMenuiNewMenuId
    if( 
g_iMenu|| iNewMenuId!= -
    { 
        
show_menu(id0"^n"1);
    }
}
public 
EventRoundEnd(id)
{
    
player_menu_info(idg_iMenuiNewMenuId
    if( 
g_iMenu|| iNewMenuId!= -
    { 
        
show_menu(id0"^n"1);
    }
}
public 
PlayerDies(id)
{
    
player_menu_info(idg_iMenuiNewMenuId
    if( 
g_iMenu|| iNewMenuId!= -
    { 
        
show_menu(id0"^n"1);
    }
}
public 
cmdvipmenu(id
{
    if ( 
is_user_alive(id) )
    {
        if (
get_user_flags(id) & ADMIN_LEVEL_H//Checks if player has flag H
        
{
            if ( 
CurrentRound menu_round )
            {
                
client_printidprint_center"%L"id"VIP_MENU_ROUND"menu_round ); //Sends a message that VIP can use VIP menu only from specific round
            
}
            if ( 
map_active == //Checks if map_active is 1
            
{
                if( 
g_bCurrentMapIsInList //Checks if current map is in mapnames list
                
{
                    
client_printidprint_center"%L"id"VIP_MENU_WRONG_MAP" ); //Sends a message that VIP can't use VIP menu on that map
                
}
            }
            if ( 
gMenuUsed[id] >= menu_uses )
            {
                
client_printidprint_center"%L"id"VIP_MENU_PER_ROUND"menu_uses ); //Message that VIP can only take VIP menu few time that is set as VIPUsed
            
}
            if ( !
g_freezetime //Checks if freezetime is not over yet and if user is alive and he has flag H
            
{
                
client_printidprint_center"%L"id"VIP_MENU_ONLY_FROM_ROUND_START" ); //Message that's set in vipplugin.txt as VIP_MENU_ONLY_FROM_ROUND_START
            
}
            if(
g_freezetime//Checks if freezetime is over
            
{
                if ( 
gMenuUsed[id] < menu_uses //Checks if VIP has already used VIP menu before, the amount of times we set as VIPUsed 
                
{
                    if( 
CurrentRound >= menu_round //Checks if current round is more or equal to the round that is set as VIPMenuRound
                    
{    
                        if (!
get_pcvar_num(g_menu_active)) //Checks if g_menu_active is disactivated (set to 0)
                            
return PLUGIN_CONTINUE //If so, VIP won't get VIP menu
                        
Showrod(id//Shows VIP menu
                    
}
                }
            }
        }
        if (!(
get_user_flags(id) & ADMIN_LEVEL_H)) //Checks if user doesn't has flag H
        
{
            
PrintText(id//Sets a task in 0.1 seconds and starts PrintTect
        
}
    }
    if ( !
is_user_alive(id) && get_user_flags(id) & ADMIN_LEVEL_H //Checks if user is death and he has admin flag H
    
{
        
client_printidprint_center"%L"id"VIP_MENU_MUST_BE_ALIVE" ); //Sends a message that VIP must be alive to use VIP menu
    
}
    if (!
is_user_alive(id) && !(get_user_flags(id) & ADMIN_LEVEL_H)) //Checks if user doesn't has flag H
    
{
        
PrintText(id//Prints PrintText
    
}
    return 
PLUGIN_HANDLED;
}
public 
hook_death()
{
    
// Killer id
    
nKiller read_data(1)
    if(
is_user_alive(nKiller)) 
    {
        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)
        
nHp_max get_pcvar_num (health_max)
        
// Updating Killer HP
        
if(!(get_user_flags(nKiller) & ADMIN_LEVEL_H))
        return;
    
        
nKiller_hp get_user_health(nKiller)
        
nKiller_hp += nHp_add
        
// Maximum HP check
        
if (nKiller_hp nHp_maxnKiller_hp nHp_max
        set_user_health
(nKillernKiller_hp)
        
// Hud message "Healed +15/+30 hp"
        
if(nKiller_hp nHp_max)
        {
            
set_hudmessage(02550, -1.00.1501.01.00.10.1, -1)
            
show_hudmessage(nKiller"Healed +%d hp")
        }
        
// Screen fading
        
if(!is_user_flashed(nKiller)) //Checks if user is not flashed
        
{
            
message_begin(MSG_ONEget_user_msgid("ScreenFade"), {0,0,0}, nKiller)
            
write_short(1<<10)
            
write_short(1<<10)
            
write_short(0x0000)
            
write_byte(0)
            
write_byte(0)
            
write_byte(200)
            
write_byte(75)
            
message_end()
        }
    }
}
public 
Showrod(id)
{
    if (
get_user_flags(id) & ADMIN_LEVEL_H//Checks if player has flag H
    
{
        if (
map_active//Checks if map_active is 1
        
{
            if( 
g_bCurrentMapIsInList //Checks if current map is in mapnames.ini, if so print the message and cancels the menu showup
            
{
                
client_printidprint_center"%L"id"VIP_MENU_WRONG_MAP" ); //Sends a message that VIP can't use VIP menu on that map
                
return; //Stop VIP from getting the VIP menu
            
}
        }
        if( 
g_bCurrentAWPMapIsInList //Checks if map is in awpmapnames.ini
        
{
            
bAwpMap true //If so sets bAwpMap to true, so AWP choice would work in maps that are in awpmapnames.ini
        
}
        new 
newmenu[64], choice_1[64], choice_2[64], choice_3[64
        
format(newmenu64"%L"id"NEW_MENU"); //Shows a menu message that's set in vipplugin.txt as NEW_MENU_PRIMARY
        
g_iMenu menu_create(newmenu"Pressedrod"); //Creates menu that's in Pressedrod
        
        
format(choice_164"%L"id"MENU_CHOICE_1"); //Shows a menu message that's set in vipplugin.txt as MENU_CHOICE_PRIMARY_1
        
menu_additem(g_iMenuchoice_1"1"0); //Menu choice/case 1
        
format(choice_264"%L"id"MENU_CHOICE_2"); //Shows a menu message that's set in vipplugin.txt as MENU_CHOICE_PRIMARY_2
        
menu_additem(g_iMenuchoice_2"2"0); //Menu choice/case 2
        
if ( iTCount >= TR && iCTCount >= CT //Checks that each team has 5 or more people to AWP choice appear in the menu
        
{
            if (
awp_active == 1//Checks if vips can get awp choice, 0 - no; 1 - yes
            
{
                if ( 
CurrentRound >= awp_menu_round //Checks if current round is more or equal to 3, so AWP choice would come out
                
{
                    if( !
bAwpMap //Checks if map is not one in awpmapnames.xfg, if so shows the fifth menu item
                    
{
                        
format(choice_364"%L"id"MENU_CHOICE_3"); //Shows a menu message that's set in vipplugin.txt as MENU_CHOICE_PRIMARY_5
                        
menu_additem(g_iMenuchoice_3"3"0); //Menu choice/case 5
                    
}
                }
            }
        }        
        
menu_setprop(g_iMenuMPROP_EXITMEXIT_ALL);
        
menu_display(idg_iMenu0); //Displays the menu
    
}
}
public 
Pressedrod(idmenuitem)
{
    if( 
item == MENU_EXIT //Checks if player clicks menu exit (0)
    
{
        
menu_destroy(menu); //If so the menu will be destroyed
        
return PLUGIN_HANDLED;
    }
    new 
iFlashes cs_get_user_bpammoidCSW_FLASHBANG ); 
    new 
bool:HasC4[33], bool:HasHE[33], bool:HasSG[33]
    new 
data[6], szName[64];
    new 
accesscallback;
    
menu_item_getinfo(menuitemaccessdata,charsmax(data), szName,charsmax(szName), callback);
    new 
key str_to_num(data);
    switch(
key)
    {
    case 
1: {      
            if (
user_has_weapon(idCSW_C4) && get_user_team(id) == 1)
                
HasC4[id] = true;
            else
                
HasC4[id] = false;
                
            if (
user_has_weapon(idCSW_HEGRENADE))
                
HasHE[id] = true;
            else
                
HasHE[id] = false;    
            if (
user_has_weapon(idCSW_SMOKEGRENADE))
                
HasSG[id] = true;
            else
                
HasSG[id] = false;
                
            
strip_user_weaponsid );
            
give_item(id,"weapon_m4a1"//Gives M4A1
            
cs_set_user_bpammo(idCSW_M4A190); //Sets M4A1 back pack ammo to 90
            
give_item(id,"weapon_knife");
            
            if (
HasC4[id])
            {
                
give_item(id"weapon_c4");
                
cs_set_user_plantid );
            }
            if (
HasHE[id])
            {
                
give_item(id"weapon_hegrenade")
            }
            if (
HasSG[id])
            {
                
give_item(id"weapon_smokegrenade");
            }
            if( 
iFlashes 
            { 
                
give_itemid"weapon_flashbang" ); 
                
cs_set_user_bpammoidCSW_FLASHBANGiFlashes ); 
            } 
            
client_printidprint_center"%L"id"CHOSE_M4A1" ); //Shows a message that's set in vipplugin.txt as CHOSE_M4A1
        
}
    case 
2: {                     
            if (
user_has_weapon(idCSW_C4) && get_user_team(id) == 1)
                
HasC4[id] = true;
            else
                
HasC4[id] = false;
                
            if (
user_has_weapon(idCSW_HEGRENADE))
                
HasHE[id] = true;
            else
                
HasHE[id] = false;    
            if (
user_has_weapon(idCSW_SMOKEGRENADE))
                
HasSG[id] = true;
            else
                
HasSG[id] = false;
                
            
strip_user_weaponsid );
            
give_item(id,"weapon_ak47"//Gives AK47
            
cs_set_user_bpammo(idCSW_AK4790); //Sets AK47 back pack ammo to 90
            
give_item(id,"weapon_knife");
            
            if (
HasC4[id])
            {
                
give_item(id"weapon_c4");
                
cs_set_user_plantid );
            }
            if (
HasHE[id])
            {
                
give_item(id"weapon_hegrenade")
            }
            if (
HasSG[id])
            {
                
give_item(id"weapon_smokegrenade");
            }
            if( 
iFlashes 
            { 
                
give_itemid"weapon_flashbang" ); 
                
cs_set_user_bpammoidCSW_FLASHBANGiFlashes ); 
            } 
            
client_printidprint_center"%L"id"CHOSE_AK47" ); //Shows a message that's set in vipplugin.txt as CHOSE_AK47
        
}
    case 
3: { 
            if (
user_has_weapon(idCSW_C4) && get_user_team(id) == 1)
                
HasC4[id] = true;
            else
                
HasC4[id] = false;
                
            if (
user_has_weapon(idCSW_HEGRENADE))
                
HasHE[id] = true;
            else
                
HasHE[id] = false;    
            if (
user_has_weapon(idCSW_SMOKEGRENADE))
                
HasSG[id] = true;
            else
                
HasSG[id] = false;
                
            
strip_user_weaponsid );
            
give_item(id,"weapon_awp"//Gives AWP
            
cs_set_user_bpammo(idCSW_AWP30); //Sets AWP back pack ammo to 30
            
give_item(id,"weapon_knife");
            
            if (
HasC4[id])
            {
                
give_item(id"weapon_c4");
                
cs_set_user_plantid );
            }
            if (
HasHE[id])
            {
                
give_item(id"weapon_hegrenade")
            }
            if (
HasSG[id])
            {
                
give_item(id"weapon_smokegrenade");
            }
            if( 
iFlashes 
            { 
                
give_itemid"weapon_flashbang" ); 
                
cs_set_user_bpammoidCSW_FLASHBANGiFlashes ); 
            } 
            
client_printidprint_center"%L"id"CHOSE_AWP" ); //Shows a message that's set in vipplugin.txt as CHOSE_AWP
        
}
    }
    
give_item(id,"weapon_deagle"//Gives deagle
    
cs_set_user_bpammo(idCSW_DEAGLE35); //Sets deagle back pack ammo to 35
    
gMenuUsed[id]++ //Makes sure that VIP really made a choice
    
menu_destroy(menu); //Destroys menu
    
return PLUGIN_CONTINUE
}
public 
HandleCmd(id)
{
    if (!
get_pcvar_num(g_sniper_active)) //Checks if g_awp_active is disactivated (set to 0)
        
return PLUGIN_CONTINUE //If it is, let players buy snipers
    
if(get_user_flags(id) & ADMIN_LEVEL_H)  //Checks if player has flag H
        
return PLUGIN_CONTINUE 
    client_print
idprint_center"%L"id"SNIPER_ONLY_FOR_VIP" ); //Sends a message that snipers are only for VIP
    
return PLUGIN_HANDLED
}
public 
Event_CurSnipers(id)
{
    if(
g_sniper_pickup && !g_bCurrentMapIsInList//Checks if g_sniper_pickup is set to 1 and if current map is in list
    
{
        if(
read_data(2) == CSW_AWP)
        {
            if(!(
get_user_flags(id) & ADMIN_LEVEL_H))
            {
                
client_printidprint_center"%L"id"SNIPER_ONLY_FOR_VIP" ); //Sends a message that snipers are only for VIP
                
client_cmd(id"drop"//Drops AWP
            
}
        }
        if(
read_data(2) == CSW_SG550)
        {
            if(!(
get_user_flags(id) & ADMIN_LEVEL_H))
            {
                
client_printidprint_center"%L"id"SNIPER_ONLY_FOR_VIP" ); //Sends a message that snipers are only for VIP
                
client_cmd(id"drop"//Drops G3SG1
            
}
        }
        if(
read_data(2) == CSW_G3SG1)
        {
            if(!(
get_user_flags(id) & ADMIN_LEVEL_H))
            {
                
client_printidprint_center"%L"id"SNIPER_ONLY_FOR_VIP" ); //Sends a message that snipers are only for VIP
                
client_cmd(id"drop"//Drops SG550
            
}
        }
    }
    return 
PLUGIN_HANDLED
}
public 
ENShowMotd(id)
{
    
show_motd(id"envip.txt"//Shows the envip.txt file in a motd
}
public 
LTShowMotd(id)
{
    
show_motd(id"ltvip.txt"//Shows the ltvip.txt file in a motd
}
public 
client_putinserver(id)
{
    if (!
task_exists(id 1000)) set_task(30.0"PrintText"id 1000//Checks if task already exist, if not print text set in public PrintText
}
public 
PrintText(id)
{
    
client_print_coloridprint_chat"%L"id"PRINT_TEXT" ); //Message which is sent
}
public 
print_adminlist(user
{
    new 
adminnames[33][32]
    new 
message[256]
    new 
contactinfo[256], contact[112]
    new 
idcountxlen
    
    
for(id id <= maxplayers id++)
        if(
is_user_connected(id))
            if(
get_user_flags(id) & ADMIN_LEVEL_H)
                
get_user_name(idadminnames[count++], 31)
    
    
len format(message255"%L"id"VIPS_ONLINE"COLOR)
    if(
count 0) {
        for(
count x++) 
        {
            
len += format(message[len], 255-len" %s%s "adminnames[x], < (count-1) ? ", ":"")
            if(
len 96 
            {
                
print_message(usermessage)
                
len format(message255"%s ",COLOR)
            }
        }
        
print_message(usermessage)
    }
    else {
        
len += format(message[len], 255-len"%L"id"NO_VIPS_ONLINE")
        
print_message(usermessage)
    }
    
    
get_cvar_string("amx_contactinfo"contact63)
    if(
contact[0])  
    {
        
format(contactinfo111"%L"id"CONTACT_INFO"COLORcontact)
        
print_message(usercontactinfo)
    }
}
print_message(idmsg[]) 
{
    
message_begin(MSG_ONEgmsgSayText, {0,0,0}, id)
    
write_byte(id)
    
write_string(msg)
    
message_end()


Last edited by Unkolix; 02-28-2013 at 07:15.
Unkolix is offline
Old 03-01-2013, 13:06
Unkolix
This message has been deleted by ConnorMcLeod. Reason: read rules LAST WARNING
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 21:46.


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