Raised This Month: $ Target: $400
 0% 

native returns float


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
MPNumB
Veteran Member
Join Date: Feb 2007
Location: Lithuania
Old 02-28-2009 , 01:20   native returns float
Reply With Quote #1

I am wondering how can I create a native what returns float?
__________________
Skill and no annoying bugs with fixed balance issues is my goal!
My approved plugins what don't show up in Approved List:
* Bomb/Death/CSS Radar
* HotVision
___
Need help? Please check this documentation first.
MPNumB is offline
Send a message via Skype™ to MPNumB
AntiBots
Veteran Member
Join Date: May 2008
Location: Brazil
Old 02-28-2009 , 01:36   Re: native returns float
Reply With Quote #2

public Float:return_float(id)


native Float:return_float(id)

EDIT: Use Style 1
__________________
AntiBots is offline
Send a message via ICQ to AntiBots Send a message via MSN to AntiBots Send a message via Skype™ to AntiBots
danielkza
AMX Mod X Plugin Approver
Join Date: May 2007
Location: São Paulo - Brasil
Old 02-28-2009 , 02:20   Re: native returns float
Reply With Quote #3

Since Pawn has no real types, every variable is a cell, so the tag you return doesn't actually mather, in none of the styles. Just make sure the native declaration has the Float tag so you don't get 'tag mismatch' warnings.

Code:
native Float:MyPrettyFloatNative(Float:blah)
__________________

Community / No support through PM

Last edited by danielkza; 02-28-2009 at 02:25.
danielkza is offline
MPNumB
Veteran Member
Join Date: Feb 2007
Location: Lithuania
Old 02-28-2009 , 04:19   Re: native returns float
Reply With Quote #4

Quote:
Originally Posted by AntiBots View Post
public Float:return_float(id)


native Float:return_float(id)

EDIT: Use Style 1
Thanks. Discussion over. =)

Quote:
Originally Posted by danielkza View Post
Since Pawn has no real types, every variable is a cell, so the tag you return doesn't actually mather, in none of the styles. Just make sure the native declaration has the Float tag so you don't get 'tag mismatch' warnings.

Code:
native Float:MyPrettyFloatNative(Float:blah)
I just had problems with with 'tag mismatch' cuz didn't knew that it's possible to to cassify type after function "public".
__________________
Skill and no annoying bugs with fixed balance issues is my goal!
My approved plugins what don't show up in Approved List:
* Bomb/Death/CSS Radar
* HotVision
___
Need help? Please check this documentation first.
MPNumB is offline
Send a message via Skype™ to MPNumB
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 02-28-2009 , 13:59   Re: native returns float
Reply With Quote #5

@AntiBots
Style 1 isn't required. The style is just a preference:
Code:
// include file native Float:get_float(index); // plugin with style 1 public plugin_natives() {     register_native("get_float", "_get_float", 1); } public Float:_get_float(index) {     // code } // plugin with style 0 public plugin_natives() {     register_native("get_float", "_get_float"); } public Float:_get_float(plugin, params) {     new index = get_param(1);     // code }

I prefer style 0.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 02-28-2009 , 16:18   Re: native returns float
Reply With Quote #6

Quote:
NOTE: Style should always be 0. The "dJeyL" mode value of 1 is deprecated, since it is not properly compatible with any by-reference type.

The advantage to keeping style set to 0 is that it more closely resembles the AMX Mod/X module API.

Anyway, i think NumB was talking about internal plugin native, aka simple function
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 02-28-2009 , 18:12   Re: native returns float
Reply With Quote #7

Well, he said create a native, so everyone assumed dynamic natives, rather than an internal function.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] 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 16:51.


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