Raised This Month: $ Target: $400
 0% 

is this loop right-coded?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
_lol_
Senior Member
Join Date: Apr 2009
Old 05-10-2009 , 15:50   is this loop right-coded?
Reply With Quote #1

well i dont know if it is right coded, because sometimes it dont work -.-

i use this to save players exp by nvault, when the server crashes.

PHP Code:
public plugin_end()
{
    for (new 
idid <= 32id++)
        
cmdSave(id)
    
nvault_close(g_Vault)

lol T_T
_lol_ is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 05-10-2009 , 16:12   Re: is this loop right-coded?
Reply With Quote #2

If the server crashes unexpectedly, plugin_end() isn't called.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
_lol_
Senior Member
Join Date: Apr 2009
Old 05-10-2009 , 18:58   Re: is this loop right-coded?
Reply With Quote #3

Quote:
Originally Posted by Exolent[jNr] View Post
If the server crashes unexpectedly, plugin_end() isn't called.

thanks, exist any way to catch when sv crash unexpectedly ?
_lol_ is offline
hlstriker
Green Gaben
Join Date: Mar 2006
Location: OH-IO!
Old 05-10-2009 , 16:17   Re: is this loop right-coded?
Reply With Quote #4

If this is for players it should be:
Code:
for (new id=1;...
There is no 0 client index.
hlstriker is offline
joaquimandrade
Veteran Member
Join Date: Dec 2008
Location: Portugal
Old 05-10-2009 , 20:18   Re: is this loop right-coded?
Reply With Quote #5

Try this (it's a guess. I never used it):

PHP Code:
// Notify game .dll that engine is going to shut down.  Allows mod authors to set a breakpoint.
    
FM_Sys_Error
__________________

Last edited by joaquimandrade; 05-10-2009 at 20:30.
joaquimandrade is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-11-2009 , 02:13   Re: is this loop right-coded?
Reply With Quote #6

If the server stops, it stops. Period. Can't do much when everything ceases to run (including all plugins and dlls and the like).
__________________
fysiks is offline
joaquimandrade
Veteran Member
Join Date: Dec 2008
Location: Portugal
Old 05-11-2009 , 14:10   Re: is this loop right-coded?
Reply With Quote #7

There are crashes when the engine shutdown because it can't continue in a consistent way but that can be handled since it is still in control. Like when you create to much entities, or you don't precache a model or a sound and then use it.
__________________

Last edited by joaquimandrade; 05-11-2009 at 14:13.
joaquimandrade is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-11-2009 , 14:40   Re: is this loop right-coded?
Reply With Quote #8

Quote:
Originally Posted by joaquimandrade View Post
There are crashes when the engine shutdown because it can't continue in a consistent way but that can be handled since it is still in control. Like when you create to much entities, or you don't precache a model or a sound and then use it.
We must have different definitions of "crash" .
__________________
fysiks is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 05-11-2009 , 14:57   Re: is this loop right-coded?
Reply With Quote #9

Quote:
Originally Posted by fysiks View Post
We must have different definitions of "crash" .
Well... there is the crash made by an unexpected error in the system, printing the actual error (unprecached model, messages stuff, windows ****ed, etc) ... ooor the quick shut crashes... like the ones when you just press the reboot button or a sudden stop in electricty supply... =) also I don't know if end task is a quick one ... I am curious, anyone tested it ? test it on end task too

Quote:
Originally Posted by Emp` View Post
Would be interesting if you could prevent the crash by returning FMRES_SUPERCEDE
__________________
Hunter-Digital is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 05-11-2009 , 14:50   Re: is this loop right-coded?
Reply With Quote #10

Quote:
Originally Posted by joaquimandrade View Post
There are crashes when the engine shutdown because it can't continue in a consistent way but that can be handled since it is still in control. Like when you create to much entities, or you don't precache a model or a sound and then use it.
Would be interesting if you could prevent the crash by returning FMRES_SUPERCEDE
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
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 01:31.


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