AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Set_task tag mismatch (https://forums.alliedmods.net/showthread.php?t=136185)

t3hNox 08-23-2010 19:07

Set_task tag mismatch
 
Hi,
I have a problem with setting a pamateter to a set_task.
The idea is that an entity is respawned some time after it is picked up. Sorry, I don't have the full code in this computer.
PHP Code:

SpawnEnt(Float:origin)
{
         
//all the stuff
}

public 
EntTouch(enttoucher)
{
    new 
Float:origin[3]
    
pev(ent,pev_origin,origin)   

    
set_task(10.0"SpawnEnt",ent ENTTASKorigin3)
    
remove_entity(ent)


I think, the idea is clear. I need the origin parameter for SpawnEnt function to set the previous origin to an entity. However the compliter shows a tag mismatch warning and no entity is created after set_task time is over.
I'm using random locations generator by joropito that's why I use this method for respawning an entity.

platzpatrone 08-23-2010 19:11

Re: Set_task tag mismatch
 
PHP Code:

SpawnEnt(Float:origin[]) 

         
//all the stuff 



Bugsy 08-23-2010 19:13

Re: Set_task tag mismatch
 
1. de-tag the Float array in set_task
2. make SpawnEnt public
3. make the origin param an array in SpawnEnt

untested
PHP Code:

public SpawnEntFloat:origin[3] , entity )
{
         
//unsure if you needed this or not
         
new ent entity ENTTASK;
     
}

public 
EntTouch(enttoucher)
{
    new 
Float:origin[3]
    
pev(ent,pev_origin,origin)   
    
set_task(10.0"SpawnEnt",ent ENTTASK_:originsizeoforigin ) )
    
remove_entity(ent)



t3hNox 08-24-2010 02:58

Re: Set_task tag mismatch
 
Thank you both for help.
It seems the problem was solved by adding _: to origin. I don't know what _: does.

lazarev 08-24-2010 03:07

Re: Set_task tag mismatch
 
I think without _: task will take only origin[0]

Owner123 08-24-2010 06:57

Re: Set_task tag mismatch
 
_: do cast to integer.

Arkshine 08-24-2010 07:18

Re: Set_task tag mismatch
 
_: = untag the var.

t3hNox 08-24-2010 13:43

Re: Set_task tag mismatch
 
Thanks.
I think I have understood. :)

Bugsy 08-24-2010 13:50

Re: Set_task tag mismatch
 
The reason for the tag mismatch warning is set_task is written to accept an integer array, not a float array. Un-tagging the float array makes set_task think its an integer (untagged) array.

http://www.amxmodx.org/funcwiki.php?go=func&id=253


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

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