Quote:
Originally Posted by ironskillz1
Yes
|
You should cache the players steamid in a global variable @ client_authorized(). I would also organize the data using an enum, something like the below, for example.
PHP Code:
enum MarriedData
{
szSteamID[ 34 ],
szSpouseSteamID[ 34 ],
szSpouseName[ 33 ]
}
new g_mdData[ MAX_PLAYERS + 1 ][ MarriedData ]
I didn't look through your entire plugin, but I can tell that your loading/saving was wrong. Hopefully this solves it.
Untested:
PHP Code:
public UpdateName( id )
{
new szName[ 33 ] , szAuthID[ 34 ] , szBuffer[ 66 ];
get_user_name( id , szName , charsmax( szName ) );
get_user_authid( id , szAuthID , charsmax( szAuthID ) );
formatex( szBuffer , charsmax( szBuffer ) , "%s ^"%s^"" , szAuthID , szName );
nvault_set( g_Vault , g_iMarriedSteamID[ id ] , szBuffer );
}
public SaveData( id1 , id2 )
{
//ID1 : KEY=[ID1_STEAMID] DATA=[ID2_STEAMID "ID2_NAME"]
//ID2 : KEY=[ID2_STEAMID] DATA=[ID1_STEAMID "ID1_NAME"]
new szName[ 2 ][ 32 ] , szAuthID[ 2 ][ 34 ] , szBuffer[ 66 ];
get_user_name( id1 , szName[ 0 ] , charsmax( szName[] ) );
get_user_name( id2 , szName[ 1 ] , charsmax( szName[] ) );
get_user_authid( id1 , szAuthID[ 0 ] , charsmax( szAuthID[] ) );
get_user_authid( id2 , szAuthID[ 1 ] , charsmax( szAuthID[] ) );
formatex( szBuffer , charsmax( szBuffer ) , "%s ^"%s^"" , szAuthID[ 1 ] , szName[ 1 ] );
nvault_set( g_Vault , szAuthID[ 0 ] , szBuffer );
formatex( szBuffer , charsmax( szBuffer ) , "%s ^"%s^"" , szAuthID[ 0 ] , szName[ 0 ] );
nvault_set( g_Vault , szAuthID[ 1 ] , szBuffer );
}
public LoadData( id )
{
new szAuthID[ 34 ] , szBuffer[ 66 ] , iTS;
get_user_authid( id , szAuthID , charsmax( szAuthID ) );
if ( nvault_lookup( g_Vault , szAuthID , szBuffer , charsmax( szBuffer ) , iTS ) )
{
parse( szBuffer , g_iMarriedSteamID[ id ] , charsmax( g_iMarriedSteamID[] ) , g_iMarriedName[ id ] , charsmax( g_iMarriedName[] ) );
}
}
__________________