Raised This Month: $ Target: $400
 0% 

How can i connect an array from one plugin to another?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Nyuszy
Senior Member
Join Date: Apr 2009
Old 06-23-2011 , 13:24   Re: How can i connect an array from one plugin to another?
Reply With Quote #1

you can use fake natives

add to the bank plugin:
PHP Code:
public plugin_natives()
{
    
register_native("get_user_bank""_get_user_bank")
    
register_native("set_user_bank""_set_user_bank")
}
// ...
public _get_user_bank(pluginparams)
{
    if(
params != 1)
        return 
PLUGIN_CONTINUE
    
new id get_param(1)
    return 
bank[id]
}

public 
_set_user_bank(pluginparams)
{
    if(
params != 2)
        return 
PLUGIN_CONTINUE
    
new id get_param(1)
    new 
money get_param(2)
    
bank[id] = money
    
return PLUGIN_HANDLED

add this to your plugin:
PHP Code:
native get_user_bank(id)
native set_user_bank(idmoney
and then you can use get_user_bank and set_user_bank in your plugin to handle the player's bank
Nyuszy is offline
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 06-23-2011 , 15:59   Re: How can i connect an array from one plugin to another?
Reply With Quote #2

Or you could achieve the same with one line of code by using xvars.
SnoW is offline
Send a message via MSN to SnoW
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 23:24.


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