Quote:
Originally Posted by ConnorMcLeod
Look how this :
PHP Code:
public event_alive_frags_t () { if (is_game_started == false) { return 1 } if (is_game_started == true) { for (integer = 1; integer <= cache_maxplayers; integer += 1) { new id = integer if (get_pdata_int(id, pdata_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(id, pev_frags, frags) set_pev(id, pev_frags, frags + 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], count, id get_players(players, count, "ae", "TERRORIST") for(--count; count>=0; count--) { id = players[ count ]; set_user_frags(id, get_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 = 1; integer <= cache_maxplayers; integer += 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(id, pdata_team_offset) == TEAM_TERRORIST) {
static Float:frags
pev(id, pev_frags, frags)
set_pev(id, pev_frags, frags + 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) ?