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

Cache_UnlinkLRU: NULL link


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Randomize
BANNED
Join Date: May 2012
Location: in your heart
Old 09-13-2013 , 09:05   Cache_UnlinkLRU: NULL link
Reply With Quote #1

The CS crashed when someone change to the primary, Cache_UnlinkLRU: NULL link. What causes that?

PHP Code:
public cmd_backweapon(id)
{
    new 
players[32], playersnum
    get_players
(playersplayersnum"a")
    
    for (new 
playersnum ; ++i)
    {
        
backweapon[i] = create_entity("info_target")
        
entity_set_edict(backweapon[i], EV_ENT_owneri)
        
entity_set_edict(backweapon[i], EV_ENT_aimenti)
        
entity_set_int(backweapon[i], EV_INT_movetypeMOVETYPE_FOLLOW)
        
entity_set_model(backweapon[i], "models/backweapons.mdl")
    }

CurWeapon event:
PHP Code:
if (<< get_user_weapon(id) & OTHERS)
    {
        
set_pev(backweapon[id], pev_bodycurrent_weapon[id])
    }
    else
    {
        
set_pev(backweapon[id], pev_body0)
    } 
Randomize is offline
Randomize
BANNED
Join Date: May 2012
Location: in your heart
Old 09-22-2013 , 01:39   Re: Cache_UnlinkLRU: NULL link
Reply With Quote #2

bump
Randomize is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 09-22-2013 , 11:30   Re: Cache_UnlinkLRU: NULL link
Reply With Quote #3

Your get_players usage is not correct.

Suppose there are 5 players.

You use indexes 1 2 3 4 5, but connected players could have indexes 2 5 10 15 16

In that case, players array would contain :

players[0] -> 2
players[1] -> 5
players[2] -> 10
players[3] -> 15
players[4] -> 16

So to retrieve player index in the loop, you have to do players[i]
Also, a good habit is to cache such values when you need it more than once

So instead of doing :

PHP Code:
        player players[i]
        
entity_set_edict(backwpnEV_ENT_ownerplayers[i])
        
entity_set_edict(backwpnEV_ENT_aimentplayers[i]) 
do

PHP Code:
        entity_set_edict(backwpnEV_ENT_ownerplayer)
        
entity_set_edict(backwpnEV_ENT_aimentplayer
And do the same for backweapon[i] that is used 5 times.

So correct code is :

Code:
public cmd_backweapon(id) {     new players[32], playersnum     get_players(players, playersnum, "a")     new player, backwpn     for (new i = 0 ; i < playersnum ; ++i)     {
        player = players[i]
        backweapon[i] = backwpn = create_entity("info_target")
        entity_set_edict(backwpn, EV_ENT_owner, player)
        entity_set_edict(backwpn, EV_ENT_aiment, player)
        entity_set_int(backwpn, EV_INT_movetype, MOVETYPE_FOLLOW)         entity_set_model(backwpn, "models/backweapons.mdl")     } }
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 09-22-2013 at 11:31.
ConnorMcLeod is offline
Randomize
BANNED
Join Date: May 2012
Location: in your heart
Old 09-23-2013 , 09:31   Re: Cache_UnlinkLRU: NULL link
Reply With Quote #4

It didn't retrieve correctly, I tried to give:
PHP Code:
client_print(iprint_chat"%i"backweapon[i]) 
and it printed twice.
44
45

so the actual entity id is 44 but set to 45. So I must make the entity id to 44 by using:
PHP Code:
backweapon[id] - 
Randomize is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 09-24-2013 , 00:20   Re: Cache_UnlinkLRU: NULL link
Reply With Quote #5

Are you kidding me ?
__________________
- tired and retired -

- my plugins -
ConnorMcLeod 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 12:37.


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