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

Help with multiple params set_task


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
headshot910
Member
Join Date: Apr 2012
Old 04-11-2020 , 15:31   Help with multiple params set_task
Reply With Quote #1

Hi, i have this code:
PHP Code:
public FT_Shoot_Mine_2(ent)
{
    static 
Float:StartOrigin[3][3]
    new 
tmpOrigin[3]

    for(new 
011i++)
    {        
        if(
i<0) continue
        
get_position(enti*70.0+100.035.0, -35.0StartOrigin[0])
        
get_position(enti*70.0+100.0, (i*-15.0)+35.0, -35.0StartOrigin[1])
        
get_position(enti*70.0+100.0, (i*15.0)+35.0, -35.0StartOrigin[2])
        
        for(new 
j=0;i<2;j++)
        {
            
tmpOrigin[0] = floatround(StartOrigin[j][0]) //Error here
            
tmpOrigin[1] = floatround(StartOrigin[j][1])
            
tmpOrigin[2] = floatround(StartOrigin[j][2])
            
set_task(0.2*i"Shoot_Mine_2"12345tmpOriginsizeof(tmpOrigin))
        }
    }    
}

public 
Shoot_Mine_2(tmpOrigin[])
{    
    new 
StartOrigin[3]
    
StartOrigin[0] = tmpOrigin[0]
    
StartOrigin[1] = tmpOrigin[1]
    
StartOrigin[2] = tmpOrigin[2]
    ...

I'm keep getting error "Index Out Of Bounds" in game console. I was tried to test the "floatround(StartOrigin[j][0])" to "floatround(StartOrigin[0][0])" and game just crash. So
1st. Is there any way to send the origin in set_task paraments?
2nd. Is there any way to send both the origin and the ent index?

Thank you first !
__________________
Hi!
I'm here!
headshot910 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-11-2020 , 15:42   Re: Help with multiple params set_task
Reply With Quote #2

for(new j=0;i<2;j++)

Replace i < 2 with j < 2

It looks like you are passing data in set_task() correctly.
__________________
Bugsy is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-11-2020 , 15:46   Re: Help with multiple params set_task
Reply With Quote #3

Mind you, your code logic can be completely wrong, I am only looking to resolve your error.
__________________
Bugsy is offline
headshot910
Member
Join Date: Apr 2012
Old 04-11-2020 , 22:41   Re: Help with multiple params set_task
Reply With Quote #4

Quote:
Originally Posted by Bugsy View Post
for(new j=0;i<2;j++)

Replace i < 2 with j < 2

It looks like you are passing data in set_task() correctly.
Oh i couldn't see it
But sadly, its giving me this "Got a NaN origin on ft_landmin". I'm trying to pass the origins to another fuction
__________________
Hi!
I'm here!
headshot910 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-11-2020 , 22:44   Re: Help with multiple params set_task
Reply With Quote #5

What do you mean by "I'm trying to pass the origins to another fuction". Does this mean via set_task()?
__________________
Bugsy is offline
headshot910
Member
Join Date: Apr 2012
Old 04-11-2020 , 22:49   Re: Help with multiple params set_task
Reply With Quote #6

Quote:
Originally Posted by Bugsy View Post
What do you mean by "I'm trying to pass the origins to another fuction". Does this mean via set_task()?
Yes, because i want it to create an entity, 0.2 each 3 ones
__________________
Hi!
I'm here!
headshot910 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-11-2020 , 22:55   Re: Help with multiple params set_task
Reply With Quote #7

The code you have now will pass the origin correctly. Do you need to pass additional data?
__________________
Bugsy is offline
headshot910
Member
Join Date: Apr 2012
Old 04-11-2020 , 23:05   Re: Help with multiple params set_task
Reply With Quote #8

It's kinda complicate but i'll try to explain for you.

So, i was able to do this:


But now, i want to delay on creating the entity. 0.2s after a group of 3 entity:


You see, it's like it popup after and after another, lolz.
__________________
Hi!
I'm here!
headshot910 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-11-2020 , 23:08   Re: Help with multiple params set_task
Reply With Quote #9

Is Shoot_Mine_2() what creates the entities? If so, I'd increase the set_task inverval

0.2 * i to 0.2 + i)
or
0.2 * i to 0.2 + (i * 2)
__________________

Last edited by Bugsy; 04-12-2020 at 03:01.
Bugsy is offline
headshot910
Member
Join Date: Apr 2012
Old 04-11-2020 , 23:10   Re: Help with multiple params set_task
Reply With Quote #10

Quote:
Originally Posted by Bugsy View Post
The code you have now will pass the origin correctly. Do you need to pass additional data?
Yes, 'ent' index.

But my code giving this . It's seem like it's cannot pass the origin right
__________________
Hi!
I'm here!
headshot910 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 20:40.


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