Raised This Month: $ Target: $400
 0% 

Grenade problem


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
KillLikoe
BANNED
Join Date: Nov 2010
Location: Paraguay
Old 11-04-2011 , 14:26   Grenade problem
Reply With Quote #1

the problem is that when i want to open the menu the server crashes
PHP Code:
 /* Plugin generated by AMXX-Studio */

#include <amxmodx> // include obligatorio
#include <amxmisc>
#include <zombieplague> // include del zp
#include <fakemeta_util>
#include <cstrike>

#define PLUGIN "Granade Menu"
#define VERSION "1.0"
#define AUTHOR "KillLikoe"

new g_msgAmmoPickup

// Menu keys
const KEYSMENU = (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<9// las teclas para el menu

// Ammo IDs for weapons
new const AMMOID[] = { -19, -121251464131076444610,
            
11035410211842, -1}

new const 
Grenade_Names[4][3][] = // const con el nombre de las granadas [4] significa las llevas que se abren y cierran el [3] cuantas opciones tiene adentro
{
    {
        
"He Grenade",
        
"FlashBang Grenade",
        
"Smoke Grenade"
    
},
    {
        
"He Grenade",
        
"FlashBang Grenade",
        
"Smoke Grenade"        
    
},
    {
        
"He Grenade",
        
"FlashBang Grenade",
        
"Smoke Grenade"        
    
},
    {
        
"He Grenade",
        
"FlashBang Grenade",
        
"Smoke Grenade"        
    
}
}
    
new const 
Ammount_Grenades[4][3] = // lo mismo que arriba
{
    { 
12},
    { 
22},
    { 
33},
    { 
33}
}

new const 
Kind_Grenades[3][] = { "weapon_hegrenade""weapon_smokegrenade""weapon_flashbang" // armas a dar 
new const Grenade_Ent[3] = { CSW_HEGRENADECSW_SMOKEGRENADECSW_FLASHBANG // index de la granada
new const Level_Grenades[4] = { 1255075 // level de las granadas

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR// registramos el plugin
    
register_menu("Menu Granadas"KEYSMENU"menu_granadas_handler"// registramos el menu
    
register_clcmd("say /granadas""clcmd_granadas"// al escribir /granadas se abre el menu
    
g_msgAmmoPickup get_user_msgid("AmmoPickup")
}

public 
clcmd_granadas(id)
{
    
menu_granadas(id)
}

public 
menu_granadas(id// nuevo public
{
    static 
menu[512], leni// creamos variables
    
len // seteamos a 0 siempre el len
    
    
    // Title
    
len += formatex(menu[len], charsmax(menu) - len"\yMenu de Granadas^n^n"// titulo
    
    
for(04i++) // for para saber el nombre de las granadas
    
{
        if (
zp_get_user_ammo_packs(id) >= Level_Grenades[i]) // para saber que level necesitan
        
{
            for(
03j++) // para saber lo que hay adentro de la llave
            
{
                if (
!= 1)
                {
                    
len += formatex(menu[len], charsmax(menu) - len"   \y|\d %d %s^n"Ammount_Grenades[i][j], Grenade_Names[i][j]) // contenido
                
}
                else
                {
                    
len += formatex(menu[len], charsmax(menu) - len"\r%d.\y|\d %d %s [\r Min Lvl : \w%d\d ]^n"i+1Ammount_Grenades[i][j], Grenade_Names[i][j], Level_Grenades[i]) // contenido
                
}
            }
        }
        else
        {
            for(
03j++)
            {
                if (
!= 1)
                {
                    
len += formatex(menu[len], charsmax(menu) - len"   \y|\d %d %s^n"Ammount_Grenades[i][j], Grenade_Names[i][j]) // contenido
                
}
                else
                {
                    
len += formatex(menu[len], charsmax(menu) - len"\r%d.\y|\d %d %s [\r Min Lvl : \w%d\d ]^n"i+1Ammount_Grenades[i][j], Grenade_Names[i][j], Level_Grenades[i]) // contenido
                
}
            }
        }
    }
    
}

public 
menu_granadas_handler(idkey)
{    
    if(
zp_get_user_ammo_packs(id) < Level_Grenades[key]) // si tiene los ammopacks necesarios
    
{
        
client_print(idprint_center"^x04[ZP]^x01 Necesitas tener %d ammopacks",  Level_Grenades[key]) // imprimimos

        // Show buy menu again
        
menu_granadas(id// mostramos el menu
        
return PLUGIN_HANDLED;    // returneamos
    
}
    
    for(new 
03i++)
    {
        
set_msg_block(g_msgAmmoPickupBLOCK_ONCE// no se
        
fm_give_item(idKind_Grenades[i])    // le damos las granadas
        
set_msg_block(g_msgAmmoPickupBLOCK_NOT)    // no se    
        
cs_set_user_bpammo(idGrenade_Ent[i], Ammount_Grenades[key][i]) // le damos las balas
        
        // Flash ammo in hud
        
message_begin(MSG_ONE_UNRELIABLEg_msgAmmoPickup_id)
        
write_byte(AMMOID[Grenade_Ent[i]]) // ammo id
        
write_byte(Ammount_Grenades[key][i]) // ammo amount
        
message_end()        
    }
    return 
PLUGIN_HANDLED

KillLikoe 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 14:28.


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