AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Memory access (https://forums.alliedmods.net/showthread.php?t=189726)

Diegorkable 07-10-2012 07:39

Memory access
 
Hey guys,

I have a plugin which gives me in 1 specific function tons of errors:

Code:

L 07/10/2012 - 07:32:35: [AMXX] Run time error 5: memory access
when its on debug mode, it says that the problem is here:

PHP Code:

public fwSetClientKeyValueid, const infobuffer[], const key[] )
{
    if ( (
<= id <= g_max_clients) && equalkey"model" ) && is_user_connected(id) )
    {
            
        if ( 
g_has_custom_model[id] )
        {
            static 
currentmodel[32]
            
            for ( new 
sizeof(currentmodel) ; i++ )
                
currentmodel[i] = EOS
                
            fm_cs_get_user_model
idcurrentmodelcharsmaxcurrentmodel ) )
            
            if ( !
equalcurrentmodelg_player_model[id] ) )
                
fm_cs_set_user_modelg_player_model[id], id+MODEL_TASKID )
        }
        
        else
        {
            
fm_cs_reset_user_modelid // line 1436
        
}
        
        return 
FMRES_SUPERCEDE;
    }
    
    return 
FMRES_IGNORED;
}

stock fm_cs_reset_user_modelplayer )
{
    
g_has_custom_model[player] = false
    
    dllfunc
DLLFunc_ClientUserInfoChangedplayerengfuncEngFunc_GetInfoKeyBufferplayer ) )
}

// line 7243 doesn't exist.. =\ 

I want that no models will be allowed if you're not marked as having a custom model, so if you set a model it fm_cs_reset_user_model you, but if you're marked as one you'll be set the model you're supposed to be in another variable.

The 2nd part isn't relevant, cuz the error of the Memory access is showing on the line where's the "else", at the fm_cs_reset_user_model.

Code:

L 07/10/2012 - 05:42:47: [AMXX] Displaying debug trace (plugin "plugin.amxx")
L 07/10/2012 - 05:42:47: [AMXX] Run time error 5: memory access
L 07/10/2012 - 05:42:47: [AMXX]    [0] plugin.sma::fm_cs_reset_user_model (line 7243)
L 07/10/2012 - 05:42:47: [AMXX]    [1] plugin.sma::fwSetClientKeyValue (line 1436)
L 07/10/2012 - 05:42:47: [AMXX] Displaying debug trace (plugin "plugin.amxx")

What is wrong?

K1d0x 07-10-2012 09:11

Re: Memory access
 
Modify arrays in 33

ex:
new arayx[33]

Diegorkable 07-10-2012 09:49

Re: Memory access
 
Quote:

Originally Posted by K1d0x (Post 1747332)
Modify arrays in 33

ex:
new arayx[33]

what does it have to do with that?
The error is about fm_cs_reset_user_model

YamiKaitou 07-10-2012 09:53

Re: Memory access
 
Why are you using Fakemeta instead of CStrike?

Exolent[jNr] 07-10-2012 09:55

Re: Memory access
 
Quote:

Originally Posted by YamiKaitou (Post 1747364)
Why are you using Fakemeta instead of CStrike?

Looks like code from here since cs_set_user_model() can cause problems.

Diegorkable 07-11-2012 06:39

Re: Memory access
 
Quote:

Originally Posted by Exolent[jNr] (Post 1747365)
Looks like code from here since cs_set_user_model() can cause problems.

Yes, but what do I do to fix the errors? Its spamming my error logs with 40k lines a day


All times are GMT -4. The time now is 15:09.

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