Raised This Month: $ Target: $400
 0% 

Get global via native


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 07-21-2014 , 16:53   Re: Get global via native
Reply With Quote #8

Well, here is what am I using.
PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>

new MyVariable[33], isDedicatediMaxPlayers

public plugin_init()
{
    
isDedicated is_dedicated_server()
    
iMaxPlayers get_maxplayers()
}

public 
plugin_natives()
{
    
register_native("get_user_gold""_get_user_gold")
}

public 
_get_user_gold(iPluginiParams)
{
    if(
iParams != 1)
        return 
PLUGIN_CONTINUE
        
    
new id get_param(1)
    
    if(!(
isDedicated <= id <= iMaxPlayers))
        return 
PLUGIN_CONTINUE
        
    
return MyVariable[id]

For me it's quite simple. Here are only the basic checks, and you just return your variable. There isn't anything much to explain, indeed.
P.S.: IsDedicated stuff, for the most clear check (because it depends for the loop. If the server is dedicated, they begin from 1, otherwise, they begin from 0). Thanks to Black Rose (again)!
__________________

Last edited by Flick3rR; 07-21-2014 at 16:54.
Flick3rR is offline
Send a message via Skype™ to Flick3rR
 



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 19:14.


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