Raised This Month: $ Target: $400
 0% 

buying unavailble weapons + selling(2 plugins combined) need help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Voi
Veteran Member
Join Date: Sep 2006
Location: Gdansk, Poland
Old 05-20-2007 , 11:56   buying unavailble weapons + selling(2 plugins combined) need help
Reply With Quote #1

menu appears with sell command(5 key), but when i press it, it does nothing like the key wasnt registered, ive marked red changes ive made, pls help at this

Code:
public requistions_menu(id) {
    if (!get_cvar_num("amx_enemyreq")){
        return PLUGIN_HANDLED
    }
    
    if (!cs_get_user_buyzone(id) || !is_user_alive(id) || !bBuyTime) {
        client_print(id,print_chat,"[EREQ]You can't buy anything at the current time or place.")
        return PLUGIN_HANDLED
    }
    
    //Debug
    //client_print(id,print_chat,"[EREQ] Checks done.")
    
    new menu[192]
    new sNames[4][12]
    new Prices[4]
    new CsTeams:team = cs_get_user_team(id)
    new i, j

    for (i=1; i<=8; i++) { //Cycles though the weapons
        if ((i % 2) == (team - 1)) {
            j = Slot[i-1]
            //client_print(id,print_chat,"[EREQ] j = %d",j) // DEBUG
            if((get_cvar_num("amx_ereq_allow") & power(2,j)) && (inStock[j])){    //Checks if the weapon is allowed and is in stock
                copy(sNames[j],7,sWpnNames[i-1])
                Prices[j] = floatround(WpnPrices[i-1] * get_cvar_float("amx_ereq_mult"))
            } else {
            copy(sNames[j],12,"UNAVAILABLE")
            Prices[j] = 0
            } 
        }
    }
    
    format(menu, 191, "Welcome to the Black Market^nWhat do you wish to purchase?^n^n1. %s %d^n2. %s %d^n3. %s %d^n4. %s %d^n^n5. Sell current weapon^n0. Cancel",sNames[0],Prices[0],sNames[1],Prices[1],sNames[2],Prices[2],sNames[3],Prices[3])
    show_menu(id, keys, menu)
    
    return PLUGIN_HANDLED
    
}

public giveWeapon(id, key)
{
    new CsTeams:team = cs_get_user_team(id)
    new Price = floatround(WpnPrices[(((key+1)*2)-team)] * get_cvar_float("amx_ereq_mult"))
    new Name[7]
    
    copy(Name,7,sWpnNames[(((key+1)*2)-team)])
     
    if(!(get_cvar_num("amx_ereq_allow") & power(2,key)) || !inStock[key]) {
        client_print(id,print_chat,"[EREQ]We do not have that in stock.")
        return PLUGIN_HANDLED        
    }
    
    if(cs_get_user_money(id) < Price){
        client_print(id,print_chat,"[EREQ]You do not have enough money to purchase the %s ($%d)",Name,Price)
        return PLUGIN_HANDLED
    }

    cs_set_user_money(id,(cs_get_user_money(id) - Price),1)
    
    switch (key) 
    {
        case 0:
        {
            if(!(team-1)){ // if T
                drop_sec(id)
                give_item(id, "weapon_fiveseven")
                client_print(id,print_chat,"[EREQ]You have bought a FN 57 for $%d.",Price)
            } else {
                drop_sec(id)
                give_item(id, "weapon_elite")
                client_print(id,print_chat,"[EREQ]You have bought Elites for $%d.",Price)
            }
                
        }
        
        case 1:
        {
            if(!(team-1)){ // if T
                drop_prim(id)
                give_item(id, "weapon_tmp")
                client_print(id,print_chat,"[EREQ]You have bought a TMP for $%d.",Price)
            } else {
                drop_prim(id)
                give_item(id, "weapon_mac10")
                client_print(id,print_chat,"[EREQ]You have bought a Mac 10 for $%d.",Price)
            }
                
        }
        
        case 2:
        {
            if(!(team-1)){ // if T
                drop_prim(id)
                give_item(id, "weapon_famas")
                client_print(id,print_chat,"[EREQ]You have bought a Famas for $%d.",Price)
            } else {
                drop_prim(id)
                give_item(id, "weapon_galil")
                client_print(id,print_chat,"[EREQ]You have bought a Galil for $%d.",Price)
            }
            if(get_cvar_num("amx_ereq_vary")){
                inStock[2]--
            }
                
        }
        
        case 3:
        {
            if(!(team-1)){ // if T
                drop_prim(id)
                give_item(id, "weapon_m4a1")
                client_print(id,print_chat,"[EREQ]You have bought a M4A1 for $%d.",Price)
            } else {
                drop_prim(id)
                give_item(id, "weapon_ak47")
                client_print(id,print_chat,"[EREQ]You have bought an AK47 for $%d.",Price)
            }
            if(get_cvar_num("amx_ereq_vary")){
                inStock[3]--
            }
        }
        case 4:
        {
            cmd_sell(id)
        }
        default:
        {
            client_print(id,print_chat,"[EREQ]You have exited the black market.")
            return PLUGIN_HANDLED
        }    
    }
    return PLUGIN_HANDLED
}
Attached Files
File Type: sma Get Plugin or Get Source (enmyreq.sma - 649 views - 11.4 KB)
__________________
Voi 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 10:40.


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