Raised This Month: $ Target: $400
 0% 

pev_frags crashing after update, either my code is bad


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
seriousspot
BANNED
Join Date: Mar 2013
Location: Lithuania / Norway
Old 08-18-2013 , 16:11   Re: pev_frags crashing after update, either my code is bad
Reply With Quote #7

Quote:
Originally Posted by ConnorMcLeod View Post
Look how this :

PHP Code:
public event_alive_frags_t () {
    if (
is_game_started == false) {
        return 
1
    
}
    
    if (
is_game_started == true) {
    
        for (
integer 1integer <= cache_maxplayersinteger += 1) {
            new 
id integer
            
            
if (get_pdata_int(idpdata_team_offset) == TEAM_TERRORIST && cache_is_connected[id] == true && cache_is_bot[id] == false && cache_is_hltv[id] == false && cache_is_alive[id] == true && is_game_runing == true) {
                static 
Float:frags
            
                pev
(idpev_fragsfrags)
                
set_pev(idpev_fragsfrags float(alive_t_frags))
            }
        }
    }
    return 
0

should look, and you gonna understand how get_players is better then 1 - maxplayers loops :

PHP Code:
public event_alive_frags_t ()
{
    if (
is_game_started )
    {
        new 
players[32], countid
        get_players
(playerscount"ae""TERRORIST")
        for(--
countcount>=0count--)
        {
            
id playerscount ];
            
set_user_frags(idget_user_frags(id) + alive_t_frags);
        }
    }

can you please post benchmarks wich is better? because the thing is this mean nothing to me, thanks


By the way figured out what was wrong, i take get user team statement from whole statement

PHP Code:
public event_alive_frags_t () {
    if (
is_game_started == false) {
        return 
1
    
}
    
    if (
is_game_started == true) {
    
        for (
integer 1integer <= cache_maxplayersinteger += 1) {
            new 
id integer
            
            
if (cache_is_connected[id] == true && cache_is_bot[id] == false && cache_is_hltv[id] == false && cache_is_alive[id] == true && is_game_runing == true) {
                if (
get_pdata_int(idpdata_team_offset) == TEAM_TERRORIST) {    
                
                    static 
Float:frags
                
                    pev
(idpev_fragsfrags)
                    
set_pev(idpev_fragsfrags float(alive_t_frags))
                    
                    
// Connors way
                    //set_user_frags(id, get_user_frags(id) + alive_t_frags)
                
}
            }
        }
    }
    return 
0

and theres another question, is there any diffrence between - get_pdata_int(id, pdata_team_offset) and get_user_team(id) ?

Last edited by seriousspot; 08-18-2013 at 16:12.
seriousspot 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:48.


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