Raised This Month: $ Target: $400
 0% 

even the odds mod can't compile. find my bugs please


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 06-17-2009 , 21:34   Re: even the odds mod can't compile. find my bugs please
Reply With Quote #7

Even if he add this line, nothing will change since players are not spawned yet when new round is called.

I would do it like this:
PHP Code:
#include <amxmodx>
#include <fun>
#include <hamsandwich>

#define MAX_LVLS 10
#define DIFF 5  // level = 4 + (kills-deaths)/DIFF
#define MAX_PLAYERS 32

new bool:g_freezetime
new g_max_hp[MAX_LVLS] =  {2502001501251008060403020}
new 
Float:g_speed_bonus[MAX_LVLS] = { 50.035.020.010.00.0, -10.0, -20.0, -30.0, -40.0, -50.0}
new 
Float:g_weap_speed[32] = {0.0250.00.0260.0250.0240.0250.0250.0240.0,
250.0250.0250.0250.0210.0240.0240.0250.0250.0210.0250.0220.0230.0,
230.0250.0210.0250.0250.0235.0221.0250.0245.00.0}
new 
g_p_lvl[MAX_PLAYERS 1]


public 
plugin_init() {
    
register_plugin("Even The Odds""1.0""Sylwester")
    
RegisterHam(Ham_Spawn"player""player_spawn"1)
    
register_event("CurWeapon""reset_player_speed""be""1=1")
    
register_event("HLTV""event_new_round""a""1=0""2=0")
    
register_logevent("logevent_round_start"2"1=Round_Start")
}


public 
reset_player_speed(id){
    if(
g_freezetime)
        return
    
set_user_maxspeed(idg_weap_speed[get_user_weapon(id)] + g_speed_bonus[g_p_lvl[id]])
}


public 
player_spawn(id){
    if(
is_user_alive(id)){
        
set_lvl(id)
        
set_user_health(idg_max_hp[g_p_lvl[id]])
    }
}


public 
set_lvl(id){
    if(!
is_user_connected(id))
        return
    
g_p_lvl[id] = (get_user_frags(id) - get_user_deaths(id))/DIFF 4
    
if(g_p_lvl[id] < 0)
        
g_p_lvl[id] = 0
    
if(g_p_lvl[id] > MAX_LVLS-1)
        
g_p_lvl[id] = MAX_LVLS-1
}


public 
event_new_round(){
    
g_freezetime true
}


public 
logevent_round_start(){
    
g_freezetime false

Store max hps and speed bonuses in some arrays. Update odds and set health on player spawn and set max speed on curweapon.
__________________
Impossible is Nothing

Last edited by Sylwester; 06-17-2009 at 21:36.
Sylwester is offline
 



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 15:36.


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