Raised This Month: $51 Target: $400
 12% 

Using CreateDataTimer


Post New Thread Reply   
 
Thread Tools Display Modes
Halt
Senior Member
Join Date: Jan 2015
Location: Black Mesa
Old 05-24-2017 , 11:27   Re: Using CreateDataTimer
Reply With Quote #11

When I call ArtilleryExplosionTimer more than once in the same block it only executes the timer once. I don't understand why?

Code:
	CreateDataTimer(RandomTime, ArtilleryExplosionTimer, datapack);
	CreateDataTimer(RandomTime2, ArtilleryExplosionTimer, datapack);
I only get one explosion output. Which is whats in ArtilleryExplosionTimer, an explosion.

Last edited by Halt; 05-24-2017 at 11:29.
Halt is offline
Chaosxk
Veteran Member
Join Date: Aug 2010
Location: Westeros
Old 05-24-2017 , 12:58   Re: Using CreateDataTimer
Reply With Quote #12

Your probably getting an error in your logs.

CreateDataTimer will automatically close the Datapack when finishing, so the 2nd CreateDataTimer Datapack is no longer valid.

Edit: forgot it createdatatimer creates a new datapack, read below...
__________________

Last edited by Chaosxk; 05-24-2017 at 18:13.
Chaosxk is offline
Halt
Senior Member
Join Date: Jan 2015
Location: Black Mesa
Old 05-24-2017 , 13:00   Re: Using CreateDataTimer
Reply With Quote #13

So each CreateDataTimer needs its own datapack?

Or can I reuse a datapack?

Last edited by Halt; 05-24-2017 at 13:06.
Halt is offline
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 05-24-2017 , 15:15   Re: Using CreateDataTimer
Reply With Quote #14

CreateDataTimer creates the datapack for you, all you need to do is fill it with data.
__________________
WildCard65 is offline
Halt
Senior Member
Join Date: Jan 2015
Location: Black Mesa
Old 05-24-2017 , 15:33   Re: Using CreateDataTimer
Reply With Quote #15

Yes but say I want different data each time I use CreateDataTimer. The timer is creating explosions and I want the explosions at random vectors. The datapack only holds one vector all the explosions will hit in the same place.
Halt is offline
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 05-24-2017 , 18:07   Re: Using CreateDataTimer
Reply With Quote #16

Quote:
Originally Posted by Halt View Post
Yes but say I want different data each time I use CreateDataTimer. The timer is creating explosions and I want the explosions at random vectors. The datapack only holds one vector all the explosions will hit in the same place.
Everytime you call "CreateDataTimer", it creates a new (and empty) DataPack handle that you must fill (after the execution of the stock), not only that, but the DataPack the stock creates is also passed as the value to the "data" param of "CreateTimer" as well as the flag for auto-closing data handles is OR'd into your flags.

Edit: To answer your question, your more then likely erroring on reading an empty DataPack.
__________________

Last edited by WildCard65; 05-24-2017 at 18:08.
WildCard65 is offline
Halt
Senior Member
Join Date: Jan 2015
Location: Black Mesa
Old 05-24-2017 , 19:22   Re: Using CreateDataTimer
Reply With Quote #17

I'm literally using exactly what the guys on AlliedModders told me to use, and it compiles fine. No error logs.
Spoiler
Halt is offline
Miu
Veteran Member
Join Date: Nov 2013
Old 05-24-2017 , 19:28   Re: Using CreateDataTimer
Reply With Quote #18

errors when you RUN IT on the SERVER not when u compile it
Miu is offline
Halt
Senior Member
Join Date: Jan 2015
Location: Black Mesa
Old 05-24-2017 , 19:35   Re: Using CreateDataTimer
Reply With Quote #19

This is what I found in my error logs.

Spoiler
Halt is offline
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 05-24-2017 , 21:20   Re: Using CreateDataTimer
Reply With Quote #20

Quote:
Originally Posted by WildCard65 View Post
Edit: To answer your question, your more then likely erroring on reading an empty DataPack.
Yeap, definitely your problem, I repeat, CreateDatatTimer CREATES A DataPack HANDLE FOR YOU TO FILL!

example:
PHP Code:
DataPack myPack;
CreateDataTimer(5.0MyTimermyPack);
myPack.WriteFloat(5.0); // Write a float to the datapack the timer WILL receive. 
__________________

Last edited by WildCard65; 05-24-2017 at 21:22.
WildCard65 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 06:42.


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