Raised This Month: $ Target: $400
 0% 

[?]saving a value on user id


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
sentoki
New Member
Join Date: Aug 2015
Old 09-01-2015 , 14:43   Re: [?]saving a value on user id
Reply With Quote #1

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(PLUGINVERSIONAUTHOR)

   
    for(new 
0sizeof showvipmenui++)
        
register_clcmd(showvipmenu[i], "mainVipmenu"ADMIN_ALL"brings up vipmenu")
        
     
register_logevent("roundstart"2"0=World triggered""1=Round_Start")

    
    
}


public 
mainVipmenu(idlvlcid){

    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(menuMPROP_EXITMEXIT_ALL)
        
menu_setprop(menuMPROP_PERPAGE6)
        
menu_setprop(menuMPROP_EXITNAME"exit")
    
        
menu_display(idmenu0)
    }
    
    else{
        
client_print(idprint_chat"[VIP] you are not a VIP user!")
    }
    return 
PLUGIN_HANDLED                                                                                                                                   
}

public 
vipmenuChoices(idmenuitem){
    
    if(
item == MENU_EXIT){
        
        
menu_cancel(id)
    }
    
    new 
command[6], name[64], accesscallback
    
    menu_item_getinfo
(menuitemaccesscommandsizeof command 1namesizeof name 1callback)
    
    switch(
item){
        
        case 
0:{
            
            
client_print(idprint_chat"The chosen item will be activated next round")
            
vipPlayerValues[id] = 1
        
}
        case 
1: {
            
            
client_print(idprint_chat"The chosen item will be activated next round")
            
vipPlayerValues[id] = 2
        
}
        case 
2: {
            
            
client_print(idprint_chat"The chosen item will be activated next round")
            
vipPlayerValues[id] = 3
        
}
        case 
3: {
            
            
client_print(idprint_chat"The chosen item will be activated next round")
            
vipPlayerValues[id] = 4
        
}
        case 
4: {
            
            
client_print(idprint_chat"The chosen item will be activated next round")
            
vipPlayerValues[id] = 5
        
}
        case 
5:{
            
            
client_print(idprint_chat"The chosen item will be activated next round")
            
vipPlayerValues[id] = 6
        
}
    }
    
client_print(idprint_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(idvipPlayerValues[]){  //here tried public roundstart(id) instead

    
client_print(idprint_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(idprint_chat"[VIP] item given")
    }
    
    else if(
vipPlayerValues[id] == 2){
        
give_item(id"waepon_m4a1")
        
client_print(idprint_chat"[VIP] item given")
    }
    
    else if(
vipPlayerValues[id] == 3){
        
give_item(id"waepon_m4a1")
        
client_print(idprint_chat"[VIP] item given")
    
    }
    else if(
vipPlayerValues[id] == 4){
        
give_item(id"waepon_m4a1")
        
client_print(idprint_chat"[VIP] item given")
    }
    
    else if(
vipPlayerValues[id] == 5){
        
give_item(id"waepon_m4a1")
        
client_print(idprint_chat"[VIP] item given")
    }
    
    else if(
vipPlayerValues[id] == 6){
        
give_item(id"waepon_m4a1")
        
client_print(idprint_chat"[VIP] item given")
    
    }
    
    return 
PLUGIN_HANDLED


Last edited by sentoki; 09-01-2015 at 14:46. Reason: misspelled
sentoki is offline
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 22:18.


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