Raised This Month: $ Target: $400
 0% 

Set_task tag mismatch


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
t3hNox
Senior Member
Join Date: Oct 2009
Old 08-23-2010 , 19:07   Set_task tag mismatch
Reply With Quote #1

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.
t3hNox is offline
platzpatrone
Veteran Member
Join Date: Apr 2007
Location: Germany
Old 08-23-2010 , 19:11   Re: Set_task tag mismatch
Reply With Quote #2

PHP Code:
SpawnEnt(Float:origin[]) 

         
//all the stuff 

platzpatrone is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 08-23-2010 , 19:13   Re: Set_task tag mismatch
Reply With Quote #3

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)

__________________

Last edited by Bugsy; 08-23-2010 at 19:17.
Bugsy is offline
t3hNox
Senior Member
Join Date: Oct 2009
Old 08-24-2010 , 02:58   Re: Set_task tag mismatch
Reply With Quote #4

Thank you both for help.
It seems the problem was solved by adding _: to origin. I don't know what _: does.
t3hNox is offline
lazarev
Veteran Member
Join Date: Sep 2008
Old 08-24-2010 , 03:07   Re: Set_task tag mismatch
Reply With Quote #5

I think without _: task will take only origin[0]
lazarev is offline
Owner123
Member
Join Date: Jun 2010
Old 08-24-2010 , 06:57   Re: Set_task tag mismatch
Reply With Quote #6

_: do cast to integer.
__________________
Sorry for my bad english !
Owner123 is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-24-2010 , 07:18   Re: Set_task tag mismatch
Reply With Quote #7

_: = untag the var.
__________________
Arkshine is offline
t3hNox
Senior Member
Join Date: Oct 2009
Old 08-24-2010 , 13:43   Re: Set_task tag mismatch
Reply With Quote #8

Thanks.
I think I have understood.
t3hNox is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 08-24-2010 , 13:50   Re: Set_task tag mismatch
Reply With Quote #9

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
__________________

Last edited by Bugsy; 08-24-2010 at 13:53.
Bugsy 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 22:01.


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