AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [Solved] Float Task (https://forums.alliedmods.net/showthread.php?t=84854)

AntiBots 02-01-2009 21:27

[Solved] Float Task
 
Well I need to pass a float into a Task
But I get "Warning: Tag mismatch"

PHP Code:

 new Float:origin[3]
 
pev(idpev_originorigin)
 
 
set_task(0.1"mystask"456origin3"b"

PHP Code:

public mystaskFloat:origin[3] )
{
     
//


Thanks

jim_yang 02-01-2009 21:31

Re: Float Task
 
native set_task(Float:time,const function[],id = 0,const parameter[]="",len = 0,const flags[]="", repeat = 0);parameter is not Float array

Dores 02-01-2009 21:44

Re: Float Task
 
Code:
set_task(0.1, "mystask", 456, origin, 3, "b"); public mystask(taskid, Float:Params[]) // taskid = 456 {     new origin[3];         for(new i = 0 ; i < 3 ; i++)     {         origin[i] = Params[i];     } }

AntiBots 02-01-2009 21:47

Re: Float Task
 
PHP Code:

 new buffer[50]
 
formatex(buffer127"%f %f %f"origin[0], origin[1], origin[2])
 
set_task(0.1"sirent_task"456buffer50"b"

PHP Code:

public sirent_task(informacion[])
{
 new 
info1[13], info2[13], info3[13]
 
parse(informacioninfo112info212info312)
 new 
Float:origin[3]
 
origin[0] = str_to_float(info1)
 
origin[1] = str_to_float(info2)
 
origin[2] = str_to_float(info3)
 
 
engfunc(EngFunc_EmitAmbientSound0originsound_sirenVOL_NORMATTN_NORM0PITCH_NORM


Solved

jim_yang 02-01-2009 21:59

Re: [Solved] Float Task
 
Code:

public test2(id)
{
    new origin[3]
    get_user_origin(id, origin)
    set_task(0.1, "test3", id, origin, 3)
    return 1
}
public test3(origin[3], id)
{
    new Float:fo[3]
    IVecFVec(origin, fo)
    client_print(id, print_chat, "%f %f %f", fo[0], fo[1], fo[2])
}


Arkshine 02-02-2009 04:51

Re: [Solved] Float Task
 
Code:
public test2(id) {     new Float:origin[3]     pev ( id, pev_origin, origin );     set_task(0.1, "test3", id, _:origin, 3) } public test3(Float:origin[3], id) {     client_print(id, print_chat, "%f %f %f", origin[0], origin[1], origin[2]) }

Should work.

Hawk552 02-02-2009 09:17

Re: [Solved] Float Task
 
arkshine's is by far the best method. Use that.

Dores 02-02-2009 09:33

Re: Float Task
 
Quote:

Originally Posted by AntiBots (Post 754106)
PHP Code:

 new buffer[50]
 
formatex(buffer127"%f %f %f"origin[0], origin[1], origin[2]) 

Solved

Why 127, if buffer's size is 50?
And you must pass the id of the task with it's function.

Also, you should use arkshine's method. I got a little confused with the task's parameters' location. :o

Hawk552 02-02-2009 10:13

Re: Float Task
 
Quote:

Originally Posted by Dores (Post 754319)
Why 127, if buffer's size is 50?
And you must pass the id of the task with it's function.

Also, you should use arkshine's method. I got a little confused with the task's parameters' location. :o

No, you don't have to pass an id. You can simply pass "_" (the default parameter token) or 0.

AntiBots 02-02-2009 10:19

Re: Float Task
 
Quote:

Originally Posted by Dores (Post 754319)
Why 127, if buffer's size is 50?

Sorry I edit wrong then i copy to here. :D


All times are GMT -4. The time now is 01:40.

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