Raised This Month: $ Target: $400
 0% 

block function after x time


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Monster Truck
Member
Join Date: Jan 2012
Location: France
Old 07-23-2014 , 19:45   block function after x time
Reply With Quote #1

Hi, i think it's basic pawn scripting, but i really forgot how to do this.

I made a plugin that displays a menu when someone says "/gun".
I want that the clients can't open the menu by saying "/gun" after X (variable) sec after the beginning of the round (before freezetime), and then, it prints to all (id = 0) : Time is Up, /gun won't work anymore!
I serched a bit in amx mod x documentation but didn't find an event or somethin that can do this.

Anyone for help ? Thank you.
Monster Truck is offline
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 07-23-2014 , 20:13   Re: block function after x time
Reply With Quote #2

Use a bool. Set it to true on round start and the set task with the time you need. In that task, set the bool to false. I want to note that you don't need indexes in the bool, since that restrictoons aplies to all players.
__________________

Last edited by Flick3rR; 07-23-2014 at 20:14.
Flick3rR is offline
Send a message via Skype™ to Flick3rR
Monster Truck
Member
Join Date: Jan 2012
Location: France
Old 07-23-2014 , 20:43   Re: block function after x time
Reply With Quote #3

Thank you, u took the time to answer to an idiot question, i'll test this, but i'm sure it's the good way to this.

Problem Solved, Thank you Flick3rR ^^
Monster Truck is offline
claudiuhks
Yam Inside®™℠
Join Date: Jan 2010
Location: Living Randomly
Old 07-24-2014 , 04:37   Re: block function after x time
Reply With Quote #4

Quote:
Originally Posted by Monster Truck View Post
Thank you, u took the time to answer to an idiot question, i'll test this, but i'm sure it's the good way to this.

Problem Solved, Thank you Flick3rR ^^
Or, like that:

PHP Code:
#define MAX_EXECUTIONS 3 // this will reset when map changes

public fn()
{
  static 
counter 0;

  if (++
counter == MAX_EXECUTIONS)
    return;

  
/*do code*/;

  return;

__________________

Last edited by claudiuhks; 07-24-2014 at 04:37.
claudiuhks is offline
Send a message via MSN to claudiuhks Send a message via Yahoo to claudiuhks Send a message via Skype™ to claudiuhks
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 13:02.


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