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

How to save in nvault?


Post New Thread Reply   
 
Thread Tools Display Modes
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 11-24-2016 , 21:48   Re: How to save in nvault?
Reply With Quote #21

Quote:
Originally Posted by Gasior View Post
What if on connection we would just read the data and then set it up on respawn? After respawn set up an index preventing a cycle. Would that fix the problem?
It's easy to fix I just did not account for it when I was doing my coding cleanup. Once the player chooses a team then the model should be set. It would be best to hook TeamInfo or something because this would also take care of when a team change occurs.
__________________
Bugsy is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 11-24-2016 , 22:47   Re: How to save in nvault?
Reply With Quote #22

Try this
__________________
Bugsy is offline
Gasior
Member
Join Date: Mar 2012
Old 11-24-2016 , 23:03   Re: How to save in nvault?
Reply With Quote #23

I love you. This works perfectly fine!

I sat down and look through the code it is immensely complicated but I will read a little and try to understand how you have done that .

Thanks.
Gasior is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 11-24-2016 , 23:07   Re: How to save in nvault?
Reply With Quote #24

Quote:
Originally Posted by Gasior View Post
I love you. This works perfectly fine!

I sat down and look through the code it is immensely complicated but I will read a little and try to understand how you have done that .

Thanks.
Sorry about that, I kind of started fixing things forgetting that someone had to learn from it. I should have left your code there, commented out, and added comments to what/why I changed things. I recommend reading over it and if you have any questions just ask.
__________________
Bugsy is offline
Gasior
Member
Join Date: Mar 2012
Old 11-24-2016 , 23:45   Re: How to save in nvault?
Reply With Quote #25

Cool, I will certainly have lot of fun with it. I have similar plugin just with knives models it seems to be working but for some reason it restarts to Model 1 rather than your last choice. Your help here should certainly help with that if not I will open another case.

Thank you Bugsy.
Gasior is offline
Gasior
Member
Join Date: Mar 2012
Old 11-26-2016 , 17:37   Re: How to save in nvault?
Reply With Quote #26

Actually I just looked through my logs it's full of errors
[/code]L 11/26/2016 - 17:583: [AMXX] Displaying debug trace (plugin "modelemenu.amxx")
L 11/26/2016 - 17:583: [AMXX] Run time error 4: index out of bounds
L 11/26/2016 - 17:583: [AMXX] [0] modelemenu.sma::resetModel (line 150)
L 11/26/2016 - 17:583: [AMXX] [1] modelemenu.sma::teamInfo (line 93)[/code]

so line 150:
Code:
public resetModel( id ) 
{
    new CsTeams:userTeam;
    
    if ( ( g_Model[ id ] != NoModelSet ) && ( CS_TEAM_T <= ( userTeam = cs_get_user_team( id ) ) <= CS_TEAM_CT ) )
        cs_set_user_model( id , g_ModelFiles[ g_Model[ id ] ][ _:userTeam - 1 ]); // 150
    else
        cs_reset_user_model( id );
}
Line 93
Code:
public teamInfo()
{
    new id = read_data( 1 );
    new szTeam[ 2 ];
    new CsTeams:csNewTeam;

    read_data( 2 , szTeam , charsmax( szTeam ) );
    
    csNewTeam = ( szTeam[ 0 ] == 'T' ) ? CS_TEAM_T : CS_TEAM_CT;

    if ( g_csTeam[ id ] != csNewTeam )
    {
        if ( g_Model[ id ] != NoModelSet )
        {
            resetModel( id ); // line 93
        }
        
        g_csTeam[ id ] = csNewTeam;
    }    
}
Index is out of bound but not quite sure how to fix it.
Gasior is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 11-26-2016 , 17:57   Re: How to save in nvault?
Reply With Quote #27

I'm having a hard time reproducing it. Are you using the latest code? In my Edit2 code, I found what would cause an index out of bounds error and fixed it.

