Raised This Month: $ Target: $400
 0% 

Stop a function on round end


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Geri094
Junior Member
Join Date: Mar 2008
Old 05-11-2009 , 11:05   Stop a function on round end
Reply With Quote #1

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!
Geri094 is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 05-11-2009 , 11:08   Re: Stop a function on round end
Reply With Quote #2

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

__________________
Hunter-Digital is offline
Geri094
Junior Member
Join Date: Mar 2008
Old 05-11-2009 , 11:48   Re: Stop a function on round end
Reply With Quote #3

I will try it...Thank you man +karma^^ and i wanna use it to laser and tripmine
Geri094 is offline
Geri094
Junior Member
Join Date: Mar 2008
Old 05-12-2009 , 01:20   Re: Stop a function on round end
Reply With Quote #4

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
Geri094 is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 05-12-2009 , 07:52   Re: Stop a function on round end
Reply With Quote #5

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...
__________________
Hunter-Digital is offline
Geri094
Junior Member
Join Date: Mar 2008
Old 05-13-2009 , 01:35   Re: Stop a function on round end
Reply With Quote #6

Thank you man I did it and it works now properly... thank you mate
Geri094 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 01:36.


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