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

pev_frags crashing after update, either my code is bad


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
seriousspot
BANNED
Join Date: Mar 2013
Location: Lithuania / Norway
Old 08-18-2013 , 15:36   pev_frags crashing after update, either my code is bad
Reply With Quote #1

crash dump:

Quote:
Uploading dump (in-process) [proxy '']
/tmp/dumps/crash_20130818233030_1.dmp
success = yes
response: CrashID=bp-399c0ee9-1330-4879-bd54-1ce752130818
Segmentation fault
version:

Quote:
version
Protocol version 48
Exe version 1.1.2.7/Stdio (cstrike)
Exe build: 10:03:21 Aug 8 2013 (6132)
meta list:

Quote:
meta list
Currently loaded plugins:
description stat pend file vers src load unlod
[ 1] AMX Mod X RUN - amxmodx_mm_i386. v1.8.3-d ini Start ANY
[ 2] Fun RUN - fun_amxx_i386.so v1.8.3-d pl1 ANY ANY
[ 3] CStrike RUN - cstrike_amxx_i38 v1.8.3-d pl1 ANY ANY
[ 4] CSX RUN - csx_amxx_i386.so v1.8.3-d pl1 ANY ANY
[ 5] Ham Sandwich RUN - hamsandwich_amxx v1.8.3-d pl1 ANY ANY
[ 6] FakeMeta RUN - fakemeta_amxx_i3 v1.8.3-d pl1 ANY ANY
[ 7] Engine RUN - engine_amxx_i386 v1.8.3-d pl1 ANY ANY
7 plugins, 7 running
meta version:

Quote:
meta version
Metamod v1.21-am 2013-03-15 (5:13)
by Will Day <[email protected]>
http://www.metamod.org/
compiled: Mar 15 2013, 150:22 -0500 (optimized)

code:

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


global pcvar alive_t_frag cached on hltv round start event

function public event_alive_frags_t () called when terrorist win or in hostiges not resqued txt hooked events, any ideas?

Last edited by seriousspot; 08-18-2013 at 15:36.
seriousspot is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 08-18-2013 , 15:42   Re: pev_frags crashing after update, either my code is bad
Reply With Quote #2

Nothing to do with game update, your code is bad.

The loop way shouldn't be used, because with those kind of loops, you need to check if each players is connected, this is the thing you don't check and when you try to retrieve pdata, it generates errors or crashes.

Anyway, use get_players, so you can retrieve a list of connected players, and if you use filters, you can retrieve all TERRORIST at once.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
seriousspot
BANNED
Join Date: Mar 2013
Location: Lithuania / Norway
Old 08-18-2013 , 15:47   Re: pev_frags crashing after update, either my code is bad
Reply With Quote #3

Quote:
Originally Posted by ConnorMcLeod View Post
Nothing to do with game update, your code is bad.

The loop way shouldn't be used, because with those kind of loops, you need to check if each players is connected, this is the thing you don't check and when you try to retrieve pdata, it generates errors or crashes.

Anyway, use get_players, so you can retrieve a list of connected players, and if you use filters, you can retrieve all TERRORIST at once.
WRONG - theres nothing todo with loop, my method - get_maxplayers is more efficient than get_players since i cached all events for each index in right events also get_players sometimes returning false values, this only small part of the code, i am using like 9 loops per all code, have no crashes, rock stable 24/7.

Last edited by seriousspot; 08-18-2013 at 15:48.
seriousspot is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 08-18-2013 , 15:48   Re: pev_frags crashing after update, either my code is bad
Reply With Quote #4

Quote:
Originally Posted by seriousspot View Post
WRONG - theres nothing todo with loop, my method - get_maxplayers is more effiecient than get_players since i cached all events for each index in right events also get_players sometimes returning false values, this only small part of the code, i am using like 9 loops per all code, have no crashes, rock stable 24/7.
Then it is fine, what was your thread about ?
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
seriousspot
BANNED
Join Date: Mar 2013
Location: Lithuania / Norway
Old 08-18-2013 , 15:50   Re: pev_frags crashing after update, either my code is bad
Reply With Quote #5

Quote:
Originally Posted by ConnorMcLeod View Post
Then it is fine, what was your thread about ?
i am not expierenced in fakemeta, i think there's something wrong i did with it.
seriousspot is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 08-18-2013 , 15:55   Re: pev_frags crashing after update, either my code is bad
Reply With Quote #6

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);
        }
    }

__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
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
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 08-19-2013 , 00:37   Re: pev_frags crashing after update, either my code is bad
Reply With Quote #8

This is your plugin, your job to benchmark if you don't believe me.

But suppose there are 10 players alive :

Your code : 10 * get_pdata_int calls
get_players : 1 * get_players
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
r0ck
Senior Member
Join Date: Jun 2011
Location: India
Old 08-19-2013 , 11:37   Re: pev_frags crashing after update, either my code is bad
Reply With Quote #9

About get_players ConnorMcLeod , I have experience a lot of false returns .. So ( In my PLugin ) i had to remove all get_players with get_maxplayers with loop... (never bugged after that)
I have read a lot that get_players is efficient but it returns false results

The interesting part is this once it bugs ( returns false results ) it doesnt work till we dont restart server, map restart also doesnt works.

I have only checked get_players with team check , maybe thats what it bugs it ?
Can the reason be multimods ? Running different mods in a server ...
__________________
Preparing to release my plugins..
r0ck is offline
dFF
sıɹɹoɥɔ ʞɔnu
Join Date: Oct 2009
Old 08-19-2013 , 11:46   Re: pev_frags crashing after update, either my code is bad
Reply With Quote #10

@r0ck, you was used get_players in zombie mod ? Explain better (with some code example if you can) what is the problem exactly.
Maybe sometimes get_players with team-flag can result wrong in zombie mod, because zombiemod change team a lot of times and can't be updately instantly.. or somethings like this (with some private datas, scoreboard, etc.).

Last edited by dFF; 08-19-2013 at 11:47.
dFF is offline
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 03:44.


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