|
New Member
|

09-01-2015
, 14:43
Re: [?]saving a value on user id
|
#5
|
Thank you, this helped, but I bumped into another thing related to this array.
i print values to check whether they were assigned correctly, and on the part "mainvipmenu" the value remains what it was assigned, however i tried printing out the value of vipPlayerValues on the round start and it always gives me a 0, and so if it's a zero it is neither of the cases.
i commented on the code what I tried, but still same result 
might you spot why this is happening? I would appreciate it.
PHP Code:
#include <amxmodx> #include <amxmisc> #include <cstrike> #include <fun>
#define PLUGIN "learn vip plugin" #define VERSION "1.0" #define AUTHOR "me"
#define VIP_FLAG ADMIN_RESERVATION
new vipPlayerValues[33]
new const showvipmenu[]={ "say vipmenu", "say_team vipmenu","say /vipmenu", "say_team vipmenu", "say menu", "say_team menu", "say /menu", "say_team /menu" }
public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR)
for(new i = 0; i < sizeof showvipmenu; i++) register_clcmd(showvipmenu[i], "mainVipmenu", ADMIN_ALL, "brings up vipmenu") register_logevent("roundstart", 2, "0=World triggered", "1=Round_Start")
}
public mainVipmenu(id, lvl, cid){
if(get_user_flags(id) & VIP_FLAG){ //Checks if player is VIP new menu = menu_create("vipmenu", "vipmenuChoices") menu_additem(menu, "option 1", "", 0) // case 0 menu_additem(menu, "option 2", "", 0) // case 1 menu_additem(menu, "option 3", "", 0) // case 2 menu_additem(menu, "option 4", "", 0) // case 3 menu_additem(menu, "option 5", "", 0) // case 4 menu_additem(menu, "option 6", "", 0);// case 5 menu_setprop(menu, MPROP_EXIT, MEXIT_ALL) menu_setprop(menu, MPROP_PERPAGE, 6) menu_setprop(menu, MPROP_EXITNAME, "exit") menu_display(id, menu, 0) } else{ client_print(id, print_chat, "[VIP] you are not a VIP user!") } return PLUGIN_HANDLED }
public vipmenuChoices(id, menu, item){ if(item == MENU_EXIT){ menu_cancel(id) } new command[6], name[64], access, callback menu_item_getinfo(menu, item, access, command, sizeof command - 1, name, sizeof name - 1, callback) switch(item){ case 0:{ client_print(id, print_chat, "The chosen item will be activated next round") vipPlayerValues[id] = 1 } case 1: { client_print(id, print_chat, "The chosen item will be activated next round") vipPlayerValues[id] = 2 } case 2: { client_print(id, print_chat, "The chosen item will be activated next round") vipPlayerValues[id] = 3 } case 3: { client_print(id, print_chat, "The chosen item will be activated next round") vipPlayerValues[id] = 4 } case 4: { client_print(id, print_chat, "The chosen item will be activated next round") vipPlayerValues[id] = 5 } case 5:{ client_print(id, print_chat, "The chosen item will be activated next round") vipPlayerValues[id] = 6 } } client_print(id, print_chat,"vipplayervalues is %d", vipPlayerValues[id]) //here value is printed as it should be, according to the number chosen menu_destroy(menu) return PLUGIN_HANDLED // i tried PLUGIN_CONTINUE instead of PLUGIN_HANDLED same thing.. //also tried return vipPlayerValues[id] }
public roundstart(id, vipPlayerValues[]){ //here tried public roundstart(id) instead
client_print(id, print_chat,"vipplayervalues is %d", vipPlayerValues[id]) //here always gives 0, and no further action
if(vipPlayerValues[id] == 1){ give_item(id, "waepon_m4a1") client_print(id, print_chat, "[VIP] item given") } else if(vipPlayerValues[id] == 2){ give_item(id, "waepon_m4a1") client_print(id, print_chat, "[VIP] item given") } else if(vipPlayerValues[id] == 3){ give_item(id, "waepon_m4a1") client_print(id, print_chat, "[VIP] item given") } else if(vipPlayerValues[id] == 4){ give_item(id, "waepon_m4a1") client_print(id, print_chat, "[VIP] item given") } else if(vipPlayerValues[id] == 5){ give_item(id, "waepon_m4a1") client_print(id, print_chat, "[VIP] item given") } else if(vipPlayerValues[id] == 6){ give_item(id, "waepon_m4a1") client_print(id, print_chat, "[VIP] item given") } return PLUGIN_HANDLED }
Last edited by sentoki; 09-01-2015 at 14:46.
Reason: misspelled
|
|