Raised This Month: $ Target: $400
 0% 

native problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
georgik57
Veteran Member
Join Date: Oct 2008
Location: 🎧Music World
Old 04-04-2011 , 14:12   native problem
Reply With Quote #1

what's wrong here?
i get this error:

PHP Code:
// Native: zpnm_get_user_knockback
public native_get_user_knockback(id)
{
    
// ZP disabled
    
if (!g_pluginenabled)
        return -
1;
    
    if (!
is_user_valid_connected(id)
    || !
is_user_valid_alive(id)
    || !
g_zombie[id])
        return 
0;
    
    if (
g_nemesis[id])
        return 
get_pcvar_float(cvar_nemknockback);
    else
        return 
g_zombie_knockback[id];
    
    return 
1;

Attached Thumbnails
Click image for larger version

Name:	fără titlu.PNG
Views:	291
Size:	16.1 KB
ID:	84377  
__________________
georgik57 is offline
Send a message via MSN to georgik57 Send a message via Yahoo to georgik57 Send a message via Skype™ to georgik57
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 04-04-2011 , 14:28   Re: native problem
Reply With Quote #2

1. I see no errors.
2. What line is it. You should post details when you ask questions.
__________________
fysiks is offline
georgik57
Veteran Member
Join Date: Oct 2008
Location: 🎧Music World
Old 04-04-2011 , 14:35   Re: native problem
Reply With Quote #3

Quote:
Originally Posted by fysiks View Post
1. I see no errors.
2. What line is it. You should post details when you ask questions.
the 2 lines are:
PHP Code:
return get_pcvar_float(cvar_nemknockback); 
PHP Code:
return g_zombie_knockback[id]; 
__________________
georgik57 is offline
Send a message via MSN to georgik57 Send a message via Yahoo to georgik57 Send a message via Skype™ to georgik57
lis_16
Senior Member
Join Date: Feb 2008
Old 04-04-2011 , 15:23   Re: native problem
Reply With Quote #4

PHP Code:
return get_pcvar_float(cvar_nemknockback); 
Should return an intergral value, not a float.
lis_16 is offline
georgik57
Veteran Member
Join Date: Oct 2008
Location: 🎧Music World
Old 04-04-2011 , 16:11   Re: native problem
Reply With Quote #5

Quote:
Originally Posted by lis_16 View Post
PHP Code:
return get_pcvar_float(cvar_nemknockback); 
Should return an intergral value, not a float.
well i need to return it as a float
it's the gravity multiplier (ex: 0.5 * 800) so i can't just have a integral number
how can i do that?
help please. thanks
__________________
georgik57 is offline
Send a message via MSN to georgik57 Send a message via Yahoo to georgik57 Send a message via Skype™ to georgik57
matsi
Thinkosaur
Join Date: Sep 2006
Old 04-04-2011 , 16:19   Re: native problem
Reply With Quote #6

Quote:
Originally Posted by georgik57 View Post
well i need to return it as a float
it's the gravity multiplier (ex: 0.5 * 800) so i can't just have a integral number
how can i do that?
help please. thanks
Make sure your cvar is float. I think you have integer value in your cvar but you're trying to get float value.
matsi is offline
georgik57
Veteran Member
Join Date: Oct 2008
Location: 🎧Music World
Old 04-04-2011 , 16:26   Re: native problem
Reply With Quote #7

new cvar_nemknockback => new Float:cvar_nemknockback ???
in the rest of the plugin it works as a float without any problems...
also g_zombie_knockback is defined as a float and i get the same error for it too
__________________
georgik57 is offline
Send a message via MSN to georgik57 Send a message via Yahoo to georgik57 Send a message via Skype™ to georgik57
matsi
Thinkosaur
Join Date: Sep 2006
Old 04-04-2011 , 16:30   Re: native problem
Reply With Quote #8

Quote:
Originally Posted by georgik57 View Post
new cvar_nemknockback => new Float:cvar_nemknockback ???
in the rest of the plugin it works as a float without any problems...
also g_zombie_knockback is defined as a float and i get the same error for it too
i mean is your cvar:
my_cvar "1" <-- Int

or

my_cvar "1.0" <-- Float

Last edited by matsi; 04-04-2011 at 16:35.
matsi is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 04-04-2011 , 16:35   Re: native problem
Reply With Quote #9

Code:
public native_get_user_knockback(id)
->
Code:
public Float:native_get_user_knockback(id)
Code:
return -1
->
Code:
return -1.0
Code:
return 0
->
Code:
return 0.0
Code:
return 1
->
Code:
return 1.0
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
georgik57
Veteran Member
Join Date: Oct 2008
Location: 🎧Music World
Old 04-04-2011 , 16:35   Re: native problem
Reply With Quote #10

Quote:
Originally Posted by matsi View Post
i mean is your cvar:
my_cvar "1" <-- Int

or

my_cvar "1.0" <-- Float
yes it is like that
PHP Code:
cvar_nemknockback register_cvar("zp_knockback_nemesis""0.25"
anyway...i think i fixed it
did the following...is it correct? it compiles with no warnings or errors.
PHP Code:
// Native: zpnm_get_user_knockback
public Float:native_get_user_knockback(id)
{
    
// ZP disabled
    
if (!g_pluginenabled)
        return -
1.0;
    
    if (!
is_user_valid_connected(id)
    || !
is_user_valid_alive(id)
    || !
g_zombie[id])
        return 
0.0;
    
    if (
g_nemesis[id])
        return 
get_pcvar_float(cvar_nemknockback);
    else
        return 
g_zombie_knockback[id];
    
    return 
1.0;

EDIT: emp...lol xD
so it is correct right?
glad i figured it out myself ^^
THANK YOU GUYS FOR YOUR HELP. i really appreciate it.
__________________

Last edited by georgik57; 04-04-2011 at 16:38.
georgik57 is offline
Send a message via MSN to georgik57 Send a message via Yahoo to georgik57 Send a message via Skype™ to georgik57
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 14:40.


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