AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Stop a function on round end (https://forums.alliedmods.net/showthread.php?t=92183)

Geri094 05-11-2009 11:05

Stop a function on round end
 
Hey modders!

I would like to ask your help. I would need a code that disables a function on the end of the round.
Thank you!

Hunter-Digital 05-11-2009 11:08

Re: Stop a function on round end
 
a global variable, hook round end event set the varible true, hook round start to set it back to false and add a check for that variable in the function

what I just said in code terms:
PHP Code:

#include <amxmodx>
 
new bool:g_bRoundEnded false
 
public plugin_init()
{
    
register_logevent("event_roundStart"2"1=Round_Start")
    
register_logevent("event_roundEnd"2"1=Round_End")
}
 
public 
event_roundEnd() g_bRoundEnded true
public event_roundStart() g_bRoundEnded false
 
public your_function()
{
    if(
g_bRoundEnded)
        return 
PLUGIN_CONTINUE
 
    
// code here, will be executed if round is still playing
 
    
return PLUGIN_CONTINUE



Geri094 05-11-2009 11:48

Re: Stop a function on round end
 
I will try it...Thank you man :) +karma^^ and i wanna use it to laser and tripmine :)

Geri094 05-12-2009 01:20

Re: Stop a function on round end
 
How can i use it for the laser/tripmine entity mod?
http://forums.alliedmods.net/showthread.php?p=221113

So i wanna to switch off automatically the laser on the round's end (When the last player die or the time is over)

Thank you... +karma for the answer

Hunter-Digital 05-12-2009 07:52

Re: Stop a function on round end
 
Pff that's a big topic with too many versions and too much code... :}

Well, search for the function where you place the mine, add a check at start for that variable...
PHP Code:

public place_mine(id)
{
     if(
g_bRoundEnded)
     {
           
client_print(idprint_center"You can't place mines after the round has ended")
           return 
PLUGIN_HANDLED
     
}
 
     
//...


and add the other two roundstart/end functions... first search for them in the plugin and just add the vars there, if they are not there, copy them from my code :) easy...

Geri094 05-13-2009 01:35

Re: Stop a function on round end
 
Thank you man :DI did it and it works now properly... thank you mate :)


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

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