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

natives


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Sanjay Singh
Veteran Member
Join Date: Sep 2016
Old 01-13-2020 , 04:41   natives
Reply With Quote #1

how to can I forward variable data to another plugin using native?

I want to forward
PHP Code:
lastmap
lastmod
[0]
currentmod 
so i can use it like in other plugin
PHP Code:
getcurrentmod() 
getcurrentmap()
getlastmod() 
__________________
Sanjay Singh is offline
Send a message via AIM to Sanjay Singh
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 01-13-2020 , 05:15   Re: natives
Reply With Quote #2

Start by reading the tutorial about natives made by Hawk.
__________________
HamletEagle is offline
Sanjay Singh
Veteran Member
Join Date: Sep 2016
Old 01-13-2020 , 05:49   Re: natives
Reply With Quote #3

Quote:
Originally Posted by HamletEagle View Post
Start by reading the tutorial about natives made by Hawk.
I tried creating natives but in this case when i use native and my other plugin it shows
PHP Code:
error argument mismatch 
__________________
Sanjay Singh is offline
Send a message via AIM to Sanjay Singh
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 01-13-2020 , 07:23   Re: natives
Reply With Quote #4

Did it occur to you that you should post what you tried so we can see what is wrong and fix it?
__________________
HamletEagle is offline
Sanjay Singh
Veteran Member
Join Date: Sep 2016
Old 01-13-2020 , 08:59   Re: natives
Reply With Quote #5

PHP Code:
public plugin_natives()
{
    
register_library("multimod");
    
register_native("mm_get_currentmod""native_mm_get_currentmod");
    
register_native("mm_get_currentmap""native_mm_get_currentmap");
    
register_native("mm_get_lastmod""native_mm_get_lastmod");
    
register_native("mm_get_lastmap""native_mm_get_lastmap");


public 
native_mm_get_currentmod()
{
    return 
g_currentmod;
}

public 
native_mm_get_currentmap()
{
    return 
g_currentmap;
}

public 
native_mm_get_lastmod()
{
    return 
g_lastmods[0];
}

public 
native_mm_get_lastmap()
{
    return 
g_lastmap;

include
PHP Code:
#pragma reqlib "multimod"

native mm_get_currentmod();
native mm_get_currentmap();
native mm_get_lastmod();
native mm_get_lastmap(); 
SubPlugin
PHP Code:
#include <multimod>

client_print_color(id0"Current Mod: %s"mm_get_currentmod()); 
__________________

Last edited by Sanjay Singh; 01-13-2020 at 08:59.
Sanjay Singh is offline
Send a message via AIM to Sanjay Singh
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 01-13-2020 , 10:21   Re: natives
Reply With Quote #6

Post the definitions for g_currentmod, g_currentmap, g_lastmods, g_lastmap. I suspect all of this are strings(arrays) and you can't pass them around like you are trying to.

You should use set_array to achieve that functionality.
__________________
HamletEagle is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 01-13-2020 , 15:26   Re: natives
Reply With Quote #7

Also, I'm pretty sure "#pragma reqlib" is no longer required. You should instead do the same as the default AMXX .inc files:

Code:
#if defined _multimod_included     #endinput #endif #define _multimod_included

This will prevent the file from getting included multiple times, even though it's not likely to happen.
__________________

Last edited by OciXCrom; 01-13-2020 at 15:26.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Natsheh
Veteran Member
Join Date: Sep 2012
Location: Muslim and proud!
Old 01-14-2020 , 01:42   Re: natives
Reply With Quote #8

If you are sharing integers or float AKA double values variables. you can share them with xvar natives by declaring the variables with public.

Here is a tutorial on how to achieve that.
__________________
@Jailbreak MOD [Alot of features + API] 100% done !
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Last edited by Natsheh; 01-14-2020 at 01:44.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
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 07:27.


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