AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   is this loop right-coded? (https://forums.alliedmods.net/showthread.php?t=92138)

_lol_ 05-10-2009 15:50

is this loop right-coded?
 
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

Exolent[jNr] 05-10-2009 16:12

Re: is this loop right-coded?
 
If the server crashes unexpectedly, plugin_end() isn't called.

hlstriker 05-10-2009 16:17

Re: is this loop right-coded?
 
If this is for players it should be:
Code:

for (new id=1;...
There is no 0 client index.

_lol_ 05-10-2009 18:58

Re: is this loop right-coded?
 
Quote:

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


thanks, exist any way to catch when sv crash unexpectedly ?

joaquimandrade 05-10-2009 20:18

Re: is this loop right-coded?
 
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


fysiks 05-11-2009 02:13

Re: is this loop right-coded?
 
If the server stops, it stops. Period. Can't do much when everything ceases to run (including all plugins and dlls and the like).

joaquimandrade 05-11-2009 14:10

Re: is this loop right-coded?
 
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.

fysiks 05-11-2009 14:40

Re: is this loop right-coded?
 
Quote:

Originally Posted by joaquimandrade (Post 825695)
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" :).

Emp` 05-11-2009 14:50

Re: is this loop right-coded?
 
Quote:

Originally Posted by joaquimandrade (Post 825695)
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

Hunter-Digital 05-11-2009 14:57

Re: is this loop right-coded?
 
Quote:

Originally Posted by fysiks (Post 825707)
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 :lol:

Quote:

Originally Posted by Emp` (Post 825714)
Would be interesting if you could prevent the crash by returning FMRES_SUPERCEDE

:lol:


All times are GMT -4. The time now is 01:31.

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