Raised This Month: $32 Target: $400
 8% 

Prototypes error


Post New Thread Reply   
 
Thread Tools Display Modes
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 01-17-2016 , 15:56   Re: Prototypes error
Reply With Quote #11

Quote:
Originally Posted by WildCard65 View Post
I should note, CreateDataTimer creates a DataPack handle for you and sends it off to the timer and once the function is over, the variable you passed for the datapack param is giving said handle that you do the WriteCell on(after CreateDataTimer execution).
I mentioned that the function byrefs a newly created DataPack back. Anyway, you explained it much more detailed, good job.

Quote:
Originally Posted by WildCard65 View Post
Klippy, typeset is similar in funcnum.
Never heard of a funcnum. As I said before in this thread, I've never written a SourceMod plugin, I'm writing stuff only for AMXX. But I do get what a typeset is.

Last edited by klippy; 01-17-2016 at 15:56.
klippy is offline
TheDS1337
Veteran Member
Join Date: Jun 2012
Old 01-17-2016 , 16:02   Re: Prototypes error
Reply With Quote #12

Quote:
Originally Posted by WildCard65 View Post
I should note, CreateDataTimer creates a DataPack handle for you and sends it off to the timer and once the function is over, the variable you passed for the datapack param is giving said handle that you do the WriteCell on(after CreateDataTimer execution).
Yeap, thanks but it's the same way anyways.
TheDS1337 is offline
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 01-17-2016 , 16:12   Re: Prototypes error
Reply With Quote #13

Quote:
Originally Posted by KliPPy View Post
Never heard of a funcnum. As I said before in this thread, I've never written a SourceMod plugin, I'm writing stuff only for AMXX. But I do get what a typeset is.
Then what is the AMXX equivalent if it's not funcnum?
WildCard65 is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 01-17-2016 , 17:07   Re: Prototypes error
Reply With Quote #14

Quote:
Originally Posted by WildCard65 View Post
Then what is the AMXX equivalent if it's not funcnum?
AMXX has no prototype check on functions. That's one of the key features I miss in AMXX. Instead of passing the function address directly, you would pass in its name. This removes type-safety, requires your callbacks to be public, compiler cannot do type and name checks, and makes it slower (VM has to find the function address by searching public functions table) - lots of downsides.

The timers equivalent in AMXX are tasks:
PHP Code:
//set_task(<time>, <function>);
set_task(1337.0"DoMyTask");

public 
DoMyTask() {
    
// Executed after 1337 seconds

klippy is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 01-18-2016 , 13:09   Re: Prototypes error
Reply With Quote #15

PHP Code:
    DataPack entityInfo;    
    
    
entityInfo.WriteCell(entity);
    
    
CreateDataTimer(15.0Timer_EntityentityInfo); 
The order of these statements needs to change. Specifically, it needs to be
PHP Code:
    DataPack entityInfo;    
    
    
CreateDataTimer(15.0Timer_EntityentityInfo);

    
entityInfo.WriteCell(entity); 
I know it seems backwards, but entityInfo is essentially a Handle and the Handle is created inside the CreateDataTimer call. However, because it's a Handle, the actual data it stores is essentially stored by reference.

Quote:
Originally Posted by WildCard65 View Post
Then what is the AMXX equivalent if it's not funcnum?
funcenum (i.e. function enumeration), not funcnum.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 01-18-2016 at 13:12.
Powerlord is offline
TheDS1337
Veteran Member
Join Date: Jun 2012
Old 01-18-2016 , 13:44   Re: Prototypes error
Reply With Quote #16

Quote:
Originally Posted by Powerlord View Post
PHP Code:
    DataPack entityInfo;    
    
    
entityInfo.WriteCell(entity);
    
    
CreateDataTimer(15.0Timer_EntityentityInfo); 
The order of these statements needs to change. Specifically, it needs to be
PHP Code:
    DataPack entityInfo;    
    
    
CreateDataTimer(15.0Timer_EntityentityInfo);

    
entityInfo.WriteCell(entity); 
I know it seems backwards, but entityInfo is essentially a Handle and the Handle is created inside the CreateDataTimer call. However, because it's a Handle, the actual data it stores is essentially stored by reference.
Yes Powerlord! I realized that and that's why I didnt want to use CreateDataTimer tbh, I'm a lot into organizing stuff here and there..., so instead I did something like:
PHP Code:
        DataPack entityInfo = new DataPack();

        
entityInfo.WriteCell(entity);

        
CreateTimer(15.0Timer_EntityentityInfoTIMER_DATA_HNDL_CLOSE); 
and It's working just fine.

Last edited by TheDS1337; 01-18-2016 at 15:18.
TheDS1337 is offline
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 01-18-2016 , 14:29   Re: Prototypes error
Reply With Quote #17

Quote:
Originally Posted by DeagLe.Studio View Post
PHP Code:
CreateTimer(15.0Timer_EntityentityInfoentityInfoTIMER_DATA_HNDL_CLOSE); 
Uh, why you doing 5 arguments when CreateTimer only takes 4? Also CreateDataTimer does the passing of the handle and appends the auto handle closing flag to the timer.
WildCard65 is offline
TheDS1337
Veteran Member
Join Date: Jun 2012
Old 01-18-2016 , 15:17   Re: Prototypes error
Reply With Quote #18

Quote:
Originally Posted by WildCard65 View Post
Uh, why you doing 5 arguments when CreateTimer only takes 4? Also CreateDataTimer does the passing of the handle and appends the auto handle closing flag to the timer.
It's the same thing I guess, both ways call CreateTimer ;)
TheDS1337 is offline
Reply


Thread Tools
Display Modes

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 18:52.


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