AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [HELP] Native mismatch problem (https://forums.alliedmods.net/showthread.php?t=282798)

kapitana 05-17-2016 12:27

[HELP] Native mismatch problem
 
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 :D.

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.

SpeeDeeR 05-17-2016 12:40

Re: [HELP] Native mismatch problem
 
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.

kapitana 05-17-2016 12:46

Re: [HELP] Native mismatch problem
 
It works! :D ... thank you for the fast answer. I will check out the tutorial too

siriusmd99 05-17-2016 12:48

Re: [HELP] Native mismatch problem
 
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



All times are GMT -4. The time now is 18:44.

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