If yes, please update your resetModel function with this and give me the log when the error occurs again:
PHP Code:
public resetModelid 
{
    new 
CsTeams:userTeam;
    
    if ( ( 
g_Modelid ] != NoModelSet ) && ( CS_TEAM_T <= ( userTeam cs_get_user_teamid ) ) <= CS_TEAM_CT ) )
    {
        
log_amx"SETTING MODEL INDEX=%d TEAM INDEX=%d" g_Modelid ] , _:userTeam );
        
cs_set_user_modelid g_ModelFilesg_Modelid ] ][ _:userTeam ] );
    }
    else
    {
        
cs_reset_user_modelid );
    }

__________________

Last edited by Bugsy; 11-26-2016 at 17:59.
Bugsy is offline
Gasior
Member
Join Date: Mar 2012
Old 11-26-2016 , 18:09   Re: How to save in nvault?
Reply With Quote #28

Code:
L 11/27/2016 - 00:07:25: [AMXX] Displaying debug trace (plugin "modelemenu.amxx")
L 11/27/2016 - 00:07:25: [AMXX] Run time error 4: index out of bounds 
L 11/27/2016 - 00:07:25: [AMXX]    [0] modelemenu.sma::resetModel (line 152)
L 11/27/2016 - 00:07:25: [AMXX]    [1] modelemenu.sma::teamInfo (line 89)
Code:
L 11/27/2016 - 00:07:22: [modelemenu.amxx] SETTING MODEL INDEX=5 TEAM INDEX=1
L 11/27/2016 - 00:07:22: [modelemenu.amxx] SETTING MODEL INDEX=5 TEAM INDEX=1
L 11/27/2016 - 00:07:25: [modelemenu.amxx] SETTING MODEL INDEX=5 TEAM INDEX=1
L 11/27/2016 - 00:07:25: [modelemenu.amxx] SETTING MODEL INDEX=5 TEAM INDEX=1
L 11/27/2016 - 00:07:31: [modelemenu.amxx] SETTING MODEL INDEX=3 TEAM INDEX=1
L 11/27/2016 - 00:07:53: [modelemenu.amxx] SETTING MODEL INDEX=2 TEAM INDEX=1
L 11/27/2016 - 00:08:07: [modelemenu.amxx] SETTING MODEL INDEX=1 TEAM INDEX=1
L 11/27/2016 - 00:08:09: [modelemenu.amxx] SETTING MODEL INDEX=0 TEAM INDEX=1
Gasior is offline
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 11-26-2016 , 18:16   Re: How to save in nvault?
Reply With Quote #29

The problem is with the model index, but i dunno why

cs_set_user_model( id , g_ModelFiles[ g_Model[ id ] ][ _:userTeam - 1 ] );

should not be "," here:
cs_set_user_model( id , g_ModelFiles[ g_Model[ id ] ],[ _:userTeam - 1 ] );

???
__________________
Project: Among Us

Last edited by Craxor; 11-26-2016 at 18:19.
Craxor is offline
Send a message via ICQ to Craxor
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 11-26-2016 , 18:16   Re: How to save in nvault?
Reply With Quote #30

I think there is data in the vault from prior to my code changes. There should never be a MODEL INDEX value larger than 3.

Either delete your vault to start with a clean vault or replace your Load function with this:
PHP Code:
public LoadData(id

    new 
szData] , iTS;
    
    if ( 
nvault_lookupplik_vault g_szAuthIDid ] , szData charsmaxszData ) , iTS ) )
    {
        if ( ( 
g_Modelid ] = str_to_numszData ) ) >= sizeofg_ModelFiles ) )
        {
            
nvault_removeplik_vault g_szAuthIDid ] );
            
g_Modelid ] = NoModelSet;
        }
    }

__________________

Last edited by Bugsy; 11-26-2016 at 18:18.
Bugsy 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 21:39.


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