[TF2] Help with timer
This timer should give +1 primary ammo every 1.5 seconds, but apparently it's not working correctly
Quote:
|
Re: [TF2] Help with timer
Quote:
You create a repetitive timer 100 times in a second. The player will start getting 6000 ammo every 1.5 seconds after a minute. After an hour, the player will get 21600000 ammo every 1.5 seconds. Just do this: [code] #include <sourcemod> new hTimerAmmo = INVALID_HANDLE; public OnPluginStart() { HookEvent("round_start", Event_RoundStart, EventHookMode_PostNoCopy); } public OnMapStart() { hTimerAmmo = INVALID_HANDLE; } public Event_RoundStart(Handle:hEvent, const String:Name[], bool:dontBroadcast) { if(hTimerAmmo != INVALID_HANDLE) { CloseHandle(hTimerAmmo); hTimerAmmo = INVALID_HANDLE; } hTimerAmmo = CreateTimer(1.5, GiveAllAmmo, _, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE); } public Action:GiveAllAmmo(Handle:hTimer) { // Give ammo stuff here, will be executed every 1.5 seconds. return Plugin_Continue; } |
Re: [TF2] Help with timer
Quote:
|
Re: [TF2] Help with timer
You could just use AddCommandListener, also it didn't work with GivePlayerAmmo for some reason :/
Here's a sample plugin: PHP Code:
|
Re: [TF2] Help with timer
PHP Code:
|
Re: [TF2] Help with timer
Quote:
Please do not post false or misleading information. Quote:
|
Re: [TF2] Help with timer
+attack + AddCommandListener make's it to an "event", it sure registers it but not the actual key pressed, thanks for pointing it out. Think this should do it slightly better:
PHP Code:
|
Re: [TF2] Help with timer
Quote:
i think he got the idea. |
All times are GMT -4. The time now is 10:25. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.