Raised This Month: $ Target: $400
 0% 

nVault data switching


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-22-2020 , 18:40   Re: nVault data switching
Reply With Quote #3

There's a possibility that the death(s) remain there from the previous player on that slot. nvault_get_array() only fills the array if the player has data stored. So the below sequence of events would cause a connecting player to have data from the previous player.

1. Player A on slot 1 had 4 deaths. They disconnect.
2. Player B connects on slot 1. They have no data stored in the vault so nvault_get_array() essentially does nothing.
3. Player B has Player A's data leftover in pdData array.

I would clear out the pdData[ SLOT ] on disconnect.
Code:
public client_disconnected( id ) {     if(g_bMapBanned)         return PLUGIN_HANDLED     if ( !g_BotOrHLTV[ id ] )     {         get_user_name( id , pdData[ id ][ PlayerName ] , charsmax( pdData[][ PlayerName ] ) );                 nvault_set_array( g_Vault , g_AuthID[ id ] , pdData[ id ][ PlayerData:0 ] , sizeof( pdData[  ] ) );         arrayset( pdData[ id ] , 0 , sizeof( pdData[] ) );     }     return PLUGIN_HANDLED }
__________________
Bugsy is offline
 



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 17:14.


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