Raised This Month: $ Target: $400
 0% 

Native Problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Crizzatu
Member
Join Date: May 2012
Old 07-01-2014 , 11:18   Native Problem
Reply With Quote #1

How i can get name days with native? I need to put in hudmessage syntax!

Problem:
Code:
L 07/01/2014 - 14:34:11: [AMXX] Run time error 10 (plugin "jbextream.amxx") (native "get_game") - debug not enabled!
L 07/01/2014 - 14:34:11: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
Native:
Code:
public native_get_game(){ return gs_DaysList[ gi_WichDay-1 ]
List of Game name:
Code:
new const gs_DaysList[ ][ ] =
{
	"GodMode Day",	// 1
	"Furien Day",	// 2
	"HNS Day",	// 3
	"Nightcrawler Day", // 4
	"Zombie Day", 	// 5
	"Spartan Day",	// 6
	"Gravity Day",	// 7
	"Grenade Day",	// 8
	"HNS Simple Day"// 9
};
Crizzatu is offline
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 07-01-2014 , 12:30   Re: Native Problem
Reply With Quote #2

This should not be native. It's better as a stock, I think. (not really sure for the stock, but definately native is not the best) Just replace
PHP Code:
public native_get_game() 
with
PHP Code:
stock get_game() 
__________________
Flick3rR is offline
Send a message via Skype™ to Flick3rR
Freezo Begin
BANNED
Join Date: Mar 2014
Location: Morocco
Old 07-01-2014 , 12:47   Re: Native Problem
Reply With Quote #3

Quote:
Originally Posted by Flick3rR View Post
This should not be native. It's better as a stock, I think. (not really sure for the stock, but definately native is not the best) Just replace
PHP Code:
public native_get_game() 
with
PHP Code:
stock get_game() 
i think it's the same thing .
Crizzatu did you add register_native ?

Last edited by Freezo Begin; 07-01-2014 at 12:48.
Freezo Begin is offline
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 07-01-2014 , 13:25   Re: Native Problem
Reply With Quote #4

I don't think he needs natives here, since I guess he is not going to use it in other plugins. Just modifying it to stock will solute the problem. That's why I mentioned, that creating a native is not the best way.
__________________
Flick3rR is offline
Send a message via Skype™ to Flick3rR
Crizzatu
Member
Join Date: May 2012
Old 07-01-2014 , 14:41   Re: Native Problem
Reply With Quote #5

What is the best way ?
Crizzatu is offline
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 07-01-2014 , 14:49   Re: Native Problem
Reply With Quote #6

Try with stock. I think it should be the most usefull way, since you don't use it as a native in other plugins.
__________________
Flick3rR is offline
Send a message via Skype™ to Flick3rR
Crizzatu
Member
Join Date: May 2012
Old 07-01-2014 , 16:30   Re: Native Problem
Reply With Quote #7

I need with native because i need to put hudmessage name of days in another plugin.
Crizzatu is offline
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 07-01-2014 , 16:43   Re: Native Problem
Reply With Quote #8

You can search at all. But this information helped me alot.
https://forums.alliedmods.net/showthread.php?t=41251
__________________
Flick3rR is offline
Send a message via Skype™ to Flick3rR
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 07-01-2014 , 21:45   Re: Native Problem
Reply With Quote #9

Flick3rR please stop posting when you don't know the answer.

@Crizzatu

First ensure that the native is registered correctly:
PHP Code:
public plugin_natives()
{
    
register_native"get_game""native_get_game" ):

Next, you should note that strings canot be returned through natives as they can from usual stocks.
The string will be sent back and passed byref. So here's how it should look:
PHP Code:
public native_get_game(/*iPlugin, iParams*/)
{
    return 
set_string2gs_DaysListget_param)-], get_param) );

To get the name from the other plugin, you would do something like this:
PHP Code:
public SomeFunction()
{
    .
/*
        <^> For example let's get the name of day number 1.
    */
    
    
new szDay32 ];
    
get_game1szDaycharsmaxszDay ) );
    
    
/*
        <^> szDay now holds the day name.
    */
        

Make sure that you have the following inside your include file ( if you have one ), or otherwise in your plugin:

PHP Code:
native get_gameiIndexszName[], iLen ); 
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.
hornet 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 21:17.


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