Raised This Month: $32 Target: $400
 8% 

save nvault on plugin_end


Post New Thread Reply   
 
Thread Tools Display Modes
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 08-01-2021 , 11:01   Re: save nvault on plugin_end
Reply With Quote #11

Do some debugging before even posting for help. There has to be an issue with your code as I've been using nVault for years this way.
__________________
Bugsy is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-01-2021 , 15:34   Re: save nvault on plugin_end
Reply With Quote #12

Quote:
Originally Posted by Supremache View Post
I mean if I have stopped the server using host or the server has shutdown the data doesn't get saved
plugin_end(), client_disconnect(), and client_disconnected() are all called when the server is shut down properly (i.e. using the "quit" or "exit" commands in console. If the process is killed at the operating system level or the process has a legitimate crash then it obviously won't.

So, maybe your host's script is improperly shutting down the server or your server is actually crashing (neither of which should happen on any regularity and generally can be ignored). Why would you be shutting down the server via that host while people are playing? These situations should be very very rare and if they are not something is wrong with either your process or you need to fix a crashing issue.
__________________
fysiks is offline
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 08-01-2021 , 17:36   Re: save nvault on plugin_end
Reply With Quote #13

I think my plugin isn't having any issues!, It's saving the data when the players get "exit, drop, kick, ban, timeout, etc" but it's not saving the data just when the server get shut down I was think nvault working like that but when @bugsy said plugin_end is calling when the server get shutdown so I said there is a solution for this !
__________________
Youtube.com/Supremache

Bank System [Nvault - SQL Support]
VIP System
  • If you think it's that simple, then do it yourself.

Last edited by Supremache; 08-01-2021 at 17:39.
Supremache is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-01-2021 , 19:51   Re: save nvault on plugin_end
Reply With Quote #14

huh . . what?
__________________
fysiks is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 08-01-2021 , 20:25   Re: save nvault on plugin_end
Reply With Quote #15

You are saving player data at disconnect. You are closing the vault at plugin_end.

When a shutdown occurs, disconnect should be called on all, resulting in their data getting saved, and shortly after, plugin_end should get executed.
__________________
Bugsy is offline
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 08-01-2021 , 20:26   Re: save nvault on plugin_end
Reply With Quote #16

Every time when i use nvault for saving the data, it's only save the data when the player get "disconnect, drop, timeout, kick and when i add the function of save data to other function" and doesn't save it when the server get shutdown.
__________________
Youtube.com/Supremache

Bank System [Nvault - SQL Support]
VIP System
  • If you think it's that simple, then do it yourself.
Supremache is offline
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 08-01-2021 , 20:41   Re: save nvault on plugin_end
Reply With Quote #17

Quote:
Originally Posted by Bugsy View Post
You are saving player data at disconnect. You are closing the vault at plugin_end.

When a shutdown occurs, disconnect should be called on all, resulting in their data getting saved, and shortly after, plugin_end should get executed.
But why that never happening and my plugin doesn't have any issues with vault codes
__________________
Youtube.com/Supremache

Bank System [Nvault - SQL Support]
VIP System
  • If you think it's that simple, then do it yourself.
Supremache is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 08-01-2021 , 21:21   Re: save nvault on plugin_end
Reply With Quote #18

Something else must be bad in your code.

I ran this plugin on a map change and then shutting down the server, both responded the same.
PHP Code:
public plugin_end()
{
    
log_amx"plugin end called" );
}

public 
client_disconnectid )
{
    
log_amx"disconnect called on %d" id );

Code:
L 08/01/2021 - 21:19:57: [untitled.amxx] disconnect called on 1
L 08/01/2021 - 21:19:57: [untitled.amxx] disconnect called on 2
L 08/01/2021 - 21:19:57: [untitled.amxx] disconnect called on 3
L 08/01/2021 - 21:19:57: [untitled.amxx] disconnect called on 4
L 08/01/2021 - 21:19:57: [untitled.amxx] disconnect called on 5
L 08/01/2021 - 21:19:57: [untitled.amxx] plugin end called

L 08/01/2021 - 21:20:15: [untitled.amxx] disconnect called on 1
L 08/01/2021 - 21:20:15: [untitled.amxx] disconnect called on 2
L 08/01/2021 - 21:20:15: [untitled.amxx] disconnect called on 3
L 08/01/2021 - 21:20:15: [untitled.amxx] disconnect called on 4
L 08/01/2021 - 21:20:15: [untitled.amxx] disconnect called on 5
L 08/01/2021 - 21:20:15: [untitled.amxx] plugin end called
__________________
Bugsy is offline
Shadows Adi
AlliedModders Donor
Join Date: Aug 2019
Location: Romania
Old 08-02-2021 , 04:40   Re: save nvault on plugin_end
Reply With Quote #19

Extracted from: https://github.com/alliedmodders/amx....cpp#L692-L747

Code:
// Call plugin_end forward function  from plugins. void C_ServerDeactivate() {     if (!g_activated)         RETURN_META(MRES_IGNORED);     for (int i = 1; i <= gpGlobals->maxClients; ++i)     {         CPlayer *pPlayer = GET_PLAYER_POINTER_I(i);         if (pPlayer->initialized)         {             // deprecated
            executeForwards(FF_ClientDisconnect, static_cast<cell>(pPlayer->index));
            if (g_isDropClientHookAvailable && !pPlayer->disconnecting)             {
                executeForwards(FF_ClientDisconnected, static_cast<cell>(pPlayer->index), FALSE, prepareCharArray(const_cast<char*>(""), 0), 0);
            }         }         if (pPlayer->ingame)         {             auto wasDisconnecting = pPlayer->disconnecting;             pPlayer->Disconnect();             --g_players_num;             if (!wasDisconnecting && g_isDropClientHookAvailable)             {
                executeForwards(FF_ClientRemove, static_cast<cell>(pPlayer->index), FALSE, const_cast<char*>(""));
            }         }     }     if (g_isDropClientHookAvailable)     {         if (g_isDropClientHookEnabled)         {             if (RehldsApi)             {
                RehldsHookchains->SV_DropClient()->unregisterHook(SV_DropClient_RH);
            }             else             {
                DropClientDetour->DisableDetour();
            }             g_isDropClientHookEnabled = false;         }     }     g_players_num   = 0;
    executeForwards(FF_PluginEnd);
    RETURN_META(MRES_IGNORED); }
__________________


Accepting Paid Requests, contact PM.

MVP Of The Round View project on GITHUB / AlliedModders
CSGO REMAKE ~ CSGO MOD [STABLE + SOURCE CODE]
Shadows Adi is offline
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 08-02-2021 , 19:26   Re: save nvault on plugin_end
Reply With Quote #20

Well, I dont know which wrong in my plugin that making the data doesn't save when the server got shutdown but i will do debugs to find the issue.

Thanks..!
__________________
Youtube.com/Supremache

Bank System [Nvault - SQL Support]
VIP System
  • If you think it's that simple, then do it yourself.
Supremache 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 04:03.


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