AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   block function after x time (https://forums.alliedmods.net/showthread.php?t=244800)

Monster Truck 07-23-2014 19:45

block function after x time
 
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.

Flick3rR 07-23-2014 20:13

Re: block function after x time
 
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.

Monster Truck 07-23-2014 20:43

Re: block function after x time
 
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 ^^

claudiuhks 07-24-2014 04:37

Re: block function after x time
 
Quote:

Originally Posted by Monster Truck (Post 2172734)
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;




All times are GMT -4. The time now is 13:02.

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