Raised This Month: $ Target: $400
 0% 

Native help


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 05-07-2018 , 11:42   Re: Native help
Reply With Quote #7

new iLevel[33] = 5
This will only set iLevel[0] to 5, which will be ignored since the plugin returns 0 if the id is 0.

The native works as intended.

Code:
/* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <amxmisc> #define PLUGIN "Native Test" #define VERSION "1.0" #define AUTHOR "author" new iLevel[33] = 5; public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     } public plugin_natives() {     register_library("level_test")     iLevel[2] = 666;     for ( new i ; i < sizeof iLevel ; i++ )         server_print("iLevel[%d]: %d", i, iLevel[i]);         register_native("get_user_level", "_get_user_level") } public _get_user_level(iPlugin, iParams) {     if(iParams != 1)         return 0         new id = get_param(1)     server_print("id: %d", id);         if(!id) {         return 0     }         return iLevel[id] }
Code:
/* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <amxmisc> #pragma reqlib "level_test" native get_user_level(id) #define PLUGIN "Test Plugin" #define VERSION "1.0" #define AUTHOR "author" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)         register_concmd("test", "Test") } public Test(id) {     server_print("level: %d", get_user_level(2)) }
Code:
iLevel[0]: 5
iLevel[1]: 0
iLevel[2]: 666
iLevel[3]: 0
iLevel[4]: 0
iLevel[5]: 0
iLevel[6]: 0
iLevel[7]: 0
iLevel[8]: 0
iLevel[9]: 0

... and so on...

test
id: 2
level: 666
__________________

Last edited by Black Rose; 05-07-2018 at 11:44.
Black Rose is offline
 



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 04:43.


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