Raised This Month: $51 Target: $400
 12% 

Solved Why i get this warning?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
TFZMistery
Junior Member
Join Date: Jul 2013
Old 03-05-2019 , 18:34   Why i get this warning?
Reply With Quote #1

Hi, i was making a zombie classes for my server, but i create native for every single one, but the native gives me warning and i dont know why. What should i change?

PHP Code:
public native_is_user_sleep_zombie(id
{
    if(
zp_get_user_zombie_class(id) == g_zclass_sleeper)
    {
        return 
true;
    }
    else
    {
        return 
false;
    }

Code:
WARNING [63]: function "native_is_user_sleep_zombie" should return a value
Thanks!

Last edited by TFZMistery; 03-14-2019 at 01:27. Reason: Solved! Thanks everyone! :bacon!:
TFZMistery is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 03-05-2019 , 18:48   Re: Why i get this warning?
Reply With Quote #2

Code:
public native_is_user_sleep_zombie(id)  {     if(zp_get_user_zombie_class(id) == g_zclass_sleeper)     {         return true;     }         return false; }
__________________








CrazY. is offline
eat1k
Senior Member
Join Date: Apr 2018
Old 03-06-2019 , 16:05   Re: Why i get this warning?
Reply With Quote #3

PHP Code:
public native_is_user_sleep_zombie(id)  
{
    return 
bool:(zp_get_user_zombie_class(id) == g_zclass_sleeper);

P.S. Style 1 is bad, use style 0. Something like this:

PHP Code:
public native_is_user_sleep_zombie(iPluginiParams)  
{
    
enum player };

    new 
iPlayer get_param(player);

    if(!(
<= iPlayer <= MaxClients))
        
abort(AMX_ERR_NATIVE"Player out of range (%d)"iPlayer);

    return 
bool:(zp_get_user_zombie_class(iPlayer) == g_zclass_sleeper);

__________________

Last edited by eat1k; 03-06-2019 at 16:08.
eat1k is offline
JocAnis
Veteran Member
Join Date: Jun 2010
Old 03-06-2019 , 20:40   Re: Why i get this warning?
Reply With Quote #4

@eat1k what could go wrong with 1 native style?
__________________
KZ Public Autocup - PrimeKZ

My blog: http://primekz.xyz (in progress...) - not active (dec 2022)
JocAnis is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 03-07-2019 , 08:04   Re: Why i get this warning?
Reply With Quote #5

From the API:

Quote:
Style 1 natives are deprecated. Plugins should not use them, they might break.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
TFZMistery
Junior Member
Join Date: Jul 2013
Old 03-07-2019 , 18:23   Re: Why i get this warning?
Reply With Quote #6

Quote:
Originally Posted by OciXCrom View Post
From the API:
Quote:
Style 1 natives are deprecated. Plugins should not use them, they might break.
But how will they break? I use them literally everywhere, but no problems.
TFZMistery is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 03-08-2019 , 13:00   Re: Why i get this warning?
Reply With Quote #7

I don't really know, but I'm sure that note in the API is there for a reason. You should consider changing them to style 0.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
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:49.


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