Raised This Month: $ Target: $400
 0% 

[HELP] Native mismatch problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
kapitana
Member
Join Date: Apr 2014
Old 05-17-2016 , 12:27   [HELP] Native mismatch problem
Reply With Quote #1

Hello AlliedModders,
I am experiencing a problem with one of my codes .. which I thought would work properly .. but I get a mismatch problem when I compile .. if someone has a solution for it .. pls share. Thnx in advance .

Code:
new Float:new_health[33]

In public plugin_natives():
register_native("get_user_new_health", "native_get_user_new_health", 1)

// Native: get_user_new_health
public native_get_user_new_health(id)
{
return new_health[id]
} // - I get a mismatch problem on this line and i thought that it might be because its registered as Float ... but i couldn't think of anything else to solve this problem. If anyone knows how to fix this problem .. pls share.
kapitana is offline
SpeeDeeR
Veteran Member
Join Date: Mar 2010
Location: Bulgaria
Old 05-17-2016 , 12:40   Re: [HELP] Native mismatch problem
Reply With Quote #2

PHP Code:
public Floatnative_get_user_new_health(id
or
PHP Code:
public native_get_user_new_health(id)
{
    return 
_:new_health[id]

which wont return float.

and check this tutorial.

Last edited by SpeeDeeR; 05-17-2016 at 12:42.
SpeeDeeR is offline
kapitana
Member
Join Date: Apr 2014
Old 05-17-2016 , 12:46   Re: [HELP] Native mismatch problem
Reply With Quote #3

It works! ... thank you for the fast answer. I will check out the tutorial too
kapitana is offline
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 05-17-2016 , 12:48   Re: [HELP] Native mismatch problem
Reply With Quote #4

Because new_health[id] will return a float value.
You need just to add Float after public.
And also when you will use the native in other plugin you will have to add float too, like this :

PHP Code:
#include <amxmodx> 

new Float:new_health[33]

public 
plugin_natives() register_native("get_user_new_health""native_get_user_new_health"1)

public 
Float:native_get_user_new_health(id)
{
return 
new_health[id]
}

//When you add it in other plugins...
native Float:get_user_new_health(id
siriusmd99 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 18:44.


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