{SOLUCIONADO} Quien me puede echar una manito con este plugin
#1
Hola buenas, yo de nuevo molestando aqui pude solucionar el problema del otro post que hice ahora al tocar las cajas te dan la xp pero por ejemplo si te falta poco para subir de nivel y recoges una caja con lo que te falta para subir esta no te sube de nivel, por decirlo asi como que se acumula pero no te pasa al siguiente nivel y eso no deberia ocurrir y al matar un enemigo (TT) teniendo esa xp te sube de nivel yo quiero que si tiene 500/700 y le falten 200 de xp para subir y recoja una caja con 200 de xp que le faltan para subir de nivel que lo suba de nivel en la foto se muestra mejor el error, si alguien me puede decir que debo hacer para solucionar ese error se lo agradeceria mucho.

PD: No se en que plugin de hace eso asique subire esos y sus includes, ayuda porfavor!


Archivos adjuntos Miniatura(s)
   

.sma   Descargar AMXX / supply_box_xp.sma (Tamaño: 493 bytes / Descargas: 53)
.inc   supply.inc (Tamaño: 79 bytes / Descargas: 5)
.inc   gunxpmod.inc (Tamaño: 2.42 KB / Descargas: 5)
.sma   Descargar AMXX / gunxpmod.sma (Tamaño: 31.85 KB / Descargas: 54)
.sma   Descargar AMXX / supply_box.sma (Tamaño: 13.66 KB / Descargas: 58)
DancingLmlDancing
Responder
#2
Te lo dije ayer por privado, agregá el check_level(id) luego de setearle la xp así no tenes que esperar al chequeo de si muere o termina ronda, etc.
Responder
#3
(11/04/2019, 10:25 PM)DiCHANHO escribió: Te lo dije ayer por privado, agregá el check_level(id) luego de setearle la xp así no tenes que esperar al chequeo de si muere o termina ronda, etc.

La verdad no entendi muy bien por eso pedi ayuda, me podrias dar un ejemplo de como hacerlo porfa.
DancingLmlDancing
Responder
#4
Fíjate si esto te ayuda a entender un poco tu código. Revisa a la par tu plugin principal y por sobre todo, como se esta usando actualmente tu check_level(id), así vas a poder aplicarlo donde lo necesites Victory

https://amxmodx-es.com/Thread-ZP-TUT-Cre...-Da%C3%B1o
Responder
#5
(12/04/2019, 02:40 AM)DiCHANHO escribió: Fíjate si esto te ayuda a entender un poco tu código. Revisa a la par tu plugin principal y por sobre todo, como se esta usando actualmente tu check_level(id), así vas a poder aplicarlo donde lo necesites Victory

https://amxmodx-es.com/Thread-ZP-TUT-Cre...-Da%C3%B1o

Vale entendi algo creo, pero nose como aplicarlo en mi codigo lo que me dices, mire check_level(id) igual. No entendi mucho la verdad.
DancingLmlDancing
Responder
#6
(12/04/2019, 09:48 PM)Boddah. escribió:
(12/04/2019, 02:40 AM)DiCHANHO escribió: Fíjate si esto te ayuda a entender un poco tu código. Revisa a la par tu plugin principal y por sobre todo, como se esta usando actualmente tu check_level(id), así vas a poder aplicarlo donde lo necesites Victory

https://amxmodx-es.com/Thread-ZP-TUT-Cre...-Da%C3%B1o

Vale entendi algo creo, pero nose como aplicarlo en mi codigo lo que me dices, mire check_level(id) igual. No entendi mucho la verdad.

Si quieres crear niveles por daño aqui tienes un tutorial

ZP Niveles por daño By: Spasforever

ZP Niveles por AMMO PACKS By: Kiske

ZP y Normal Niveles By: Kikizon2 Te recomiendo esta guia es muy buena

Código PHP:
#include <amxmodx>

#define NextLevel(%1) (%1 * 400 + 120) // El 120 lo cambias por la xp que se necesitan para cada nivel.
#define LevelMax 800 // Niveles máximos.

new gLevel33 ], gXp33 ];
new 
cvarXPAGanar;

public 
plugin_init( )
{
    
register_event"DeathMsg""event_Death""a" );

    
cvarXPAGanar register_cvar"amx_xp_a_ganar""2" ); // Frags para cambiar la xp que gane al matar.
}

public 
event_Death( )
{
    new 
iAttacker read_data);
    new 
iVictim read_data);

    if( 
iAttacker == iVictim || !is_user_connectediAttacker ) || !is_user_connectediVictim ) ) return;

    
gXpiAttacker ] += get_pcvar_numcvarXPAGanar );

    
UpdateLeveliAttacker );
}

public 
UpdateLevelid )
{
    new 
iSubido false;

    while( 
gXpid ] >= NextLevelgLevelid ] ) && gLevelid ] < LevelMax )
    {
        ++
gLevelid ];
        
iSubido true;
    }

    if( 
iSubido )
    {
        
client_printidprint_chat"Subiste al nivel %d"gLevelid ] );
        
iSubido false;
    }

Y esta mini guia de Skylar, sabes google no muerde Whatever
Ze_Jurassic_World_Z [52%]
Ze_Jumping_Area [37%]
(04/02/2019, 05:15 PM)kikizon2 escribió: Me voy por un tiempo y cuando regreso veo esto... Oh god why
Responder
#7
(12/04/2019, 10:21 PM)LIL8ZINN escribió:
(12/04/2019, 09:48 PM)Boddah. escribió:
(12/04/2019, 02:40 AM)DiCHANHO escribió: Fíjate si esto te ayuda a entender un poco tu código. Revisa a la par tu plugin principal y por sobre todo, como se esta usando actualmente tu check_level(id), así vas a poder aplicarlo donde lo necesites Victory

https://amxmodx-es.com/Thread-ZP-TUT-Cre...-Da%C3%B1o

Vale entendi algo creo, pero nose como aplicarlo en mi codigo lo que me dices, mire check_level(id) igual. No entendi mucho la verdad.

Si quieres crear niveles por daño aqui tienes un tutorial

ZP Niveles por daño By: Spasforever

ZP Niveles por AMMO PACKS By: Kiske

ZP y Normal Niveles By: Kikizon2 Te recomiendo esta guia es muy buena

Código PHP:
#include <amxmodx>

#define NextLevel(%1) (%1 * 400 + 120) // El 120 lo cambias por la xp que se necesitan para cada nivel.
#define LevelMax 800 // Niveles máximos.

new gLevel33 ], gXp33 ];
new 
cvarXPAGanar;

public 
plugin_init( )
{
    
register_event"DeathMsg""event_Death""a" );

    
cvarXPAGanar register_cvar"amx_xp_a_ganar""2" ); // Frags para cambiar la xp que gane al matar.
}

public 
event_Death( )
{
    new 
iAttacker read_data);
    new 
iVictim read_data);

    if( 
iAttacker == iVictim || !is_user_connectediAttacker ) || !is_user_connectediVictim ) ) return;

    
gXpiAttacker ] += get_pcvar_numcvarXPAGanar );

    
UpdateLeveliAttacker );
}

public 
UpdateLevelid )
{
    new 
iSubido false;

    while( 
gXpid ] >= NextLevelgLevelid ] ) && gLevelid ] < LevelMax )
    {
        ++
gLevelid ];
        
iSubido true;
    }

    if( 
iSubido )
    {
        
client_printidprint_chat"Subiste al nivel %d"gLevelid ] );
        
iSubido false;
    }

Y esta mini guia de Skylar, sabes google no muerde Whatever

Si esque el problema esque quiero arreglar ese error que tengo con el plugin de arriba, en la foto se ve el bug que hay y leei el codigo y no entendi mucho. No tengo puta idea de como arreglar eso que al recoger una caja de xp con la xp que te falta por subir te suba de nivel porque no te sube de nivel como se vee en la foto, es decir como que acumula y tienes que matar a un enemigo para subir y nose como arreglarlo. Por eso estaba pidiendo si alguien me podria decir la parte exacta por donde empezar y que cambiar.

PD: No es un Zombie plague y uso un modo llamado gunxp que es el de los niveles
DancingLmlDancing
Responder
#8
(12/04/2019, 09:48 PM)Boddah. escribió: Si esque el problema esque quiero arreglar ese error que tengo con el plugin de arriba, en la foto se ve el bug que hay y leei el codigo y no entendi mucho. No tengo puta idea de como arreglar eso que al recoger una caja de xp con la xp que te falta por subir te suba de nivel porque no te sube de nivel como se vee en la foto, es decir como que acumula y tienes que matar a un enemigo para subir y nose como arreglarlo.

PD: No es un Zombie plague y uso un modo llamado gunxp que es el de los niveles

Haber pasame el codigo de la caja
Ze_Jurassic_World_Z [52%]
Ze_Jumping_Area [37%]
(04/02/2019, 05:15 PM)kikizon2 escribió: Me voy por un tiempo y cuando regreso veo esto... Oh god why
Responder
#9
(12/04/2019, 10:35 PM)LIL8ZINN escribió:
(12/04/2019, 09:48 PM)Boddah. escribió: Si esque el problema esque quiero arreglar ese error que tengo con el plugin de arriba, en la foto se ve el bug que hay y leei el codigo y no entendi mucho. No tengo puta idea de como arreglar eso que al recoger una caja de xp con la xp que te falta por subir te suba de nivel porque no te sube de nivel como se vee en la foto, es decir como que acumula y tienes que matar a un enemigo para subir y nose como arreglarlo.

PD: No es un Zombie plague y uso un modo llamado gunxp que es el de los niveles

Haber pasame el codigo de la caja
Código PHP:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <hamsandwich>
#include <engine>

#define PLUGIN  "Supply Crates"
#define AUTHOR  "TBagT"
#define VERSION "2.0"

// Entity specifics //
new entSupply[ ] = "supply_box_entity";
new 
Float:minModel] = { -8.01, -8.090.0 }
new 
Float:maxModel] = { 8.128.0922.26 }
new const 
SupplyBoxModel[ ]   = { "models/umbrella_hell/w_supply_box.mdl" }
new const 
PickupSound[ ]      = { "supply_box/supplybox_pickup.wav" }
new const 
SUPPLY_BOX_SOUND[ ] = { "supply_box/supplybox_drop.wav" }

// Player specifics //
new bool:can_pickup33 ];
new 
pickupCount33 ];

// Supply box specifics //
#define TASK_ID_SPAWN_BOXES 150
new Array:SupplyBoxes, Array:EmptyCfgLines;     // <- Information holders //
enum _SupplyBoxesArray {                      // <- Array variables //
        
line_id,
        
Float:box_origin],
        
Float:box_angles]
}
new Array:
SupplyBoxesContents;                  // <- Content holder //
enum _SupplyContentsArray {
        
box_id,
        
box_name35 ],
        
pickupForwardItem
}
// Server specifics //
new cvar_pickupTimescvar_timesPerRoundcvar_amountSpawncvar_teamcvar_spawnEvery;
new 
maxPlayersmapName32 ], configurationFile258 ], lines;
new 
forwardResultspawnCount;

public 
plugin_precache( ) {
        
precache_modelSupplyBoxModel );
        
precache_soundPickupSound );
        
precache_soundSUPPLY_BOX_SOUND );

        
SupplyBoxes         ArrayCreateSupplyBoxesArray );
        
SupplyBoxesContents ArrayCreateSupplyContentsArray );
        
EmptyCfgLines       ArrayCreate1);
}

public 
plugin_init( ) {

        
register_pluginPLUGINVERSIONAUTHOR );
        
cvar_spawnEvery    register_cvar"sb_spawn_every""60.0" );
        
cvar_pickupTimes   register_cvar"sb_pickup_times""999" );
        
cvar_timesPerRound register_cvar"sb_times_per_round""2" );
        
cvar_amountSpawn   register_cvar"sb_spawn_amount""999" );
        
cvar_team          register_cvar"sb_team""2" );

        
register_touchentSupply"player""supply_box_pickup" );
        
register_logevent"RoundEnd"2"1=Round_End" );
        
register_logevent"RoundStart"2"1=Round_Start" );
        
RegisterHamHam_Spawn"player""playerSpawn");

        
register_clcmd"supplybox""supplyAdminMenu" );

        
maxPlayers get_maxplayers( );
}

public 
plugin_cfg( ) {
        
get_mapnamemapNamecharsmaxmapName ) );
        
addmapNamecharsmaxmapName ), ".cfg");
        
get_configsdirconfigurationFilecharsmaxconfigurationFile ) );
        
addconfigurationFilecharsmaxconfigurationFile ), "/SupplyBoxes/");

        if( !
dir_existsconfigurationFile ) )
                
mkdirconfigurationFile );

        
addconfigurationFilecharsmaxconfigurationFile ), mapName);

        if( !
file_existsconfigurationFile ) ) {
                new 
m_map_cfg fopenconfigurationFile"wt" );
                
fclosem_map_cfg );
        }
        
fillSupplyArray( );
}

public 
plugin_natives( ) {
        
register_native"register_box_content""native_register_content" );
}

public 
client_disconnectid ) {
        
can_pickupid ]  = false;
        
pickupCountid ] = 0;
}

public 
client_putinserverid ) {
        
can_pickupid ]  = false;
        
pickupCountid ] = 0;
}

public 
RoundStart( ) {
        if( 
get_pcvar_floatcvar_spawnEvery ) < 30.0 )
                
set_task30.0"spawnSupplyBoxes"TASK_ID_SPAWN_BOXES__"b" );
        else
                
set_taskget_pcvar_floatcvar_spawnEvery ), "spawnSupplyBoxes"TASK_ID_SPAWN_BOXES__"b" );
}

public 
RoundEnd( ) {
        
remove_taskTASK_ID_SPAWN_BOXES );
        for( new 
index 1index maxPlayersindex++ )
                
pickupCountindex ] = 0;
        
spawnCount 0;
        
remove_supply_boxes( );
}

public 
playerSpawnid ) {
        if( !
is_user_aliveid ) || get_user_teamid ) != get_pcvar_numcvar_team ) )
                
can_pickupid ] = false;
        else
                
can_pickupid ] = true;
}

public 
fillSupplyArray( ) {
        new 
data258 ];
        new 
Float:Origin], Float:Angles];
        new const 
text_parser][ ];

        new 
file fopenconfigurationFile"r" );
        while( 
fgetsfiledatacharsmaxdata ) - ) ) {

                
lines++;
                if( 
data] == ' ' ) {
                        
ArrayPushCellEmptyCfgLineslines );
                        continue;
                }

                
parsedatatext_parser], 7text_parser], 7text_parser], 7text_parser], 7text_parser], 7text_parser], );
                
Origin] = str_to_floattext_parser] );
                
Origin] = str_to_floattext_parser] );
                
Origin] = str_to_floattext_parser] );
                
Angles] = str_to_floattext_parser] );
                
Angles] = str_to_floattext_parser] );
                
Angles] = str_to_floattext_parser] );

                
AddSupplyToArrayOriginAngleslines );
        }
        
fclosefile );
}

public 
supplyAdminMenuid ) {
        if( !( 
get_user_flagsid ) & ADMIN_IMMUNITY ) || !is_user_aliveid ) )
                return 
PLUGIN_HANDLED;

        new 
menu menu_create"\r[Umbrella Hell] \yMenu SupplyBox""supply_menu_handler" );
        
menu_additemmenu"Poner una SupplyBox""1" );
        
menu_additemmenu"Borrar una SupplyBox""2" );

        
menu_setpropmenuMPROP_EXITMEXIT_ALL );
        
menu_displayidmenu);
        return 
PLUGIN_HANDLED;
}

public 
supply_menu_handleridmenuitem ) {
        if( !
is_user_aliveid ) )
                return 
PLUGIN_HANDLED;

        if( 
item == MENU_EXIT ) {
                
menu_destroymenu );
                return 
PLUGIN_HANDLED;
        }

        new 
data], name64 ], accesscallbackkey;
        
menu_item_getinfomenuitemaccessdata5namecharsmaxname ), callback );

        
key str_to_numdata );
        switch( 
key ) {
                case 
1: {
                        new 
TargetOrigin], Float:Target], Float:Angles];
                        
get_user_originidTargetOrigin);

                        
Target] = floatTargetOrigin] );
                        
Target] = floatTargetOrigin] );
                        
Target] = floatTargetOrigin] );

                    
entity_get_vectoridEV_VEC_v_angleAngles );
                        
Angles] = 0.0;
                        
CreateSupplyBoxTargetAngles );
                }
                case 
2: {
                        new 
entitybody;
                    
get_user_aimingidentitybody500 );
                        
deleteSupplyBoxentity );
                }
        }
        
supplyAdminMenuid );
        return 
PLUGIN_HANDLED;
}

public 
CreateSupplyBoxFloat:Origins], Float:Angles] ) {
        new 
szData248 ], line_to_item;
        
formatszDatacharsmaxszData ), "%f %f %f %f %f %f"Origins], Origins], Origins], Angles], Angles], Angles] );

        if( 
ArraySizeEmptyCfgLines ) > ) {
                new 
emptyLineId ArrayGetCellEmptyCfgLines);
                
ArrayDeleteItemEmptyCfgLines);
                
write_fileconfigurationFileszDataemptyLineId );
                
line_to_item emptyLineId;
        } else {
                
lines++;
                
write_fileconfigurationFileszData );
                
line_to_item lines;
        }
        
AddSupplyToArrayOriginsAnglesline_to_item );
        
spawnSupplyBoxOriginsAnglesline_to_item );
}

public 
AddSupplyToArrayFloat:Origin], Float:Angles], id ) {
        new 
DataSupplyBoxesArray ];
        
Dataline_id ]    = id;
        
Databox_origin ] = _:Origin;
        
Databox_angles ] = _:Angles;

        
ArrayPushArraySupplyBoxesData );
}

public 
deleteSupplyBoxent ) {

        if( 
pev_valident ) ) {
                new 
class_name_ent64 ];
                
entity_get_stringentEV_SZ_classnameclass_name_entcharsmaxclass_name_ent ) );
                if( 
equalclass_name_ententSupply ) ) {
                        new 
size ArraySizeSupplyBoxes );
                        new 
item_id peventpev_iuser1 );
                        for( new 
0sizei++ ) {
                                new 
DataArraySupplyBoxesArray ];
                                
ArrayGetArraySupplyBoxesiDataArray );
                                if( 
DataArrayline_id ] == item_id ) {
                                        
lines--;
                                        
remove_entityent );
                                        
ArrayPushCellEmptyCfgLinesitem_id );
                                        
write_fileconfigurationFile" "item_id );
                                        
ArrayDeleteItemSupplyBoxes);
                                        break;
                                }
                        }
                }
        }

}

public 
spawnSupplyBoxes( ) {

        if( 
ArraySizeSupplyBoxes ) < || ArraySizeSupplyBoxesContents ) < || spawnCount >= get_pcvar_numcvar_timesPerRound ) ) {
                
remove_taskTASK_ID_SPAWN_BOXES );
                return;
        }
        
remove_supply_boxes( );
        
spawnCount++;

        new 
Float:Orig], Float:Angl];
        new 
AmountCvar   get_pcvar_numcvar_amountSpawn );
        new 
ArraySizeBox ArraySizeSupplyBoxes );
        new 
size = ( AmountCvar == || AmountCvar ArraySizeBox ) ? ArraySizeBox AmountCvar;
        new 
DataSupplyBoxesArray ];
        new 
countrandomId;
        new Array:
Boxes ArrayCreateSupplyBoxesArray );

        for( new 
index 0index ArraySizeBoxindex++ ) {
                
ArrayGetArraySupplyBoxesindexData );
                
ArrayPushArrayBoxesData );
        }

        do {
                
randomId randomArraySizeBox );
                
ArrayGetArrayBoxesrandomIdData );
                
Orig] = Databox_origin ][ ]; Angl] = Databox_angles ][ ];
                
Orig] = Databox_origin ][ ]; Angl] = Databox_angles ][ ];
                
Orig] = Databox_origin ][ ]; Angl] = Databox_angles ][ ];
                
spawnSupplyBoxOrigAnglDataline_id ] );
                
count++;

                
ArrayDeleteItemBoxesrandomId );
                
ArraySizeBox--;
        } while( 
count size );

        
client_cmd0"spk %s"SUPPLY_BOX_SOUND );
        
client_print(0print_center".... Presents arrived ...")

}

public 
remove_supply_boxes( ) {
        new 
ent = -1;
        while( ( 
ent engfuncEngFunc_FindEntityByStringent"classname"entSupply ) ) )
                
remove_entityent );
}

public 
spawnSupplyBoxFloat:pOrigins], Float:pAngles], line_idas ) {
        new 
entity create_entity"info_target" );
        
entity_set_stringentityEV_SZ_classnameentSupply );
        
entity_set_intentityEV_INT_solidSOLID_BBOX );
        
entity_set_originentitypOrigins );
        
entity_set_vectorentityEV_VEC_anglespAngles );
        
entity_set_modelentitySupplyBoxModel );
        
entity_set_sizeentityminModelmaxModel );

        
entity_set_intentityEV_INT_renderfxkRenderFxGlowShell );
        
entity_set_vectorentityEV_VEC_rendercolorFloat:{ 221.0173.0237.0 } );

        
set_peventitypev_iuser1line_idas );
}

public 
supply_box_pickupboxplayer ) {
        if( !
is_user_aliveplayer ) || !can_pickupplayer ] )
                return;

        new 
randomDrop randomArraySizeSupplyBoxesContents ) );
        new 
DataSupplyContentsArray ];
        
ArrayGetArraySupplyBoxesContentsrandomDropData );
        
ExecuteForwardDatapickupForwardItem ], forwardResultplayer );

        if( 
get_pcvar_numcvar_pickupTimes ) > ) {
                
pickupCountplayer ]++;
                if( 
pickupCountplayer ] >= get_pcvar_numcvar_pickupTimes ) )
                        
can_pickupplayer ] = false;
        }

        
chatcolorplayer"!g[Umbrella Hell] !yHas encontrado una ^3SupplyBox !ycon !g%s!"Databox_name ] );
        
client_cmdplayer"spk %s"PickupSound );
        
remove_entitybox );
}

public 
native_register_contentplugin_idparamaters_num ) {
        new 
BoxName32 ];
        
get_string1BoxNamecharsmaxBoxName ) );

        new 
DataSupplyContentsArray ];
        
Databox_id ]   = ArraySizeSupplyBoxesContents );
        
Databox_name ] = BoxName;
        
DatapickupForwardItem ] = CreateOneForwardplugin_id"sb_pickup_event"FP_CELL );
        
ArrayPushArraySupplyBoxesContentsData );

        
// Debuging //
        // log_amx( "Registered box content name: %s and id: %d", BoxName, Data[ box_id ] );

        // Return id to original plugin //
        
return Databox_id ];
}

stock chatcolor(id, const input[], any:...)
{
    static 
szMsg[191], msgSayText;
    
    if (!
msgSayText)
        
msgSayText get_user_msgid("SayText");
    
    
vformat(szMsg190input3);

    
replace_all(szMsg190"!g""^4");
    
replace_all(szMsg190"!y""^1");
    
replace_all(szMsg190"!team""^3");
    
    
message_begin(id MSG_ONE_UNRELIABLE MSG_BROADCASTmsgSayText, .player id);
    
write_byte(id id 33);
    
write_string(szMsg);
    
message_end();


El problema que tiene esque te da la xp y todopero por ejemplo si eres nivel 1 y tienes esta xp 150/200 te quedan 50 de xp para pasar al siguiente nivel y encuentra una caja que tiene 50 de xp entonces no te pase de nivel deberia pasarte porque ya completastes lo que te pedia para pasar de nivel es decir 50 de xpcomo se muestra en la imagen arriba yo quiero que cuando te quede poca xp para pasar y te encuentres con cualquier caja y te de la xp que te falta para subir al proximo nivel que subas porque actualmente no subes y como que se acumula la xp y estas en el mismo nivel eso quiero

esto pasa com se muestra en la foto.


Archivos adjuntos Miniatura(s)
   
DancingLmlDancing
Responder
#10
Prueba este haber si te sirve
Código PHP:
#if defined ZOMBIE_BIOHAZARD
  #include <biohazard>
#endif
#if defined ZOMBIE_PLAGUE
  #include <zombieplague>
#endif

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <fun>
#include <cstrike>
#include <nvault>
#include <hamsandwich>
#include <engine>
#include <colorchat>

#define PLUGIN    "Gun Xp Mod"
#define AUTHOR    "xbatista"
#define VERSION    "1.7"

//#define NORMAL_MOD
//#define ZOMBIE_SWARM
#define ZOMBIE_INFECTION

#define ZOMBIE_BIOHAZARD
//#define ZOMBIE_PLAGUE


#define ADMIN_EXTRA ADMIN_LEVEL_H
#define MAXLEVEL 24

#define OFFSET_PRIMARYWEAPON 116
#define MENU_STARTID g_menu_data[id][2]
const KEYSMENU = (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<9)
#define TASK_SHOW_LEVEL 10113
#define fm_cs_set_user_nobuy(%1) set_pdata_int(%1, 235, get_pdata_int(%1, 235) & ~(1<<0) ) //no weapon buy

new PlayerXp[33];
new 
PlayerLevel[33];

new 
g_Vault;
new 
g_kills[33];
new 
g_menu_data[33][8];
new 
g_remember_selection[33];
new 
g_maxplayersg_msgHudSync1SayTxTenable_grenades;
new 
levelsprlevelspr2show_level_textshow_rank;
new 
savexp xp_killxp_tripleenable_tripletriple_killsxp_ultraultra_killsenable_ultrap_Enabledlevel_style;
new 
enable_admin_xpadmin_xp;

// Entity specifics //
new entSupply[ ] = "supply_box_entity";
new 
Float:minModel] = { -8.01, -8.090.0 }
new 
Float:maxModel] = { 8.128.0922.26 }
new const 
SupplyBoxModel[ ]   = { "models/umbrella_hell/w_supply_box.mdl" }
new const 
PickupSound[ ]      = { "supply_box/supplybox_pickup.wav" }
new const 
SUPPLY_BOX_SOUND[ ] = { "supply_box/supplybox_drop.wav" }

// Player specifics //
new bool:can_pickup33 ];
new 
pickupCount33 ];

// Supply box specifics //
#define TASK_ID_SPAWN_BOXES 150
new Array:SupplyBoxes, Array:EmptyCfgLines;     // <- Information holders //
enum _SupplyBoxesArray {                      // <- Array variables //
        
line_id,
        
Float:box_origin],
        
Float:box_angles]
}
new Array:
SupplyBoxesContents;                  // <- Content holder //
enum _SupplyContentsArray {
        
box_id,
        
box_name35 ],
        
pickupForwardItem
}
// Server specifics //
new cvar_pickupTimescvar_timesPerRoundcvar_amountSpawncvar_teamcvar_spawnEvery;
new 
maxPlayersmapName32 ], configurationFile258 ], lines;
new 
forwardResultspawnCount;

new const 
LevelUp[] = "umbrella/levelup.wav";
                                                           
//mac10//
new const LEVELS[MAXLEVEL] = { 90180300450700120018002800,
41005200600068008200102001200015000175002050025500//<-aug//
29000350004600058000150000
}; // Levels

new const RANKLEVELS[MAXLEVEL][] = { "Novato""Novato""Novato""Novato""Novato""Protector""Protector""Protector",
"Cazador""Cazador""Cazador""Cazador""Asesino""Asesino""Asesino""Asesino""Seテアor de la Guerra""Seテアor de la Guerra""Seテアor de la Guerra"
"Heroe""Heroe""Heroe""Soldado Umbrella""Soldado Umbrella"
}; // Rank Levels

new const RANK[MAXLEVEL][] = { "Glock 18C""USP .45 ACP Tactical""P228 Compact""FiveseveN""Desert Eagle .50 AE""Dual Elite Berettas"
"Schmidt TMP""Ingram MAC-10""UMP 45""MP5 Navy""ES P90""Scout""AWP Magnum Sniper""Famas""IMI Galil""M3 Super 90""XM1014 M4"
"AK-47""M4A1 Carbine""Steyr AUG A1""SG-552 Commando""SG-550 Auto-Sniper""G3SG1 Auto-Sniper""M249 Para Machinegun" 
}; // Weapon Name Ranks

new const WEAPONCONST[MAXLEVEL][] = { "weapon_glock18""weapon_usp""weapon_p228""weapon_fiveseven""weapon_deagle""weapon_elite""weapon_tmp"
"weapon_mac10""weapon_ump45""weapon_mp5navy""weapon_p90""weapon_scout""weapon_awp""weapon_famas""weapon_galil""weapon_m3""weapon_xm1014"
"weapon_ak47""weapon_m4a1""weapon_aug""weapon_sg552""weapon_sg550""weapon_g3sg1""weapon_m249" 
}; // Give Weapons

new const WEAPONMDL[MAXLEVEL][] = { "models/w_glock18.mdl""models/w_usp.mdl""models/w_p228.mdl""models/w_fiveseven.mdl""models/w_deagle.mdl""models/w_elite.mdl""models/w_tmp.mdl"
"models/w_mac10.mdl""models/w_ump45.mdl""models/w_mp5.mdl""models/w_p90.mdl""models/w_scout.mdl""models/w_awp.mdl""models/w_famas.mdl""models/w_galil.mdl""models/w_m3.mdl""models/w_xm1014.mdl"
"models/w_ak47.mdl""models/w_m4a1.mdl""models/w_aug.mdl""models/w_sg552.mdl""models/w_sg550.mdl""models/w_g3sg1.mdl""models/w_m249.mdl" 
}; // Blocks pick up weapon, that is not model replacement!!!

new const AMMOCONST[MAXLEVEL] = { 17161112610237121930318
15142152822827132420 
}; // Weapons ID(CSW)

new const AMMO2CONST[MAXLEVEL] = { 40040040040040040040040040040040040090
4004008080400400400400200200400
}; // Weapons Ammo

/*================================================================================
                        [Plugin natives,precache,init]
=================================================================================*/
public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR);
    
register_cvar("gxm_version"VERSIONFCVAR_SPONLY|FCVAR_SERVER)
    
set_cvar_string("gxm_version"VERSION)
    
    
register_concmd("dar_nivel""cmd_give_level"ADMIN_RCON" <nombre> <cantidad>" );
    
register_clcmd("say nivel""showlevel");
    
register_clcmd("say /nivel""showlevel");
    
register_clcmd("say /top20","showtop20");
    
register_clcmd("say guns" ,"main_menu_level");
    
register_clcmd("say /guns" ,"main_menu_level");
    
register_clcmd("say armas" ,"main_menu_level");
    
register_clcmd("say /armas" ,"main_menu_level");
    
    
    
p_Enabled register_cvar"gxm_enable""1" ); // Plugin enabled? 1 = Yes, 0 = No.
    
xp_kill register_cvar("gxm_xp","7"); // How much xp gain if you killed someone?
    
savexp register_cvar("gxm_save","0"); // Save Xp by : 1 = SteamID, 0 = IP.
    
show_level_text register_cvar("gxm_level_text","1"); // Show your level by : 1 = HUD message, 0 = Simple colored text message.
    
show_rank register_cvar("gxm_show_rank","1"); // Show rank in /top20? 1 = Yes, 0 = No.
    
level_style register_cvar("gxm_level_style","0"); // You will gain each level new gun : 1 = Yes, 0 = No,select your gun by menu.
    
enable_grenades register_cvar("gxm_grenades","1"); // Give to player grenades? 1 = Yes, 0 = No.
    
    
enable_triple register_cvar("gxm_triple","1"); // Enable Triple Kill bonus xp? 1 = Yes, 0 = No.
    
xp_triple register_cvar("gxm_triple_xp","3"); // How much bonus xp give for Triple Kill?
    
triple_kills register_cvar("gxm_triple_kills","3"); // How much kills needed to give bonus xp?
    
enable_ultra register_cvar("gxm_ultra","1"); // Enable Ultra Kill bonus xp? 1 = Yes, 0 = No.
    
xp_ultra register_cvar("gxm_ultra_xp","5"); // How much bonus xp give for Ultra Kill?
    
ultra_kills register_cvar("gxm_ultra_kills","6"); // How much kills needed to give bonus xp?
    
    
enable_admin_xp register_cvar("gxm_admin_xp","1"); // Enable Extra xp for killing? 1 = Yes, 0 = No.
    
admin_xp register_cvar("gxm_extra_xp","5"); // How much extra xp give to admins?
                    // Events //
    
register_event("DeathMsg""event_deathmsg""a");
    
register_event("StatusValue""Event_StatusValue""bd""1=2")
                    
// Forwards //
    
RegisterHam(Ham_Spawn"player""fwd_PlayerSpawn"1);
    
    
register_forward(FM_Touch"fwd_Touch");
                    
// Messages //
    #if defined NORMAL_MOD || defined ZOMBIE_SWARM
    
register_message(get_user_msgid("StatusIcon"),    "Message_StatusIcon")
    
#endif
    
                    // Other //    
    
register_menu("Level by Menu"KEYSMENU"menu_level")
    
register_menu("Main Level Menu"KEYSMENU"main_menu_level")
    
register_menucmd(register_menuid("Main Menu"), 1023"main_menu_info")
    
    
register_dictionary("gunxpmod.txt");
                    
    
SayTxT get_user_msgid("SayText");
    
    
g_msgHudSync1 CreateHudSyncObj()
    
g_maxplayers get_maxplayers();
    

        
cvar_spawnEvery    register_cvar"sb_spawn_every""60.0" );
        
cvar_pickupTimes   register_cvar"sb_pickup_times""999" );
        
cvar_timesPerRound register_cvar"sb_times_per_round""2" );
        
cvar_amountSpawn   register_cvar"sb_spawn_amount""999" );
        
cvar_team          register_cvar"sb_team""2" );

        
register_touchentSupply"player""supply_box_pickup" );
        
register_logevent"RoundEnd"2"1=Round_End" );
        
register_logevent"RoundStart"2"1=Round_Start" );
        
RegisterHamHam_Spawn"player""playerSpawn");

        
register_clcmd"supplybox""supplyAdminMenu" );

        
maxPlayers get_maxplayers( );
}
public 
plugin_natives()
{
                    
// Player natives //
    
register_native("get_user_xp""native_get_user_xp"1);
    
register_native("set_user_xp""native_set_user_xp"1);
    
register_native("get_user_level""native_get_user_level"1);
    
register_native("set_user_level""native_set_user_level"1);
    
register_native("get_user_max_level""native_get_user_max_level"1);
    
    
register_native"register_box_content""native_register_content" );
}
public 
plugin_precache()
{
    
levelspr engfunc(EngFunc_PrecacheModel"sprites/xfire.spr");
    
levelspr2 engfunc(EngFunc_PrecacheModel"sprites/xfire2.spr");
    
    
precache_modelSupplyBoxModel );
    
precache_soundPickupSound );
    
precache_soundSUPPLY_BOX_SOUND );

    
SupplyBoxes         ArrayCreateSupplyBoxesArray );
    
SupplyBoxesContents ArrayCreateSupplyContentsArray );
    
EmptyCfgLines       ArrayCreate1);
    
    
engfunc(EngFunc_PrecacheSoundLevelUp);
}
public 
plugin_cfg()
{
    
//Open our vault and have g_Vault store the handle.
    
g_Vault nvault_open"gunxpmod" );

    
//Make the plugin error if vault did not successfully open
    
if ( g_Vault == INVALID_HANDLE )
        
set_fail_state"Error opening GunXpMod nVault, file does not exist!" );
    
    
get_mapnamemapNamecharsmaxmapName ) );
        
addmapNamecharsmaxmapName ), ".cfg");
        
get_configsdirconfigurationFilecharsmaxconfigurationFile ) );
        
addconfigurationFilecharsmaxconfigurationFile ), "/SupplyBoxes/");

        if( !
dir_existsconfigurationFile ) )
                
mkdirconfigurationFile );

        
addconfigurationFilecharsmaxconfigurationFile ), mapName);

        if( !
file_existsconfigurationFile ) ) {
                new 
m_map_cfg fopenconfigurationFile"wt" );
                
fclosem_map_cfg );
        }
        
fillSupplyArray( );
}
public 
plugin_end()
{
    
//Close the vault when the plugin ends (map change\server shutdown\restart)
    
nvault_closeg_Vault );
}
public 
client_authorized(id)
{
    
g_remember_selection[id] = 0;
    
    
LoadLevel(id)
}
public 
client_disconnect(id)
{
    
SaveLevel(id)
    
can_pickupid ]  = false;
        
pickupCountid ] = 0;
}
public 
client_putinserverid ) {
        
can_pickupid ]  = false;
        
pickupCountid ] = 0;
}
public 
RoundStart( ) {
        if( 
get_pcvar_floatcvar_spawnEvery ) < 30.0 )
                
set_task30.0"spawnSupplyBoxes"TASK_ID_SPAWN_BOXES__"b" );
        else
                
set_taskget_pcvar_floatcvar_spawnEvery ), "spawnSupplyBoxes"TASK_ID_SPAWN_BOXES__"b" );
}
public 
RoundEnd( ) {
        
remove_taskTASK_ID_SPAWN_BOXES );
        for( new 
index 1index maxPlayersindex++ )
                
pickupCountindex ] = 0;
        
spawnCount 0;
        
remove_supply_boxes( );
}

public 
playerSpawnid ) {
        if( !
is_user_aliveid ) || get_user_teamid ) != get_pcvar_numcvar_team ) )
                
can_pickupid ] = false;
        else
                
can_pickupid ] = true;
}
public 
fillSupplyArray( ) {
        new 
data258 ];
        new 
Float:Origin], Float:Angles];
        new const 
text_parser][ ];

        new 
file fopenconfigurationFile"r" );
        while( 
fgetsfiledatacharsmaxdata ) - ) ) {

                
lines++;
                if( 
data] == ' ' ) {
                        
ArrayPushCellEmptyCfgLineslines );
                        continue;
                }

                
parsedatatext_parser], 7text_parser], 7text_parser], 7text_parser], 7text_parser], 7text_parser], );
                
Origin] = str_to_floattext_parser] );
                
Origin] = str_to_floattext_parser] );
                
Origin] = str_to_floattext_parser] );
                
Angles] = str_to_floattext_parser] );
                
Angles] = str_to_floattext_parser] );
                
Angles] = str_to_floattext_parser] );

                
AddSupplyToArrayOriginAngleslines );
        }
        
fclosefile );
}

public 
supplyAdminMenuid ) {
        if( !( 
get_user_flagsid ) & ADMIN_IMMUNITY ) || !is_user_aliveid ) )
                return 
PLUGIN_HANDLED;

        new 
menu menu_create"\r[Umbrella Hell] \yMenu SupplyBox""supply_menu_handler" );
        
menu_additemmenu"Poner una SupplyBox""1" );
        
menu_additemmenu"Borrar una SupplyBox""2" );

        
menu_setpropmenuMPROP_EXITMEXIT_ALL );
        
menu_displayidmenu);
        return 
PLUGIN_HANDLED;
}

public 
supply_menu_handleridmenuitem ) {
        if( !
is_user_aliveid ) )
                return 
PLUGIN_HANDLED;

        if( 
item == MENU_EXIT ) {
                
menu_destroymenu );
                return 
PLUGIN_HANDLED;
        }

        new 
data], name64 ], accesscallbackkey;
        
menu_item_getinfomenuitemaccessdata5namecharsmaxname ), callback );

        
key str_to_numdata );
        switch( 
key ) {
                case 
1: {
                        new 
TargetOrigin], Float:Target], Float:Angles];
                        
get_user_originidTargetOrigin);

                        
Target] = floatTargetOrigin] );
                        
Target] = floatTargetOrigin] );
                        
Target] = floatTargetOrigin] );

                    
entity_get_vectoridEV_VEC_v_angleAngles );
                        
Angles] = 0.0;
                        
CreateSupplyBoxTargetAngles );
                }
                case 
2: {
                        new 
entitybody;
                    
get_user_aimingidentitybody500 );
                        
deleteSupplyBoxentity );
                }
        }
        
supplyAdminMenuid );
        return 
PLUGIN_HANDLED;
}

public 
CreateSupplyBoxFloat:Origins], Float:Angles] ) {
        new 
szData248 ], line_to_item;
        
formatszDatacharsmaxszData ), "%f %f %f %f %f %f"Origins], Origins], Origins], Angles], Angles], Angles] );

        if( 
ArraySizeEmptyCfgLines ) > ) {
                new 
emptyLineId ArrayGetCellEmptyCfgLines);
                
ArrayDeleteItemEmptyCfgLines);
                
write_fileconfigurationFileszDataemptyLineId );
                
line_to_item emptyLineId;
        } else {
                
lines++;
                
write_fileconfigurationFileszData );
                
line_to_item lines;
        }
        
AddSupplyToArrayOriginsAnglesline_to_item );
        
spawnSupplyBoxOriginsAnglesline_to_item );
}

public 
AddSupplyToArrayFloat:Origin], Float:Angles], id ) {
        new 
DataSupplyBoxesArray ];
        
Dataline_id ]    = id;
        
Databox_origin ] = _:Origin;
        
Databox_angles ] = _:Angles;

        
ArrayPushArraySupplyBoxesData );
}

public 
deleteSupplyBoxent ) {

        if( 
pev_valident ) ) {
                new 
class_name_ent64 ];
                
entity_get_stringentEV_SZ_classnameclass_name_entcharsmaxclass_name_ent ) );
                if( 
equalclass_name_ententSupply ) ) {
                        new 
size ArraySizeSupplyBoxes );
                        new 
item_id peventpev_iuser1 );
                        for( new 
0sizei++ ) {
                                new 
DataArraySupplyBoxesArray ];
                                
ArrayGetArraySupplyBoxesiDataArray );
                                if( 
DataArrayline_id ] == item_id ) {
                                        
lines--;
                                        
remove_entityent );
                                        
ArrayPushCellEmptyCfgLinesitem_id );
                                        
write_fileconfigurationFile" "item_id );
                                        
ArrayDeleteItemSupplyBoxes);
                                        break;
                                }
                        }
                }
        }

}

public 
spawnSupplyBoxes( ) {

        if( 
ArraySizeSupplyBoxes ) < || ArraySizeSupplyBoxesContents ) < || spawnCount >= get_pcvar_numcvar_timesPerRound ) ) {
                
remove_taskTASK_ID_SPAWN_BOXES );
                return;
        }
        
remove_supply_boxes( );
        
spawnCount++;

        new 
Float:Orig], Float:Angl];
        new 
AmountCvar   get_pcvar_numcvar_amountSpawn );
        new 
ArraySizeBox ArraySizeSupplyBoxes );
        new 
size = ( AmountCvar == || AmountCvar ArraySizeBox ) ? ArraySizeBox AmountCvar;
        new 
DataSupplyBoxesArray ];
        new 
countrandomId;
        new Array:
Boxes ArrayCreateSupplyBoxesArray );

        for( new 
index 0index ArraySizeBoxindex++ ) {
                
ArrayGetArraySupplyBoxesindexData );
                
ArrayPushArrayBoxesData );
        }

        do {
                
randomId randomArraySizeBox );
                
ArrayGetArrayBoxesrandomIdData );
                
Orig] = Databox_origin ][ ]; Angl] = Databox_angles ][ ];
                
Orig] = Databox_origin ][ ]; Angl] = Databox_angles ][ ];
                
Orig] = Databox_origin ][ ]; Angl] = Databox_angles ][ ];
                
spawnSupplyBoxOrigAnglDataline_id ] );
                
count++;

                
ArrayDeleteItemBoxesrandomId );
                
ArraySizeBox--;
        } while( 
count size );

        
client_cmd0"spk %s"SUPPLY_BOX_SOUND );
        
client_print(0print_center".... Presents arrived ...")

}

public 
remove_supply_boxes( ) {
        new 
ent = -1;
        while( ( 
ent engfuncEngFunc_FindEntityByStringent"classname"entSupply ) ) )
                
remove_entityent );
}

public 
spawnSupplyBoxFloat:pOrigins], Float:pAngles], line_idas ) {
        new 
entity create_entity"info_target" );
        
entity_set_stringentityEV_SZ_classnameentSupply );
        
entity_set_intentityEV_INT_solidSOLID_BBOX );
        
entity_set_originentitypOrigins );
        
entity_set_vectorentityEV_VEC_anglespAngles );
        
entity_set_modelentitySupplyBoxModel );
        
entity_set_sizeentityminModelmaxModel );

        
entity_set_intentityEV_INT_renderfxkRenderFxGlowShell );
        
entity_set_vectorentityEV_VEC_rendercolorFloat:{ 221.0173.0237.0 } );

        
set_peventitypev_iuser1line_idas );
}

public 
supply_box_pickupboxplayer ) {
        if( !
is_user_aliveplayer ) || !can_pickupplayer ] )
                return;

        new 
randomDrop randomArraySizeSupplyBoxesContents ) );
        new 
DataSupplyContentsArray ];
        
ArrayGetArraySupplyBoxesContentsrandomDropData );
        
ExecuteForwardDatapickupForwardItem ], forwardResultplayer );

        if( 
get_pcvar_numcvar_pickupTimes ) > ) {
                
pickupCountplayer ]++;
                if( 
pickupCountplayer ] >= get_pcvar_numcvar_pickupTimes ) )
                        
can_pickupplayer ] = false;
        }
    
    
ColorChatplayerGREEN"!g[Umbrella Hell] !yHas encontrado una ^3SupplyBox !ycon !g%s!"Databox_name ] );
        
client_cmdplayer"spk %s"PickupSound );
        
remove_entitybox );
}

public 
native_register_contentplugin_idparamaters_num ) {
        new 
BoxName32 ];
        
get_string1BoxNamecharsmaxBoxName ) );

        new 
DataSupplyContentsArray ];
        
Databox_id ]   = ArraySizeSupplyBoxesContents );
        
Databox_name ] = BoxName;
        
DatapickupForwardItem ] = CreateOneForwardplugin_id"sb_pickup_event"FP_CELL );
        
ArrayPushArraySupplyBoxesContentsData );

        
// Debuging //
        // log_amx( "Registered box content name: %s and id: %d", BoxName, Data[ box_id ] );

        // Return id to original plugin //
        
return Databox_id ];
}
public 
Message_StatusIcon(iMsgIdMSG_DESTid

    if( !
get_pcvar_num(p_Enabled) )
        return 
PLUGIN_HANDLED;
        
    static 
szIcon[5
    
get_msg_arg_string(2szIcon4
    if( 
szIcon[0] == 'b' && szIcon[2] == 'y' && szIcon[3] == 'z' 
    { 
        if( 
get_msg_arg_int(1)) 
        { 
            
fm_cs_set_user_nobuy(id
            return 
PLUGIN_HANDLED;
        } 
    }  
    
    return 
PLUGIN_CONTINUE;
}
public 
fwd_Touch(entid)
{
    if (!
is_user_connected(id) || !is_user_alive(id) || !pev_valident ) )
        return 
FMRES_IGNORED;
 
    static 
szEntModel[32]; 
    
pevent pev_model szEntModel 31 ); 
     
    for (new 
level_equip_id PlayerLevel[id] + 1level_equip_id MAXLEVELlevel_equip_id++) 
    { 
        if ( 
equaliszEntModel WEAPONMDL[level_equip_id] ) ) 
        { 
            return 
FMRES_SUPERCEDE
        }  
    } 

    return 
FMRES_IGNORED;
}
public 
fwd_PlayerSpawn(id)
{
    if( !
get_pcvar_num(p_Enabled) )
        return;
    
    if (
is_user_alive(id))
    {
        
g_kills[id] = 0
        
        
#if defined ZOMBIE_SWARM
        
if ( !get_pcvar_num(level_style) && get_user_team(id) == )
        {
            
StripPlayerWeapons(id);
            
            
set_task(2.0"show_main_menu_level"id)
        }
        
#endif
        
        #if defined NORMAL_MOD || defined ZOMBIE_INFECTION
        
if ( !get_pcvar_num(level_style))
        {
            
StripPlayerWeapons(id);
            
            
set_task(2.0"show_main_menu_level"id)
        }
        
#endif
        
        
if(!task_exists(TASK_SHOW_LEVEL id) && get_pcvar_num(show_level_text))
        {
            
set_task(0.1"task_show_level"TASK_SHOW_LEVEL id)
        }
        
        if ( 
get_pcvar_num(level_style) )
        {
            
set_task(0.3"give_weapon"id);
        }
    }
}
#if defined ZOMBIE_BIOHAZARD
public event_infect(g_victimg_attacker)
{
    if( !
get_pcvar_num(p_Enabled) )
        return;
    
    new 
counted_triple get_pcvar_num(xp_kill) + get_pcvar_num(xp_triple)
    new 
counted_ultra get_pcvar_num(xp_kill) + get_pcvar_num(xp_ultra)
    
    if((
<= g_attacker <= g_maxplayers))
    {
        if(
g_victim != g_attacker)
        {
            
g_kills[g_attacker]++;
            if(
PlayerLevel[g_attacker] < MAXLEVEL-1
            {
                if ( 
get_pcvar_num(enable_triple) && g_kills[g_attacker] < get_pcvar_num(triple_kills) || g_kills[g_attacker] > get_pcvar_num(triple_kills)
                || 
get_pcvar_num(enable_ultra) && g_kills[g_attacker] < get_pcvar_num(ultra_kills) || g_kills[g_attacker] > get_pcvar_num(ultra_kills) )
                {    
                    if ( 
get_pcvar_num(enable_admin_xp) && get_user_flags(g_attacker) & ADMIN_EXTRA)
                    {
                        
PlayerXp[g_attacker] += get_pcvar_num(admin_xp)
                    }
                    
PlayerXp[g_attacker] += get_pcvar_num(xp_kill)
                
                    
set_hudmessage(0255500.500.3312.02.0)
                    
ShowSyncHudMsg(g_attackerg_msgHudSync1"+%i"get_pcvar_num(xp_kill))
                }
                else if ( !
get_pcvar_num(enable_triple) || !get_pcvar_num(enable_ultra) )
                {
                    if ( 
get_pcvar_num(enable_admin_xp) && get_user_flags(g_attacker) & ADMIN_EXTRA)
                    {
                        
PlayerXp[g_attacker] += get_pcvar_num(admin_xp)
                    }
                    
                    
PlayerXp[g_attacker] += get_pcvar_num(xp_kill)
                
                    
set_hudmessage(0255500.500.3312.02.0)
                    
ShowSyncHudMsg(g_attackerg_msgHudSync1"+%i"get_pcvar_num(xp_kill))
                }
                if ( 
g_kills[g_attacker] == get_pcvar_num(triple_kills) && get_pcvar_num(enable_triple) )
                {    
                    if ( 
get_pcvar_num(enable_admin_xp) && get_user_flags(g_attacker) & ADMIN_EXTRA)
                    {
                        
PlayerXp[g_attacker] += get_pcvar_num(admin_xp)
                    }
                    
                    
PlayerXp[g_attacker] += counted_triple
                    
                    set_hudmessage
(0255500.450.3312.02.0)
                    
ShowSyncHudMsg(g_attackerg_msgHudSync1"%L"LANG_SERVER"TRIPLE_XP"counted_triple)
                }
                else if ( 
g_kills[g_attacker] == get_pcvar_num(ultra_kills) && get_pcvar_num(enable_ultra) )
                {
                    if ( 
get_pcvar_num(enable_admin_xp) && get_user_flags(g_attacker) & ADMIN_EXTRA)
                    {
                        
PlayerXp[g_attacker] += get_pcvar_num(admin_xp)
                    }
                    
                    
PlayerXp[g_attacker] += counted_ultra
                    
                    set_hudmessage
(0255500.450.3312.02.0)
                    
ShowSyncHudMsg(g_attackerg_msgHudSync1"%L"LANG_SERVER"ULTRA_XP"counted_ultra)
                }
            }
        }
        
check_level(g_attacker)
    }
}
#endif

#if defined ZOMBIE_PLAGUE
public zp_user_infected_post(g_victimg_attacker)
{
    if( !
get_pcvar_num(p_Enabled) )
        return;
    
    new 
counted_triple get_pcvar_num(xp_kill) + get_pcvar_num(xp_triple)
    new 
counted_ultra get_pcvar_num(xp_kill) + get_pcvar_num(xp_ultra)
    
    if((
<= g_attacker <= g_maxplayers))
    {
        if(
g_victim != g_attacker)
        {
            
g_kills[g_attacker]++;
            if(
PlayerLevel[g_attacker] < MAXLEVEL-1
            {
                if ( 
get_pcvar_num(enable_triple) && g_kills[g_attacker] < get_pcvar_num(triple_kills) || g_kills[g_attacker] > get_pcvar_num(triple_kills)
                || 
get_pcvar_num(enable_ultra) && g_kills[g_attacker] < get_pcvar_num(ultra_kills) || g_kills[g_attacker] > get_pcvar_num(ultra_kills) )
                {    
                    if ( 
get_pcvar_num(enable_admin_xp) && get_user_flags(g_attacker) & ADMIN_EXTRA)
                    {
                        
PlayerXp[g_attacker] += get_pcvar_num(admin_xp)
                    }
                    
PlayerXp[g_attacker] += get_pcvar_num(xp_kill)
                
                    
set_hudmessage(0255500.500.3312.02.0)
                    
ShowSyncHudMsg(g_attackerg_msgHudSync1"+%i"get_pcvar_num(xp_kill))
                }
                else if ( !
get_pcvar_num(enable_triple) || !get_pcvar_num(enable_ultra) )
                {
                    if ( 
get_pcvar_num(enable_admin_xp) && get_user_flags(g_attacker) & ADMIN_EXTRA)
                    {
                        
PlayerXp[g_attacker] += get_pcvar_num(admin_xp)
                    }
                    
                    
PlayerXp[g_attacker] += get_pcvar_num(xp_kill)
                
                    
set_hudmessage(0255500.500.3312.02.0)
                    
ShowSyncHudMsg(g_attackerg_msgHudSync1"+%i"get_pcvar_num(xp_kill))
                }
                if ( 
g_kills[g_attacker] == get_pcvar_num(triple_kills) && get_pcvar_num(enable_triple) )
                {    
                    if ( 
get_pcvar_num(enable_admin_xp) && get_user_flags(g_attacker) & ADMIN_EXTRA)
                    {
                        
PlayerXp[g_attacker] += get_pcvar_num(admin_xp)
                    }
                    
                    
PlayerXp[g_attacker] += counted_triple
                    
                    set_hudmessage
(0255500.450.3312.02.0)
                    
ShowSyncHudMsg(g_attackerg_msgHudSync1"%L"LANG_SERVER"TRIPLE_XP"counted_triple)
                }
                else if ( 
g_kills[g_attacker] == get_pcvar_num(ultra_kills) && get_pcvar_num(enable_ultra) )
                {
                    if ( 
get_pcvar_num(enable_admin_xp) && get_user_flags(g_attacker) & ADMIN_EXTRA)
                    {
                        
PlayerXp[g_attacker] += get_pcvar_num(admin_xp)
                    }
                    
                    
PlayerXp[g_attacker] += counted_ultra
                    
                    set_hudmessage
(0255500.450.3312.02.0)
                    
ShowSyncHudMsg(g_attackerg_msgHudSync1"%L"LANG_SERVER"ULTRA_XP"counted_ultra)
                }
            }
        }
        
check_level(g_attacker)
    }
}
#endif

public event_deathmsg()
{    
    if( !
get_pcvar_num(p_Enabled) )
        return;
    
    new 
g_attacker read_data(1);
    new 
g_victim read_data(2);
    
    new 
counted_triple get_pcvar_num(xp_kill) + get_pcvar_num(xp_triple)
    new 
counted_ultra get_pcvar_num(xp_kill) + get_pcvar_num(xp_ultra)
    
    if((
<= g_attacker <= g_maxplayers))
    {
        if(
g_victim != g_attacker)
        {
            
g_kills[g_attacker]++;
            if(
PlayerLevel[g_attacker] < MAXLEVEL-1
            {
                if ( 
get_pcvar_num(enable_triple) && g_kills[g_attacker] < get_pcvar_num(triple_kills) || g_kills[g_attacker] > get_pcvar_num(triple_kills)
                || 
get_pcvar_num(enable_ultra) && g_kills[g_attacker] < get_pcvar_num(ultra_kills) || g_kills[g_attacker] > get_pcvar_num(ultra_kills) )
                {    
                    if ( 
get_pcvar_num(enable_admin_xp) && get_user_flags(g_attacker) & ADMIN_EXTRA)
                    {
                        
PlayerXp[g_attacker] += get_pcvar_num(admin_xp)
                    }
                    
PlayerXp[g_attacker] += get_pcvar_num(xp_kill)
                
                    
set_hudmessage(0255500.500.3312.02.0)
                    
ShowSyncHudMsg(g_attackerg_msgHudSync1"+%i"get_pcvar_num(xp_kill))
                }
                else if ( !
get_pcvar_num(enable_triple) || !get_pcvar_num(enable_ultra) )
                {
                    if ( 
get_pcvar_num(enable_admin_xp) && get_user_flags(g_attacker) & ADMIN_EXTRA)
                    {
                        
PlayerXp[g_attacker] += get_pcvar_num(admin_xp)
                    }
                    
                    
PlayerXp[g_attacker] += get_pcvar_num(xp_kill)
                
                    
set_hudmessage(0255500.500.3312.02.0)
                    
ShowSyncHudMsg(g_attackerg_msgHudSync1"+%i"get_pcvar_num(xp_kill))
                }
                if ( 
g_kills[g_attacker] == get_pcvar_num(triple_kills) && get_pcvar_num(enable_triple) )
                {    
                    if ( 
get_pcvar_num(enable_admin_xp) && get_user_flags(g_attacker) & ADMIN_EXTRA)
                    {
                        
PlayerXp[g_attacker] += get_pcvar_num(admin_xp)
                    }
                    
                    
PlayerXp[g_attacker] += counted_triple
                    
                    set_hudmessage
(0255500.450.3312.02.0)
                    
ShowSyncHudMsg(g_attackerg_msgHudSync1"%L"LANG_SERVER"TRIPLE_XP"counted_triple)
                }
                else if ( 
g_kills[g_attacker] == get_pcvar_num(ultra_kills) && get_pcvar_num(enable_ultra) )
                {
                    if ( 
get_pcvar_num(enable_admin_xp) && get_user_flags(g_attacker) & ADMIN_EXTRA)
                    {
                        
PlayerXp[g_attacker] += get_pcvar_num(admin_xp)
                    }
                    
                    
PlayerXp[g_attacker] += counted_ultra
                    
                    set_hudmessage
(0255500.450.3312.02.0)
                    
ShowSyncHudMsg(g_attackerg_msgHudSync1"%L"LANG_SERVER"ULTRA_XP"counted_ultra)
                }
            }
        }
        
check_level(g_attacker)
    }
}
public 
Event_StatusValue(id)
{
    new 
target read_data(2)
      if(
target != id && target != && get_pcvar_num(p_Enabled))
      {
        static 
sName[32];
        
get_user_name(targetsName31)

        
set_hudmessage(2552552550.6, -1.000.06.00.00.02)
        
ShowSyncHudMsg(idg_msgHudSync1"%L"LANG_SERVER"LEVEL_TEXT"sNamePlayerLevel[target], RANKLEVELS[PlayerLevel[target]])
    }
}
public 
task_show_level(task)
{
    new 
id task TASK_SHOW_LEVEL
    
    
if(!is_user_alive(id) && !get_pcvar_num(show_level_text) )
        return 
PLUGIN_HANDLED;
    
    
set_hudmessage(255000.020.3300.00.30.00.0)
    
ShowSyncHudMsg(idg_msgHudSync1 "%L"LANG_SERVER"LEVEL_HUD_TEXT"PlayerLevel[id], PlayerXp[id], LEVELS[PlayerLevel[id]], RANK[PlayerLevel[id]], RANKLEVELS[PlayerLevel[id]])
    
    
set_task(0.1"task_show_level"TASK_SHOW_LEVEL id)        
    
    return 
PLUGIN_CONTINUE;
}
public 
showlevel(id)
{
    if ( !
get_pcvar_num(p_Enabled) && get_pcvar_num(show_level_text) )
        return 
PLUGIN_HANDLED;
    
    
client_printcolor(id"%L"LANG_SERVER"LEVEL_TEXT2"PlayerLevel[id] , PlayerXp[id], LEVELS[PlayerLevel[id]]);
    
client_printcolor(id"%L"LANG_SERVER"LEVEL_TEXT3"RANK[PlayerLevel[id]], RANKLEVELS[PlayerLevel[id]]);
    
    return 
PLUGIN_HANDLED;
}
public 
descriptionx(id)
{
    new 
szMotd[2048], szTitle[64], iPos 0
    format
(szTitle63"Info")
    
iPos += format(szMotd[iPos], 2047-iPos"<html><head><style type=^"text/css^">pre{color:#FFB000;}body{background:#000000;margin-left:8px;margin-top:0px;}</style></head><pre><body>")
    
iPos += format(szMotd[iPos], 2047-iPos"^n^n<b>%s</b>^n^n"szTitle)
    
iPos += format(szMotd[iPos], 2047-iPos"%L^n"LANG_SERVER"DESCRIPTION")
    
    
iPos += format(szMotd[iPos], 2047-iPos"%L"LANG_SERVER"DESCRIPTION2")
        
    
show_motd(idszMotdszTitle)
    return 
PLUGIN_HANDLED;
}
public 
check_level(id)
{
    if(
PlayerLevel[id] < MAXLEVEL-&& get_pcvar_num(p_Enabled))
    {
        while(
PlayerXp[id] >= LEVELS[PlayerLevel[id]])
        {
            
PlayerLevel[id]++;
                
            if(
is_user_alive(id))
            {    
                if ( 
get_pcvar_num(level_style) )
                {
                    
give_weapon(id);
                }
                
                new 
p_origin[3];
                
get_user_origin(idp_origin0);
                
                
set_sprite(p_originlevelspr30)
                
set_sprite(p_originlevelspr230)
            }
            
emit_sound(idCHAN_ITEMLevelUp1.0ATTN_NORM0PITCH_NORM);
            
            static 
name[32] ; get_user_name(idnamecharsmax(name));
            
client_printcolor(0"%L"LANG_SERVER"LEVEL_UP"namePlayerLevel[id]);
        }
    } 
}
// Main Menu Info
public show_main_menu_info(id)
{
    static 
menu[510], len;
    
len 0;
    
    new 
xKeys3 MENU_KEY_0|MENU_KEY_1;

    
// Title
    
len += formatex(menu[len], sizeof menu len"%L"LANG_SERVER"TITLE_MENU_INFO")
    
    
len += formatex(menu[len], sizeof menu len"\r1. \w%L"id"INFO")
    if ( 
get_pcvar_num(show_rank) )
    {
        
xKeys3 |= (MENU_KEY_2)
        
        
len += formatex(menu[len], sizeof menu len"^n\r2. \wTop 20^n")
    }
    else
    {
        
len += formatex(menu[len], sizeof menu len"^n\d2. Top 20^n")
    }
    
    if(
find_plugin_byfile("gunxpmod_shop.amxx") != INVALID_PLUGIN_ID)
    {
        
xKeys3 |= (MENU_KEY_3)
        
        
len += formatex(menu[len], sizeof menu len"\r3. \w%L^n"id"ITEM_LIST")
        if ( 
is_user_alive(id) )
        {
            
xKeys3 |= (MENU_KEY_4)
            
            
len += formatex(menu[len], sizeof menu len"\r4. \w%L^n"id"UNLOCKS_SHOP_TEXT")
        }
    }
    
    
len += formatex(menu[len], sizeof menu len"^n^n\r0.\w %L"id"EXIT_MENU")

    
show_menu(idxKeys3menu, -1"Main Menu")

public 
main_menu_info(idkey)
{
    switch (
key)
    {
        case 
0:
        {
            
show_main_menu_info(id)
            
            
descriptionx(id)
        }
        case 
1:
        {
            
showtop20(id)
            
            
show_main_menu_info(id)
        }
        case 
2:
        {
            
show_main_menu_info(id)
            
            if(
callfunc_begin"display_items","gunxpmod_shop.amxx") == 1)
            {
                
callfunc_push_intid ); 
                
callfunc_end();
            }
        }
        case 
3:
        {
            if(
callfunc_begin("item_upgrades","gunxpmod_shop.amxx") == 1)
            {
                
callfunc_push_intid ); 
                
callfunc_end();
            }
        }
        case 
9:
        {
            return 
PLUGIN_HANDLED;
        }
    }

    return 
PLUGIN_HANDLED;
}
// Main Menu Level Style
public show_main_menu_level(id)
{
    if ( !
is_user_alive(id) )
        return;
    
    static 
menu[510], len;
    
len 0;
    
    new 
xKeys2 MENU_KEY_0|MENU_KEY_1|MENU_KEY_2;

    
// Title
    
len += formatex(menu[len], sizeof menu len"%L"LANG_SERVER"TITLE_MENU"PlayerLevel[id], PlayerXp[id], LEVELS[PlayerLevel[id]])
    
    
len += formatex(menu[len], sizeof menu len"%L"LANG_SERVER"CHOOSE_TEXT")

    
len += formatex(menu[len], sizeof menu len"%L"LANG_SERVER"LAST_GUNS")
    
len += formatex(menu[len], sizeof menu len"^n^n\r0.\w %L"id"EXIT_MENU")

    
show_menu(idxKeys2menu, -1"Main Level Menu")

public 
main_menu_level(idkey)
{
    if ( !
is_user_alive(id) )
        return 
PLUGIN_HANDLED;
    
    switch (
key)
    {
        case 
0// back
        
{
            
first_check_menu(id)
        }
        case 
1// next
        
{
            
give_weapon_menu(idg_remember_selection[id]);
        }
        case 
9// exit
        
{
            return 
PLUGIN_HANDLED;
        }
    }

    return 
PLUGIN_HANDLED;
}
// Menu Level Style
public first_check_menu(id)
{
    
MENU_STARTID 0
    show_menu_level
(id);
}
public 
show_menu_level(id)
{
    if ( !
is_user_alive(id) )
        return;
    
    static 
menu[510], len, class;
    
len 0;
    
    new 
xKeys MENU_KEY_0;
    new 
max min(MENU_STARTID+7sizeof (LEVELS));
    new 
iPosNum 0;
    
    
// Title
    
len += formatex(menu[len], sizeof menu len"%L"LANG_SERVER"TITLE_MENU"PlayerLevel[id], PlayerXp[id], LEVELS[PlayerLevel[id]])
    
    
// 1-7. Class List
    
for (class = MENU_STARTID; class < max; class++)
    {
        if ( 
PlayerLevel[id] < class)
        {    
            
len += formatex(menu[len], sizeof menu len"%L"LANG_SERVER"INACTIVE_MENU", ++iPosNumRANK[class], class)
        } 
        else
        {
            
xKeys |= (1<<iPosNum++);

            
len += formatex(menu[len], sizeof menu len"%L"LANG_SERVER"ACTIVE_MENU", class-MENU_STARTID+1RANK[class], class)
        }
    }
    if ( 
MENU_STARTID != && MENU_STARTID != 21 )
    {    
        
xKeys |= (1<<7)
        
xKeys |= (1<<8)
        
        
len += formatex(menu[len], sizeof menu len"^n\r8.\w %L^n\r9.\w %L^n^n\r0.\w %L"id"BACK_MENU"id"NEXT_MENU"id"EXIT_MENU")
    }
    else if ( 
MENU_STARTID == )
    {
        
xKeys |= (1<<8)
        
        
len += formatex(menu[len], sizeof menu len"^n\r9.\w %L^n^n\r0.\w %L"id"NEXT_MENU"id"EXIT_MENU")
    }

    else if ( 
MENU_STARTID == 21 )
    {    
        
xKeys |= (1<<7)
        
        
len += formatex(menu[len], sizeof menu len"^n\r8.\w %L^n^n\r0.\w %L"id"BACK_MENU"id"EXIT_MENU")
    }
    
    
show_menu(idxKeysmenu, -1"Level by Menu")

public 
menu_level(idkey)
{
    if ( !
is_user_alive(id) )
        return 
PLUGIN_HANDLED;
    
    if (
key >= || key->= PlayerLevel[id])
    {
        switch (
key)
        {
            case 
7// back
            
{
                if (
MENU_STARTID->= 0MENU_STARTID -= 7
            
}
            case 
8// next
            
{
                if (
MENU_STARTID+sizeof (LEVELS)) MENU_STARTID += 7
            
}
            case 
9// exit
            
{
                return 
PLUGIN_HANDLED;
            }
        }

        
show_menu_level(id)
        return 
PLUGIN_HANDLED;
    }
    new 
selected MENU_STARTID key;

    
g_remember_selection[id] = selected;
    
    
give_weapon_menu(idselected);
    
    return 
PLUGIN_HANDLED;
}
public 
give_weapon_menu(idselection)
{
    
#if defined ZOMBIE_SWARM
    
if(get_user_team(id) == && is_user_alive(id) && get_pcvar_num(p_Enabled)) 
    {
        
StripPlayerWeapons(id);
        
        if ( 
get_pcvar_num(enable_grenades) )
        {
            
give_item(id"weapon_smokegrenade");
            
give_item(id"weapon_hegrenade");
        }
        if (!
user_has_weapon(idAMMOCONST[selection]))
        {
            
give_item(idWEAPONCONST[selection]);
        }
        
cs_set_user_bpammo(idAMMOCONST[selection], AMMO2CONST[selection])
    }
    
#endif
    
    #if defined ZOMBIE_INFECTION || defined NORMAL_MOD
    
if(is_user_alive(id) && get_pcvar_num(p_Enabled)) 
    {
        
StripPlayerWeapons(id);
        
        if ( 
get_pcvar_num(enable_grenades) )
        {
            
give_item(id"weapon_smokegrenade");
            
give_item(id"weapon_hegrenade");
        }
        if (!
user_has_weapon(idAMMOCONST[selection]))
        {
            
give_item(idWEAPONCONST[selection]);
        }
        
cs_set_user_bpammo(idAMMOCONST[selection], AMMO2CONST[selection])
    }
    
#endif
}
public 
give_weapon(id)
{
    
#if defined ZOMBIE_SWARM
    
if(get_user_team(id) == && is_user_alive(id) && get_pcvar_num(p_Enabled)) 
    {
        
StripPlayerWeapons(id);
        
        if ( 
get_pcvar_num(enable_grenades) && get_pcvar_num(level_style) )
        {
            
give_item(id"weapon_smokegrenade");
            
give_item(id"weapon_hegrenade");
        }
        
        if (!
user_has_weapon(idAMMOCONST[PlayerLevel[id]]))
        {
            
give_item(idWEAPONCONST[PlayerLevel[id]]);
        }
        
cs_set_user_bpammo(idAMMOCONST[PlayerLevel[id]], AMMO2CONST[PlayerLevel[id]])
    }
    
#endif
    
    #if defined ZOMBIE_INFECTION || defined NORMAL_MOD
    
if(is_user_alive(id) && get_pcvar_num(p_Enabled)) 
    {
        
StripPlayerWeapons(id);
        
        if ( 
get_pcvar_num(enable_grenades) && get_pcvar_num(level_style) )
        {
            
give_item(id"weapon_smokegrenade");
            
give_item(id"weapon_hegrenade");
        }
        if (!
user_has_weapon(idAMMOCONST[PlayerLevel[id]]))
        {
            
give_item(idWEAPONCONST[PlayerLevel[id]]);
        }
        
cs_set_user_bpammo(idAMMOCONST[PlayerLevel[id]], AMMO2CONST[PlayerLevel[id]])
    }
    
#endif
}
public 
set_sprite(p_origin[3], spriteradius)
{
    
// Explosion
    
message_begin(MSG_BROADCASTSVC_TEMPENTITYp_origin)
    
write_byte(TE_EXPLOSION)
    
write_coord(p_origin[0])
    
write_coord(p_origin[1])
    
write_coord(p_origin[2])
    
write_short(sprite)
    
write_byte(radius)
    
write_byte(15)
    
write_byte(4)
    
message_end()
}
//Shows Top 20
public showtop20(id)
{
    if( !
get_pcvar_num(p_Enabled) && !get_pcvar_num(show_rank) )
        return;
    
    static 
Sort[33][2];
    new 
players[32],num,count,index;
    
get_players(players,num);
    
    for(new 
0numi++)
    {
        
index players[i];
        
Sort[count][0] = index;
        
Sort[count][1] = PlayerXp[index];
        
count++;
    }
    
    
SortCustom2D(Sort,count,"CompareXp");
    new 
motd[1501],iLen;
    
iLen formatex(motdsizeof motd 1,"<body bgcolor=#000000><font color=#98f5ff><pre>");
    
iLen += formatex(motd[iLen], (sizeof motd 1) - iLen,"%s %-22.22s %3s^n""#""Name""# Experience");
    
    new 
clamp(count,0,20);
    new 
name[32],kindex;
    
    for(new 
0yx++)
    {
        
kindex Sort[x][0];
        
get_user_name(kindex,name,sizeof name 1);
        
iLen += formatex(motd[iLen], (sizeof motd 1) - iLen,"%d %-22.22s %d^n"1nameSort[x][1]);
    }
    
iLen += formatex(motd[iLen], (sizeof motd 1) - iLen,"</body></font></pre>");
    
show_motd(id,motd"GunXpMod Top 20");
}
public 
CompareXp(elem1[], elem2[])
{
    if(
elem1[1] > elem2[1])
        return -
1;
    else if(
elem1[1] < elem2[1])
        return 
1;
    
    return 
0;

// Command to set player Level
public cmd_give_level(idlevelcid
{
    if(!
cmd_access(idlevelcid3) || !get_pcvar_num(p_Enabled))
    {
        return 
PLUGIN_HANDLED;
    }
    
    new 
Arg1[64], Target
    read_argv
(1Arg163)
    
Target cmd_target(idArg10)
    
    new 
iLevel[32], Value
    read_argv
(2iLevel31)
    
Value str_to_num(iLevel)
    
    if(
iLevel[0] == '-'
    {
        
console_print(id"You can't have a '-' in the value!")
        return 
PLUGIN_HANDLED;
    }
    
    if(!
Target
    {
        
console_print(id"Target not found!")
        return 
PLUGIN_HANDLED;
    }
    
    if(
Value MAXLEVEL-1)
    {
        
console_print(id"You can't set a more than %d!"MAXLEVEL-1)
        return 
PLUGIN_HANDLED;
    }
    
    if(
Value 1)
    {
        
console_print(id"You can't set less than 1!")
        return 
PLUGIN_HANDLED;
    }
    
    new 
AdminName[32]
    
get_user_name(idAdminName31)
        
    new 
TargetName[32]
    
get_user_name(TargetTargetName31)
    
    
PlayerLevel[Target] = Value 1
    PlayerXp
[Target] = LEVELS[PlayerLevel[Target]]
    
check_level(Target)
    
    
client_printcolor(Target"/gADMIN /ctr%s /yEstablecio tu Nivel a /g%d"AdminNameValue)

    return 
PLUGIN_HANDLED;
}
// Save Player Info
SaveLevel(id)

    if ( 
get_pcvar_num(savexp) )
    {
        new 
authid[32]
        
get_user_authid(idauthid31)
        new 
szData[256];
        new 
szKey[64];
        
        
formatexszKey 63 "%s-ID" authid);
        
formatexszData 255 "%i#%i#" PlayerLevel[id], PlayerXp[id] );
    
        
nvault_setg_Vault szKey szData );
    }
    else
    {
        new 
authip[32]
        
get_user_ip(id,authip,31,1)
        new 
szData[256];
        new 
szKey[64];
        
        
formatexszKey 63 "%s-IP" authip );
        
formatexszData 255 "%i#%i#" PlayerLevel[id], PlayerXp[id] );
    
        
nvault_setg_Vault szKey szData );
    }
}
// Load Player Info
LoadLevel(id)
{
    if ( 
get_pcvar_num(savexp) )
    {
        new 
authid[32]
        
get_user_authid(idauthid31)
        new 
szData[256];
        new 
szKey[40];

        
formatexszKey 39 "%s-ID" authid );

        
formatex(szData 255"%i#%i#"PlayerLevel[id], PlayerXp[id]) 
        
        
nvault_get(g_VaultszKeyszData255

        
replace_all(szData 255"#"" ")
        new 
xp[32], level[32
        
parse(szDatalevel31xp31
        
PlayerLevel[id] = str_to_num(level)
        
PlayerXp[id] = str_to_num(xp)  
    }
    else
    {
        new 
authip[32]
        
get_user_ip(idauthip311)
        new 
szData[256];
        new 
szKey[40];

        
formatexszKey 39 "%s-IP" authip );

        
formatex(szData 255"%i#%i#"PlayerLevel[id], PlayerXp[id]) 
        
        
nvault_get(g_VaultszKeyszData255

        
replace_all(szData 255"#"" ")
        new 
xp[32], level[32
        
parse(szDatalevel31xp31
        
PlayerLevel[id] = str_to_num(level)
        
PlayerXp[id] = str_to_num(xp
    }
}
// ============================================================//
//                          [~ Natives ~]                          //
// ============================================================//
// Native: get_user_xp
public native_get_user_xp(id)
{
    return 
PlayerXp[id];
}
// Native: set_user_xp
public native_set_user_xp(idamount)
{
    
PlayerXp[id] = amount;
}
// Native: get_user_level
public native_get_user_level(id)
{
    return 
PlayerLevel[id];
}
// Native: set_user_xp
public native_set_user_level(idamount)
{
    
PlayerLevel[id] = amount;
}
// Native: Gets user level by Xp
public native_get_user_max_level(id)
{
    return 
LEVELS[PlayerLevel[id]];
}
// ============================================================//
//                          [~ Stocks ~]                          //
// ============================================================//
stock client_printcolor(const id, const input[], any:...)
{
    new 
count 1players[32];
    static 
msg[191];
    
vformat(msg,190,input,3);
    
replace_all(msg,190,"/g","^4");// green txt
    
replace_all(msg,190,"/y","^1");// orange txt
    
replace_all(msg,190,"/ctr","^3");// team txt
    
replace_all(msg,190,"/w","^0");// team txt
    
if (idplayers[0] = id; else get_players(players,count,"ch");
    for (new 
0counti++)
        if (
is_user_connected(players[i]))
        {
            
message_begin(MSG_ONE_UNRELIABLESayTxT_players[i]);
            
write_byte(players[i]);
            
write_string(msg);
            
message_end();
        }
}    
public 
StripPlayerWeapons(id

    
strip_user_weapons(id
    
set_pdata_int(idOFFSET_PRIMARYWEAPON0
    
give_item(id"weapon_knife");

Ze_Jurassic_World_Z [52%]
Ze_Jumping_Area [37%]
(04/02/2019, 05:15 PM)kikizon2 escribió: Me voy por un tiempo y cuando regreso veo esto... Oh god why
Responder
#11
(13/04/2019, 12:10 AM)LIL8ZINN escribió: Prueba este haber si te sirve
Código PHP:
#if defined ZOMBIE_BIOHAZARD
  #include <biohazard>
#endif
#if defined ZOMBIE_PLAGUE
  #include <zombieplague>
#endif

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <fun>
#include <cstrike>
#include <nvault>
#include <hamsandwich>
#include <engine>
#include <colorchat>

#define PLUGIN    "Gun Xp Mod"
#define AUTHOR    "xbatista"
#define VERSION    "1.7"

//#define NORMAL_MOD
//#define ZOMBIE_SWARM
#define ZOMBIE_INFECTION

#define ZOMBIE_BIOHAZARD
//#define ZOMBIE_PLAGUE


#define ADMIN_EXTRA ADMIN_LEVEL_H
#define MAXLEVEL 24

#define OFFSET_PRIMARYWEAPON 116
#define MENU_STARTID g_menu_data[id][2]
const KEYSMENU = (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<9)
#define TASK_SHOW_LEVEL 10113
#define fm_cs_set_user_nobuy(%1) set_pdata_int(%1, 235, get_pdata_int(%1, 235) & ~(1<<0) ) //no weapon buy

new PlayerXp[33];
new 
PlayerLevel[33];

new 
g_Vault;
new 
g_kills[33];
new 
g_menu_data[33][8];
new 
g_remember_selection[33];
new 
g_maxplayersg_msgHudSync1SayTxTenable_grenades;
new 
levelsprlevelspr2show_level_textshow_rank;
new 
savexp xp_killxp_tripleenable_tripletriple_killsxp_ultraultra_killsenable_ultrap_Enabledlevel_style;
new 
enable_admin_xpadmin_xp;

// Entity specifics //
new entSupply[ ] = "supply_box_entity";
new 
Float:minModel] = { -8.01, -8.090.0 }
new 
Float:maxModel] = { 8.128.0922.26 }
new const 
SupplyBoxModel[ ]   = { "models/umbrella_hell/w_supply_box.mdl" }
new const 
PickupSound[ ]      = { "supply_box/supplybox_pickup.wav" }
new const 
SUPPLY_BOX_SOUND[ ] = { "supply_box/supplybox_drop.wav" }

// Player specifics //
new bool:can_pickup33 ];
new 
pickupCount33 ];

// Supply box specifics //
#define TASK_ID_SPAWN_BOXES 150
new Array:SupplyBoxes, Array:EmptyCfgLines;     // <- Information holders //
enum _SupplyBoxesArray {                      // <- Array variables //
        
line_id,
        
Float:box_origin],
        
Float:box_angles]
}
new Array:
SupplyBoxesContents;                  // <- Content holder //
enum _SupplyContentsArray {
        
box_id,
        
box_name35 ],
        
pickupForwardItem
}
// Server specifics //
new cvar_pickupTimescvar_timesPerRoundcvar_amountSpawncvar_teamcvar_spawnEvery;
new 
maxPlayersmapName32 ], configurationFile258 ], lines;
new 
forwardResultspawnCount;

new const 
LevelUp[] = "umbrella/levelup.wav";
                                                           
//mac10//
new const LEVELS[MAXLEVEL] = { 90180300450700120018002800,
41005200600068008200102001200015000175002050025500//<-aug//
29000350004600058000150000
}; // Levels

new const RANKLEVELS[MAXLEVEL][] = { "Novato""Novato""Novato""Novato""Novato""Protector""Protector""Protector",
"Cazador""Cazador""Cazador""Cazador""Asesino""Asesino""Asesino""Asesino""Seテアor de la Guerra""Seテアor de la Guerra""Seテアor de la Guerra"
"Heroe""Heroe""Heroe""Soldado Umbrella""Soldado Umbrella"
}; // Rank Levels

new const RANK[MAXLEVEL][] = { "Glock 18C""USP .45 ACP Tactical""P228 Compact""FiveseveN""Desert Eagle .50 AE""Dual Elite Berettas"
"Schmidt TMP""Ingram MAC-10""UMP 45""MP5 Navy""ES P90""Scout""AWP Magnum Sniper""Famas""IMI Galil""M3 Super 90""XM1014 M4"
"AK-47""M4A1 Carbine""Steyr AUG A1""SG-552 Commando""SG-550 Auto-Sniper""G3SG1 Auto-Sniper""M249 Para Machinegun" 
}; // Weapon Name Ranks

new const WEAPONCONST[MAXLEVEL][] = { "weapon_glock18""weapon_usp""weapon_p228""weapon_fiveseven""weapon_deagle""weapon_elite""weapon_tmp"
"weapon_mac10""weapon_ump45""weapon_mp5navy""weapon_p90""weapon_scout""weapon_awp""weapon_famas""weapon_galil""weapon_m3""weapon_xm1014"
"weapon_ak47""weapon_m4a1""weapon_aug""weapon_sg552""weapon_sg550""weapon_g3sg1""weapon_m249" 
}; // Give Weapons

new const WEAPONMDL[MAXLEVEL][] = { "models/w_glock18.mdl""models/w_usp.mdl""models/w_p228.mdl""models/w_fiveseven.mdl""models/w_deagle.mdl""models/w_elite.mdl""models/w_tmp.mdl"
"models/w_mac10.mdl""models/w_ump45.mdl""models/w_mp5.mdl""models/w_p90.mdl""models/w_scout.mdl""models/w_awp.mdl""models/w_famas.mdl""models/w_galil.mdl""models/w_m3.mdl""models/w_xm1014.mdl"
"models/w_ak47.mdl""models/w_m4a1.mdl""models/w_aug.mdl""models/w_sg552.mdl""models/w_sg550.mdl""models/w_g3sg1.mdl""models/w_m249.mdl" 
}; // Blocks pick up weapon, that is not model replacement!!!

new const AMMOCONST[MAXLEVEL] = { 17161112610237121930318
15142152822827132420 
}; // Weapons ID(CSW)

new const AMMO2CONST[MAXLEVEL] = { 40040040040040040040040040040040040090
4004008080400400400400200200400
}; // Weapons Ammo

/*================================================================================
                        [Plugin natives,precache,init]
=================================================================================*/
public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR);
    
register_cvar("gxm_version"VERSIONFCVAR_SPONLY|FCVAR_SERVER)
    
set_cvar_string("gxm_version"VERSION)
    
    
register_concmd("dar_nivel""cmd_give_level"ADMIN_RCON" <nombre> <cantidad>" );
    
register_clcmd("say nivel""showlevel");
    
register_clcmd("say /nivel""showlevel");
    
register_clcmd("say /top20","showtop20");
    
register_clcmd("say guns" ,"main_menu_level");
    
register_clcmd("say /guns" ,"main_menu_level");
    
register_clcmd("say armas" ,"main_menu_level");
    
register_clcmd("say /armas" ,"main_menu_level");
    
    
    
p_Enabled register_cvar"gxm_enable""1" ); // Plugin enabled? 1 = Yes, 0 = No.
    
xp_kill register_cvar("gxm_xp","7"); // How much xp gain if you killed someone?
    
savexp register_cvar("gxm_save","0"); // Save Xp by : 1 = SteamID, 0 = IP.
    
show_level_text register_cvar("gxm_level_text","1"); // Show your level by : 1 = HUD message, 0 = Simple colored text message.
    
show_rank register_cvar("gxm_show_rank","1"); // Show rank in /top20? 1 = Yes, 0 = No.
    
level_style register_cvar("gxm_level_style","0"); // You will gain each level new gun : 1 = Yes, 0 = No,select your gun by menu.
    
enable_grenades register_cvar("gxm_grenades","1"); // Give to player grenades? 1 = Yes, 0 = No.
    
    
enable_triple register_cvar("gxm_triple","1"); // Enable Triple Kill bonus xp? 1 = Yes, 0 = No.
    
xp_triple register_cvar("gxm_triple_xp","3"); // How much bonus xp give for Triple Kill?
    
triple_kills register_cvar("gxm_triple_kills","3"); // How much kills needed to give bonus xp?
    
enable_ultra register_cvar("gxm_ultra","1"); // Enable Ultra Kill bonus xp? 1 = Yes, 0 = No.
    
xp_ultra register_cvar("gxm_ultra_xp","5"); // How much bonus xp give for Ultra Kill?
    
ultra_kills register_cvar("gxm_ultra_kills","6"); // How much kills needed to give bonus xp?
    
    
enable_admin_xp register_cvar("gxm_admin_xp","1"); // Enable Extra xp for killing? 1 = Yes, 0 = No.
    
admin_xp register_cvar("gxm_extra_xp","5"); // How much extra xp give to admins?
                    // Events //
    
register_event("DeathMsg""event_deathmsg""a");
    
register_event("StatusValue""Event_StatusValue""bd""1=2")
                    
// Forwards //
    
RegisterHam(Ham_Spawn"player""fwd_PlayerSpawn"1);
    
    
register_forward(FM_Touch"fwd_Touch");
                    
// Messages //
    #if defined NORMAL_MOD || defined ZOMBIE_SWARM
    
register_message(get_user_msgid("StatusIcon"),    "Message_StatusIcon")
    
#endif
    
                    // Other //    
    
register_menu("Level by Menu"KEYSMENU"menu_level")
    
register_menu("Main Level Menu"KEYSMENU"main_menu_level")
    
register_menucmd(register_menuid("Main Menu"), 1023"main_menu_info")
    
    
register_dictionary("gunxpmod.txt");
                    
    
SayTxT get_user_msgid("SayText");
    
    
g_msgHudSync1 CreateHudSyncObj()
    
g_maxplayers get_maxplayers();
    

        
cvar_spawnEvery    register_cvar"sb_spawn_every""60.0" );
        
cvar_pickupTimes   register_cvar"sb_pickup_times""999" );
        
cvar_timesPerRound register_cvar"sb_times_per_round""2" );
        
cvar_amountSpawn   register_cvar"sb_spawn_amount""999" );
        
cvar_team          register_cvar"sb_team""2" );

        
register_touchentSupply"player""supply_box_pickup" );
        
register_logevent"RoundEnd"2"1=Round_End" );
        
register_logevent"RoundStart"2"1=Round_Start" );
        
RegisterHamHam_Spawn"player""playerSpawn");

        
register_clcmd"supplybox""supplyAdminMenu" );

        
maxPlayers get_maxplayers( );
}
public 
plugin_natives()
{
                    
// Player natives //
    
register_native("get_user_xp""native_get_user_xp"1);
    
register_native("set_user_xp""native_set_user_xp"1);
    
register_native("get_user_level""native_get_user_level"1);
    
register_native("set_user_level""native_set_user_level"1);
    
register_native("get_user_max_level""native_get_user_max_level"1);
    
    
register_native"register_box_content""native_register_content" );
}
public 
plugin_precache()
{
    
levelspr engfunc(EngFunc_PrecacheModel"sprites/xfire.spr");
    
levelspr2 engfunc(EngFunc_PrecacheModel"sprites/xfire2.spr");
    
    
precache_modelSupplyBoxModel );
    
precache_soundPickupSound );
    
precache_soundSUPPLY_BOX_SOUND );

    
SupplyBoxes         ArrayCreateSupplyBoxesArray );
    
SupplyBoxesContents ArrayCreateSupplyContentsArray );
    
EmptyCfgLines       ArrayCreate1);
    
    
engfunc(EngFunc_PrecacheSoundLevelUp);
}
public 
plugin_cfg()
{
    
//Open our vault and have g_Vault store the handle.
    
g_Vault nvault_open"gunxpmod" );

    
//Make the plugin error if vault did not successfully open
    
if ( g_Vault == INVALID_HANDLE )
        
set_fail_state"Error opening GunXpMod nVault, file does not exist!" );
    
    
get_mapnamemapNamecharsmaxmapName ) );
        
addmapNamecharsmaxmapName ), ".cfg");
        
get_configsdirconfigurationFilecharsmaxconfigurationFile ) );
        
addconfigurationFilecharsmaxconfigurationFile ), "/SupplyBoxes/");

        if( !
dir_existsconfigurationFile ) )
                
mkdirconfigurationFile );

        
addconfigurationFilecharsmaxconfigurationFile ), mapName);

        if( !
file_existsconfigurationFile ) ) {
                new 
m_map_cfg fopenconfigurationFile"wt" );
                
fclosem_map_cfg );
        }
        
fillSupplyArray( );
}
public 
plugin_end()
{
    
//Close the vault when the plugin ends (map change\server shutdown\restart)
    
nvault_closeg_Vault );
}
public 
client_authorized(id)
{
    
g_remember_selection[id] = 0;
    
    
LoadLevel(id)
}
public 
client_disconnect(id)
{
    
SaveLevel(id)
    
can_pickupid ]  = false;
        
pickupCountid ] = 0;
}
public 
client_putinserverid ) {
        
can_pickupid ]  = false;
        
pickupCountid ] = 0;
}
public 
RoundStart( ) {
        if( 
get_pcvar_floatcvar_spawnEvery ) < 30.0 )
                
set_task30.0"spawnSupplyBoxes"TASK_ID_SPAWN_BOXES__"b" );
        else
                
set_taskget_pcvar_floatcvar_spawnEvery ), "spawnSupplyBoxes"TASK_ID_SPAWN_BOXES__"b" );
}
public 
RoundEnd( ) {
        
remove_taskTASK_ID_SPAWN_BOXES );
        for( new 
index 1index maxPlayersindex++ )
                
pickupCountindex ] = 0;
        
spawnCount 0;
        
remove_supply_boxes( );
}

public 
playerSpawnid ) {
        if( !
is_user_aliveid ) || get_user_teamid ) != get_pcvar_numcvar_team ) )
                
can_pickupid ] = false;
        else
                
can_pickupid ] = true;
}
public 
fillSupplyArray( ) {
        new 
data258 ];
        new 
Float:Origin], Float:Angles];
        new const 
text_parser][ ];

        new 
file fopenconfigurationFile"r" );
        while( 
fgetsfiledatacharsmaxdata ) - ) ) {

                
lines++;
                if( 
data] == ' ' ) {
                        
ArrayPushCellEmptyCfgLineslines );
                        continue;
                }

                
parsedatatext_parser], 7text_parser], 7text_parser], 7text_parser], 7text_parser], 7text_parser], );
                
Origin] = str_to_floattext_parser] );
                
Origin] = str_to_floattext_parser] );
                
Origin] = str_to_floattext_parser] );
                
Angles] = str_to_floattext_parser] );
                
Angles] = str_to_floattext_parser] );
                
Angles] = str_to_floattext_parser] );

                
AddSupplyToArrayOriginAngleslines );
        }
        
fclosefile );
}

public 
supplyAdminMenuid ) {
        if( !( 
get_user_flagsid ) & ADMIN_IMMUNITY ) || !is_user_aliveid ) )
                return 
PLUGIN_HANDLED;

        new 
menu menu_create"\r[Umbrella Hell] \yMenu SupplyBox""supply_menu_handler" );
        
menu_additemmenu"Poner una SupplyBox""1" );
        
menu_additemmenu"Borrar una SupplyBox""2" );

        
menu_setpropmenuMPROP_EXITMEXIT_ALL );
        
menu_displayidmenu);
        return 
PLUGIN_HANDLED;
}

public 
supply_menu_handleridmenuitem ) {
        if( !
is_user_aliveid ) )
                return 
PLUGIN_HANDLED;

        if( 
item == MENU_EXIT ) {
                
menu_destroymenu );
                return 
PLUGIN_HANDLED;
        }

        new 
data], name64 ], accesscallbackkey;
        
menu_item_getinfomenuitemaccessdata5namecharsmaxname ), callback );

        
key str_to_numdata );
        switch( 
key ) {
                case 
1: {
                        new 
TargetOrigin], Float:Target], Float:Angles];
                        
get_user_originidTargetOrigin);

                        
Target] = floatTargetOrigin] );
                        
Target] = floatTargetOrigin] );
                        
Target] = floatTargetOrigin] );

                    
entity_get_vectoridEV_VEC_v_angleAngles );
                        
Angles] = 0.0;
                        
CreateSupplyBoxTargetAngles );
                }
                case 
2: {
                        new 
entitybody;
                    
get_user_aimingidentitybody500 );
                        
deleteSupplyBoxentity );
                }
        }
        
supplyAdminMenuid );
        return 
PLUGIN_HANDLED;
}

public 
CreateSupplyBoxFloat:Origins], Float:Angles] ) {
        new 
szData248 ], line_to_item;
        
formatszDatacharsmaxszData ), "%f %f %f %f %f %f"Origins], Origins], Origins], Angles], Angles], Angles] );

        if( 
ArraySizeEmptyCfgLines ) > ) {
                new 
emptyLineId ArrayGetCellEmptyCfgLines);
                
ArrayDeleteItemEmptyCfgLines);
                
write_fileconfigurationFileszDataemptyLineId );
                
line_to_item emptyLineId;
        } else {
                
lines++;
                
write_fileconfigurationFileszData );
                
line_to_item lines;
        }
        
AddSupplyToArrayOriginsAnglesline_to_item );
        
spawnSupplyBoxOriginsAnglesline_to_item );
}

public 
AddSupplyToArrayFloat:Origin], Float:Angles], id ) {
        new 
DataSupplyBoxesArray ];
        
Dataline_id ]    = id;
        
Databox_origin ] = _:Origin;
        
Databox_angles ] = _:Angles;

        
ArrayPushArraySupplyBoxesData );
}

public 
deleteSupplyBoxent ) {

        if( 
pev_valident ) ) {
                new 
class_name_ent64 ];
                
entity_get_stringentEV_SZ_classnameclass_name_entcharsmaxclass_name_ent ) );
                if( 
equalclass_name_ententSupply ) ) {
                        new 
size ArraySizeSupplyBoxes );
                        new 
item_id peventpev_iuser1 );
                        for( new 
0sizei++ ) {
                                new 
DataArraySupplyBoxesArray ];
                                
ArrayGetArraySupplyBoxesiDataArray );
                                if( 
DataArrayline_id ] == item_id ) {
                                        
lines--;
                                        
remove_entityent );
                                        
ArrayPushCellEmptyCfgLinesitem_id );
                                        
write_fileconfigurationFile" "item_id );
                                        
ArrayDeleteItemSupplyBoxes);
                                        break;
                                }
                        }
                }
        }

}

public 
spawnSupplyBoxes( ) {

        if( 
ArraySizeSupplyBoxes ) < || ArraySizeSupplyBoxesContents ) < || spawnCount >= get_pcvar_numcvar_timesPerRound ) ) {
                
remove_taskTASK_ID_SPAWN_BOXES );
                return;
        }
        
remove_supply_boxes( );
        
spawnCount++;

        new 
Float:Orig], Float:Angl];
        new 
AmountCvar   get_pcvar_numcvar_amountSpawn );
        new 
ArraySizeBox ArraySizeSupplyBoxes );
        new 
size = ( AmountCvar == || AmountCvar ArraySizeBox ) ? ArraySizeBox AmountCvar;
        new 
DataSupplyBoxesArray ];
        new 
countrandomId;
        new Array:
Boxes ArrayCreateSupplyBoxesArray );

        for( new 
index 0index ArraySizeBoxindex++ ) {
                
ArrayGetArraySupplyBoxesindexData );
                
ArrayPushArrayBoxesData );
        }

        do {
                
randomId randomArraySizeBox );
                
ArrayGetArrayBoxesrandomIdData );
                
Orig] = Databox_origin ][ ]; Angl] = Databox_angles ][ ];
                
Orig] = Databox_origin ][ ]; Angl] = Databox_angles ][ ];
                
Orig] = Databox_origin ][ ]; Angl] = Databox_angles ][ ];
                
spawnSupplyBoxOrigAnglDataline_id ] );
                
count++;

                
ArrayDeleteItemBoxesrandomId );
                
ArraySizeBox--;
        } while( 
count size );

        
client_cmd0"spk %s"SUPPLY_BOX_SOUND );
        
client_print(0print_center".... Presents arrived ...")

}

public 
remove_supply_boxes( ) {
        new 
ent = -1;
        while( ( 
ent engfuncEngFunc_FindEntityByStringent"classname"entSupply ) ) )
                
remove_entityent );
}

public 
spawnSupplyBoxFloat:pOrigins], Float:pAngles], line_idas ) {
        new 
entity create_entity"info_target" );
        
entity_set_stringentityEV_SZ_classnameentSupply );
        
entity_set_intentityEV_INT_solidSOLID_BBOX );
        
entity_set_originentitypOrigins );
        
entity_set_vectorentityEV_VEC_anglespAngles );
        
entity_set_modelentitySupplyBoxModel );
        
entity_set_sizeentityminModelmaxModel );

        
entity_set_intentityEV_INT_renderfxkRenderFxGlowShell );
        
entity_set_vectorentityEV_VEC_rendercolorFloat:{ 221.0173.0237.0 } );

        
set_peventitypev_iuser1line_idas );
}

public 
supply_box_pickupboxplayer ) {
        if( !
is_user_aliveplayer ) || !can_pickupplayer ] )
                return;

        new 
randomDrop randomArraySizeSupplyBoxesContents ) );
        new 
DataSupplyContentsArray ];
        
ArrayGetArraySupplyBoxesContentsrandomDropData );
        
ExecuteForwardDatapickupForwardItem ], forwardResultplayer );

        if( 
get_pcvar_numcvar_pickupTimes ) > ) {
                
pickupCountplayer ]++;
                if( 
pickupCountplayer ] >= get_pcvar_numcvar_pickupTimes ) )
                        
can_pickupplayer ] = false;
        }
    
    
ColorChatplayerGREEN"!g[Umbrella Hell] !yHas encontrado una ^3SupplyBox !ycon !g%s!"Databox_name ] );
        
client_cmdplayer"spk %s"PickupSound );
        
remove_entitybox );
}

public 
native_register_contentplugin_idparamaters_num ) {
        new 
BoxName32 ];
        
get_string1BoxNamecharsmaxBoxName ) );

        new 
DataSupplyContentsArray ];
        
Databox_id ]   = ArraySizeSupplyBoxesContents );
        
Databox_name ] = BoxName;
        
DatapickupForwardItem ] = CreateOneForwardplugin_id"sb_pickup_event"FP_CELL );
        
ArrayPushArraySupplyBoxesContentsData );

        
// Debuging //
        // log_amx( "Registered box content name: %s and id: %d", BoxName, Data[ box_id ] );

        // Return id to original plugin //
        
return Databox_id ];
}
public 
Message_StatusIcon(iMsgIdMSG_DESTid

    if( !
get_pcvar_num(p_Enabled) )
        return 
PLUGIN_HANDLED;
        
    static 
szIcon[5
    
get_msg_arg_string(2szIcon4
    if( 
szIcon[0] == 'b' && szIcon[2] == 'y' && szIcon[3] == 'z' 
    { 
        if( 
get_msg_arg_int(1)) 
        { 
            
fm_cs_set_user_nobuy(id
            return 
PLUGIN_HANDLED;
        } 
    }  
    
    return 
PLUGIN_CONTINUE;
}
public 
fwd_Touch(entid)
{
    if (!
is_user_connected(id) || !is_user_alive(id) || !pev_valident ) )
        return 
FMRES_IGNORED;
 
    static 
szEntModel[32]; 
    
pevent pev_model szEntModel 31 ); 
     
    for (new 
level_equip_id PlayerLevel[id] + 1level_equip_id MAXLEVELlevel_equip_id++) 
    { 
        if ( 
equaliszEntModel WEAPONMDL[level_equip_id] ) ) 
        { 
            return 
FMRES_SUPERCEDE
        }  
    } 

    return 
FMRES_IGNORED;
}
public 
fwd_PlayerSpawn(id)
{
    if( !
get_pcvar_num(p_Enabled) )
        return;
    
    if (
is_user_alive(id))
    {
        
g_kills[id] = 0
        
        
#if defined ZOMBIE_SWARM
        
if ( !get_pcvar_num(level_style) && get_user_team(id) == )
        {
            
StripPlayerWeapons(id);
            
            
set_task(2.0"show_main_menu_level"id)
        }
        
#endif
        
        #if defined NORMAL_MOD || defined ZOMBIE_INFECTION
        
if ( !get_pcvar_num(level_style))
        {
            
StripPlayerWeapons(id);
            
            
set_task(2.0"show_main_menu_level"id)
        }
        
#endif
        
        
if(!task_exists(TASK_SHOW_LEVEL id) && get_pcvar_num(show_level_text))
        {
            
set_task(0.1"task_show_level"TASK_SHOW_LEVEL id)
        }
        
        if ( 
get_pcvar_num(level_style) )
        {
            
set_task(0.3"give_weapon"id);
        }
    }
}
#if defined ZOMBIE_BIOHAZARD
public event_infect(g_victimg_attacker)
{
    if( !
get_pcvar_num(p_Enabled) )
        return;
    
    new 
counted_triple get_pcvar_num(xp_kill) + get_pcvar_num(xp_triple)
    new 
counted_ultra get_pcvar_num(xp_kill) + get_pcvar_num(xp_ultra)
    
    if((
<= g_attacker <= g_maxplayers))
    {
        if(
g_victim != g_attacker)
        {
            
g_kills[g_attacker]++;
            if(
PlayerLevel[g_attacker] < MAXLEVEL-1
            {
                if ( 
get_pcvar_num(enable_triple) && g_kills[g_attacker] < get_pcvar_num(triple_kills) || g_kills[g_attacker] > get_pcvar_num(triple_kills)
                || 
get_pcvar_num(enable_ultra) && g_kills[g_attacker] < get_pcvar_num(ultra_kills) || g_kills[g_attacker] > get_pcvar_num(ultra_kills) )
                {    
                    if ( 
get_pcvar_num(enable_admin_xp) && get_user_flags(g_attacker) & ADMIN_EXTRA)
                    {
                        
PlayerXp[g_attacker] += get_pcvar_num(admin_xp)
                    }
                    
PlayerXp[g_attacker] += get_pcvar_num(xp_kill)
                
                    
set_hudmessage(0255500.500.3312.02.0)
                    
ShowSyncHudMsg(g_attackerg_msgHudSync1"+%i"get_pcvar_num(xp_kill))
                }
                else if ( !
get_pcvar_num(enable_triple) || !get_pcvar_num(enable_ultra) )
                {
                    if ( 
get_pcvar_num(enable_admin_xp) && get_user_flags(g_attacker) & ADMIN_EXTRA)
                    {
                        
PlayerXp[g_attacker] += get_pcvar_num(admin_xp)
                    }
                    
                    
PlayerXp[g_attacker] += get_pcvar_num(xp_kill)
                
                    
set_hudmessage(0255500.500.3312.02.0)
                    
ShowSyncHudMsg(g_attackerg_msgHudSync1"+%i"get_pcvar_num(xp_kill))
                }
                if ( 
g_kills[g_attacker] == get_pcvar_num(triple_kills) && get_pcvar_num(enable_triple) )
                {    
                    if ( 
get_pcvar_num(enable_admin_xp) && get_user_flags(g_attacker) & ADMIN_EXTRA)
                    {
                        
PlayerXp[g_attacker] += get_pcvar_num(admin_xp)
                    }
                    
                    
PlayerXp[g_attacker] += counted_triple
                    
                    set_hudmessage
(0255500.450.3312.02.0)
                    
ShowSyncHudMsg(g_attackerg_msgHudSync1"%L"LANG_SERVER"TRIPLE_XP"counted_triple)
                }
                else if ( 
g_kills[g_attacker] == get_pcvar_num(ultra_kills) && get_pcvar_num(enable_ultra) )
                {
                    if ( 
get_pcvar_num(enable_admin_xp) && get_user_flags(g_attacker) & ADMIN_EXTRA)
                    {
                        
PlayerXp[g_attacker] += get_pcvar_num(admin_xp)
                    }
                    
                    
PlayerXp[g_attacker] += counted_ultra
                    
                    set_hudmessage
(0255500.450.3312.02.0)
                    
ShowSyncHudMsg(g_attackerg_msgHudSync1"%L"LANG_SERVER"ULTRA_XP"counted_ultra)
                }
            }
        }
        
check_level(g_attacker)
    }
}
#endif

#if defined ZOMBIE_PLAGUE
public zp_user_infected_post(g_victimg_attacker)
{
    if( !
get_pcvar_num(p_Enabled) )
        return;
    
    new 
counted_triple get_pcvar_num(xp_kill) + get_pcvar_num(xp_triple)
    new 
counted_ultra get_pcvar_num(xp_kill) + get_pcvar_num(xp_ultra)
    
    if((
<= g_attacker <= g_maxplayers))
    {
        if(
g_victim != g_attacker)
        {
            
g_kills[g_attacker]++;
            if(
PlayerLevel[g_attacker] < MAXLEVEL-1
            {
                if ( 
get_pcvar_num(enable_triple) && g_kills[g_attacker] < get_pcvar_num(triple_kills) || g_kills[g_attacker] > get_pcvar_num(triple_kills)
                || 
get_pcvar_num(enable_ultra) && g_kills[g_attacker] < get_pcvar_num(ultra_kills) || g_kills[g_attacker] > get_pcvar_num(ultra_kills) )
                {    
                    if ( 
get_pcvar_num(enable_admin_xp) && get_user_flags(g_attacker) & ADMIN_EXTRA)
                    {
                        
PlayerXp[g_attacker] += get_pcvar_num(admin_xp)
                    }
                    
PlayerXp[g_attacker] += get_pcvar_num(xp_kill)
                
                    
set_hudmessage(0255500.500.3312.02.0)
                    
ShowSyncHudMsg(g_attackerg_msgHudSync1"+%i"get_pcvar_num(xp_kill))
                }
                else if ( !
get_pcvar_num(enable_triple) || !get_pcvar_num(enable_ultra) )
                {
                    if ( 
get_pcvar_num(enable_admin_xp) && get_user_flags(g_attacker) & ADMIN_EXTRA)
                    {
                        
PlayerXp[g_attacker] += get_pcvar_num(admin_xp)
                    }
                    
                    
PlayerXp[g_attacker] += get_pcvar_num(xp_kill)
                
                    
set_hudmessage(0255500.500.3312.02.0)
                    
ShowSyncHudMsg(g_attackerg_msgHudSync1"+%i"get_pcvar_num(xp_kill))
                }
                if ( 
g_kills[g_attacker] == get_pcvar_num(triple_kills) && get_pcvar_num(enable_triple) )
                {    
                    if ( 
get_pcvar_num(enable_admin_xp) && get_user_flags(g_attacker) & ADMIN_EXTRA)
                    {
                        
PlayerXp[g_attacker] += get_pcvar_num(admin_xp)
                    }
                    
                    
PlayerXp[g_attacker] += counted_triple
                    
                    set_hudmessage
(0255500.450.3312.02.0)
                    
ShowSyncHudMsg(g_attackerg_msgHudSync1"%L"LANG_SERVER"TRIPLE_XP"counted_triple)
                }
                else if ( 
g_kills[g_attacker] == get_pcvar_num(ultra_kills) && get_pcvar_num(enable_ultra) )
                {
                    if ( 
get_pcvar_num(enable_admin_xp) && get_user_flags(g_attacker) & ADMIN_EXTRA)
                    {
                        
PlayerXp[g_attacker] += get_pcvar_num(admin_xp)
                    }
                    
                    
PlayerXp[g_attacker] += counted_ultra
                    
                    set_hudmessage
(0255500.450.3312.02.0)
                    
ShowSyncHudMsg(g_attackerg_msgHudSync1"%L"LANG_SERVER"ULTRA_XP"counted_ultra)
                }
            }
        }
        
check_level(g_attacker)
    }
}
#endif

public event_deathmsg()
{    
    if( !
get_pcvar_num(p_Enabled) )
        return;
    
    new 
g_attacker read_data(1);
    new 
g_victim read_data(2);
    
    new 
counted_triple get_pcvar_num(xp_kill) + get_pcvar_num(xp_triple)
    new 
counted_ultra get_pcvar_num(xp_kill) + get_pcvar_num(xp_ultra)
    
    if((
<= g_attacker <= g_maxplayers))
    {
        if(
g_victim != g_attacker)
        {
            
g_kills[g_attacker]++;
            if(
PlayerLevel[g_attacker] < MAXLEVEL-1
            {
                if ( 
get_pcvar_num(enable_triple) && g_kills[g_attacker] < get_pcvar_num(triple_kills) || g_kills[g_attacker] > get_pcvar_num(triple_kills)
                || 
get_pcvar_num(enable_ultra) && g_kills[g_attacker] < get_pcvar_num(ultra_kills) || g_kills[g_attacker] > get_pcvar_num(ultra_kills) )
                {    
                    if ( 
get_pcvar_num(enable_admin_xp) && get_user_flags(g_attacker) & ADMIN_EXTRA)
                    {
                        
PlayerXp[g_attacker] += get_pcvar_num(admin_xp)
                    }
                    
PlayerXp[g_attacker] += get_pcvar_num(xp_kill)
                
                    
set_hudmessage(0255500.500.3312.02.0)
                    
ShowSyncHudMsg(g_attackerg_msgHudSync1"+%i"get_pcvar_num(xp_kill))
                }
                else if ( !
get_pcvar_num(enable_triple) || !get_pcvar_num(enable_ultra) )
                {
                    if ( 
get_pcvar_num(enable_admin_xp) && get_user_flags(g_attacker) & ADMIN_EXTRA)
                    {
                        
PlayerXp[g_attacker] += get_pcvar_num(admin_xp)
                    }
                    
                    
PlayerXp[g_attacker] += get_pcvar_num(xp_kill)
                
                    
set_hudmessage(0255500.500.3312.02.0)
                    
ShowSyncHudMsg(g_attackerg_msgHudSync1"+%i"get_pcvar_num(xp_kill))
                }
                if ( 
g_kills[g_attacker] == get_pcvar_num(triple_kills) && get_pcvar_num(enable_triple) )
                {    
                    if ( 
get_pcvar_num(enable_admin_xp) && get_user_flags(g_attacker) & ADMIN_EXTRA)
                    {
                        
PlayerXp[g_attacker] += get_pcvar_num(admin_xp)
                    }
                    
                    
PlayerXp[g_attacker] += counted_triple
                    
                    set_hudmessage
(0255500.450.3312.02.0)
                    
ShowSyncHudMsg(g_attackerg_msgHudSync1"%L"LANG_SERVER"TRIPLE_XP"counted_triple)
                }
                else if ( 
g_kills[g_attacker] == get_pcvar_num(ultra_kills) && get_pcvar_num(enable_ultra) )
                {
                    if ( 
get_pcvar_num(enable_admin_xp) && get_user_flags(g_attacker) & ADMIN_EXTRA)
                    {
                        
PlayerXp[g_attacker] += get_pcvar_num(admin_xp)
                    }
                    
                    
PlayerXp[g_attacker] += counted_ultra
                    
                    set_hudmessage
(0255500.450.3312.02.0)
                    
ShowSyncHudMsg(g_attackerg_msgHudSync1"%L"LANG_SERVER"ULTRA_XP"counted_ultra)
                }
            }
        }
        
check_level(g_attacker)
    }
}
public 
Event_StatusValue(id)
{
    new 
target read_data(2)
      if(
target != id && target != && get_pcvar_num(p_Enabled))
      {
        static 
sName[32];
        
get_user_name(targetsName31)

        
set_hudmessage(2552552550.6, -1.000.06.00.00.02)
        
ShowSyncHudMsg(idg_msgHudSync1"%L"LANG_SERVER"LEVEL_TEXT"sNamePlayerLevel[target], RANKLEVELS[PlayerLevel[target]])
    }
}
public 
task_show_level(task)
{
    new 
id task TASK_SHOW_LEVEL
    
    
if(!is_user_alive(id) && !get_pcvar_num(show_level_text) )
        return 
PLUGIN_HANDLED;
    
    
set_hudmessage(255000.020.3300.00.30.00.0)
    
ShowSyncHudMsg(idg_msgHudSync1 "%L"LANG_SERVER"LEVEL_HUD_TEXT"PlayerLevel[id], PlayerXp[id], LEVELS[PlayerLevel[id]], RANK[PlayerLevel[id]], RANKLEVELS[PlayerLevel[id]])
    
    
set_task(0.1"task_show_level"TASK_SHOW_LEVEL id)        
    
    return 
PLUGIN_CONTINUE;
}
public 
showlevel(id)
{
    if ( !
get_pcvar_num(p_Enabled) && get_pcvar_num(show_level_text) )
        return 
PLUGIN_HANDLED;
    
    
client_printcolor(id"%L"LANG_SERVER"LEVEL_TEXT2"PlayerLevel[id] , PlayerXp[id], LEVELS[PlayerLevel[id]]);
    
client_printcolor(id"%L"LANG_SERVER"LEVEL_TEXT3"RANK[PlayerLevel[id]], RANKLEVELS[PlayerLevel[id]]);
    
    return 
PLUGIN_HANDLED;
}
public 
descriptionx(id)
{
    new 
szMotd[2048], szTitle[64], iPos 0
    format
(szTitle63"Info")
    
iPos += format(szMotd[iPos], 2047-iPos"<html><head><style type=^"text/css^">pre{color:#FFB000;}body{background:#000000;margin-left:8px;margin-top:0px;}</style></head><pre><body>")
    
iPos += format(szMotd[iPos], 2047-iPos"^n^n<b>%s</b>^n^n"szTitle)
    
iPos += format(szMotd[iPos], 2047-iPos"%L^n"LANG_SERVER"DESCRIPTION")
    
    
iPos += format(szMotd[iPos], 2047-iPos"%L"LANG_SERVER"DESCRIPTION2")
        
    
show_motd(idszMotdszTitle)
    return 
PLUGIN_HANDLED;
}
public 
check_level(id)
{
    if(
PlayerLevel[id] < MAXLEVEL-&& get_pcvar_num(p_Enabled))
    {
        while(
PlayerXp[id] >= LEVELS[PlayerLevel[id]])
        {
            
PlayerLevel[id]++;
                
            if(
is_user_alive(id))
            {    
                if ( 
get_pcvar_num(level_style) )
                {
                    
give_weapon(id);
                }
                
                new 
p_origin[3];
                
get_user_origin(idp_origin0);
                
                
set_sprite(p_originlevelspr30)
                
set_sprite(p_originlevelspr230)
            }
            
emit_sound(idCHAN_ITEMLevelUp1.0ATTN_NORM0PITCH_NORM);
            
            static 
name[32] ; get_user_name(idnamecharsmax(name));
            
client_printcolor(0"%L"LANG_SERVER"LEVEL_UP"namePlayerLevel[id]);
        }
    } 
}
// Main Menu Info
public show_main_menu_info(id)
{
    static 
menu[510], len;
    
len 0;
    
    new 
xKeys3 MENU_KEY_0|MENU_KEY_1;

    
// Title
    
len += formatex(menu[len], sizeof menu len"%L"LANG_SERVER"TITLE_MENU_INFO")
    
    
len += formatex(menu[len], sizeof menu len"\r1. \w%L"id"INFO")
    if ( 
get_pcvar_num(show_rank) )
    {
        
xKeys3 |= (MENU_KEY_2)
        
        
len += formatex(menu[len], sizeof menu len"^n\r2. \wTop 20^n")
    }
    else
    {
        
len += formatex(menu[len], sizeof menu len"^n\d2. Top 20^n")
    }
    
    if(
find_plugin_byfile("gunxpmod_shop.amxx") != INVALID_PLUGIN_ID)
    {
        
xKeys3 |= (MENU_KEY_3)
        
        
len += formatex(menu[len], sizeof menu len"\r3. \w%L^n"id"ITEM_LIST")
        if ( 
is_user_alive(id) )
        {
            
xKeys3 |= (MENU_KEY_4)
            
            
len += formatex(menu[len], sizeof menu len"\r4. \w%L^n"id"UNLOCKS_SHOP_TEXT")
        }
    }
    
    
len += formatex(menu[len], sizeof menu len"^n^n\r0.\w %L"id"EXIT_MENU")

    
show_menu(idxKeys3menu, -1"Main Menu")

public 
main_menu_info(idkey)
{
    switch (
key)
    {
        case 
0:
        {
            
show_main_menu_info(id)
            
            
descriptionx(id)
        }
        case 
1:
        {
            
showtop20(id)
            
            
show_main_menu_info(id)
        }
        case 
2:
        {
            
show_main_menu_info(id)
            
            if(
callfunc_begin"display_items","gunxpmod_shop.amxx") == 1)
            {
                
callfunc_push_intid ); 
                
callfunc_end();
            }
        }
        case 
3:
        {
            if(
callfunc_begin("item_upgrades","gunxpmod_shop.amxx") == 1)
            {
                
callfunc_push_intid ); 
                
callfunc_end();
            }
        }
        case 
9:
        {
            return 
PLUGIN_HANDLED;
        }
    }

    return 
PLUGIN_HANDLED;
}
// Main Menu Level Style
public show_main_menu_level(id)
{
    if ( !
is_user_alive(id) )
        return;
    
    static 
menu[510], len;
    
len 0;
    
    new 
xKeys2 MENU_KEY_0|MENU_KEY_1|MENU_KEY_2;

    
// Title
    
len += formatex(menu[len], sizeof menu len"%L"LANG_SERVER"TITLE_MENU"PlayerLevel[id], PlayerXp[id], LEVELS[PlayerLevel[id]])
    
    
len += formatex(menu[len], sizeof menu len"%L"LANG_SERVER"CHOOSE_TEXT")

    
len += formatex(menu[len], sizeof menu len"%L"LANG_SERVER"LAST_GUNS")
    
len += formatex(menu[len], sizeof menu len"^n^n\r0.\w %L"id"EXIT_MENU")

    
show_menu(idxKeys2menu, -1"Main Level Menu")

public 
main_menu_level(idkey)
{
    if ( !
is_user_alive(id) )
        return 
PLUGIN_HANDLED;
    
    switch (
key)
    {
        case 
0// back
        
{
            
first_check_menu(id)
        }
        case 
1// next
        
{
            
give_weapon_menu(idg_remember_selection[id]);
        }
        case 
9// exit
        
{
            return 
PLUGIN_HANDLED;
        }
    }

    return 
PLUGIN_HANDLED;
}
// Menu Level Style
public first_check_menu(id)
{
    
MENU_STARTID 0
    show_menu_level
(id);
}
public 
show_menu_level(id)
{
    if ( !
is_user_alive(id) )
        return;
    
    static 
menu[510], len, class;
    
len 0;
    
    new 
xKeys MENU_KEY_0;
    new 
max min(MENU_STARTID+7sizeof (LEVELS));
    new 
iPosNum 0;
    
    
// Title
    
len += formatex(menu[len], sizeof menu len"%L"LANG_SERVER"TITLE_MENU"PlayerLevel[id], PlayerXp[id], LEVELS[PlayerLevel[id]])
    
    
// 1-7. Class List
    
for (class = MENU_STARTID; class < max; class++)
    {
        if ( 
PlayerLevel[id] < class)
        {    
            
len += formatex(menu[len], sizeof menu len"%L"LANG_SERVER"INACTIVE_MENU", ++iPosNumRANK[class], class)
        } 
        else
        {
            
xKeys |= (1<<iPosNum++);

            
len += formatex(menu[len], sizeof menu len"%L"LANG_SERVER"ACTIVE_MENU", class-MENU_STARTID+1RANK[class], class)
        }
    }
    if ( 
MENU_STARTID != && MENU_STARTID != 21 )
    {    
        
xKeys |= (1<<7)
        
xKeys |= (1<<8)
        
        
len += formatex(menu[len], sizeof menu len"^n\r8.\w %L^n\r9.\w %L^n^n\r0.\w %L"id"BACK_MENU"id"NEXT_MENU"id"EXIT_MENU")
    }
    else if ( 
MENU_STARTID == )
    {
        
xKeys |= (1<<8)
        
        
len += formatex(menu[len], sizeof menu len"^n\r9.\w %L^n^n\r0.\w %L"id"NEXT_MENU"id"EXIT_MENU")
    }

    else if ( 
MENU_STARTID == 21 )
    {    
        
xKeys |= (1<<7)
        
        
len += formatex(menu[len], sizeof menu len"^n\r8.\w %L^n^n\r0.\w %L"id"BACK_MENU"id"EXIT_MENU")
    }
    
    
show_menu(idxKeysmenu, -1"Level by Menu")

public 
menu_level(idkey)
{
    if ( !
is_user_alive(id) )
        return 
PLUGIN_HANDLED;
    
    if (
key >= || key->= PlayerLevel[id])
    {
        switch (
key)
        {
            case 
7// back
            
{
                if (
MENU_STARTID->= 0MENU_STARTID -= 7
            
}
            case 
8// next
            
{
                if (
MENU_STARTID+sizeof (LEVELS)) MENU_STARTID += 7
            
}
            case 
9// exit
            
{
                return 
PLUGIN_HANDLED;
            }
        }

        
show_menu_level(id)
        return 
PLUGIN_HANDLED;
    }
    new 
selected MENU_STARTID key;

    
g_remember_selection[id] = selected;
    
    
give_weapon_menu(idselected);
    
    return 
PLUGIN_HANDLED;
}
public 
give_weapon_menu(idselection)
{
    
#if defined ZOMBIE_SWARM
    
if(get_user_team(id) == && is_user_alive(id) && get_pcvar_num(p_Enabled)) 
    {
        
StripPlayerWeapons(id);
        
        if ( 
get_pcvar_num(enable_grenades) )
        {
            
give_item(id"weapon_smokegrenade");
            
give_item(id"weapon_hegrenade");
        }
        if (!
user_has_weapon(idAMMOCONST[selection]))
        {
            
give_item(idWEAPONCONST[selection]);
        }
        
cs_set_user_bpammo(idAMMOCONST[selection], AMMO2CONST[selection])
    }
    
#endif
    
    #if defined ZOMBIE_INFECTION || defined NORMAL_MOD
    
if(is_user_alive(id) && get_pcvar_num(p_Enabled)) 
    {
        
StripPlayerWeapons(id);
        
        if ( 
get_pcvar_num(enable_grenades) )
        {
            
give_item(id"weapon_smokegrenade");
            
give_item(id"weapon_hegrenade");
        }
        if (!
user_has_weapon(idAMMOCONST[selection]))
        {
            
give_item(idWEAPONCONST[selection]);
        }
        
cs_set_user_bpammo(idAMMOCONST[selection], AMMO2CONST[selection])
    }
    
#endif
}
public 
give_weapon(id)
{
    
#if defined ZOMBIE_SWARM
    
if(get_user_team(id) == && is_user_alive(id) && get_pcvar_num(p_Enabled)) 
    {
        
StripPlayerWeapons(id);
        
        if ( 
get_pcvar_num(enable_grenades) && get_pcvar_num(level_style) )
        {
            
give_item(id"weapon_smokegrenade");
            
give_item(id"weapon_hegrenade");
        }
        
        if (!
user_has_weapon(idAMMOCONST[PlayerLevel[id]]))
        {
            
give_item(idWEAPONCONST[PlayerLevel[id]]);
        }
        
cs_set_user_bpammo(idAMMOCONST[PlayerLevel[id]], AMMO2CONST[PlayerLevel[id]])
    }
    
#endif
    
    #if defined ZOMBIE_INFECTION || defined NORMAL_MOD
    
if(is_user_alive(id) && get_pcvar_num(p_Enabled)) 
    {
        
StripPlayerWeapons(id);
        
        if ( 
get_pcvar_num(enable_grenades) && get_pcvar_num(level_style) )
        {
            
give_item(id"weapon_smokegrenade");
            
give_item(id"weapon_hegrenade");
        }
        if (!
user_has_weapon(idAMMOCONST[PlayerLevel[id]]))
        {
            
give_item(idWEAPONCONST[PlayerLevel[id]]);
        }
        
cs_set_user_bpammo(idAMMOCONST[PlayerLevel[id]], AMMO2CONST[PlayerLevel[id]])
    }
    
#endif
}
public 
set_sprite(p_origin[3], spriteradius)
{
    
// Explosion
    
message_begin(MSG_BROADCASTSVC_TEMPENTITYp_origin)
    
write_byte(TE_EXPLOSION)
    
write_coord(p_origin[0])
    
write_coord(p_origin[1])
    
write_coord(p_origin[2])
    
write_short(sprite)
    
write_byte(radius)
    
write_byte(15)
    
write_byte(4)
    
message_end()
}
//Shows Top 20
public showtop20(id)
{
    if( !
get_pcvar_num(p_Enabled) && !get_pcvar_num(show_rank) )
        return;
    
    static 
Sort[33][2];
    new 
players[32],num,count,index;
    
get_players(players,num);
    
    for(new 
0numi++)
    {
        
index players[i];
        
Sort[count][0] = index;
        
Sort[count][1] = PlayerXp[index];
        
count++;
    }
    
    
SortCustom2D(Sort,count,"CompareXp");
    new 
motd[1501],iLen;
    
iLen formatex(motdsizeof motd 1,"<body bgcolor=#000000><font color=#98f5ff><pre>");
    
iLen += formatex(motd[iLen], (sizeof motd 1) - iLen,"%s %-22.22s %3s^n""#""Name""# Experience");
    
    new 
clamp(count,0,20);
    new 
name[32],kindex;
    
    for(new 
0yx++)
    {
        
kindex Sort[x][0];
        
get_user_name(kindex,name,sizeof name 1);
        
iLen += formatex(motd[iLen], (sizeof motd 1) - iLen,"%d %-22.22s %d^n"1nameSort[x][1]);
    }
    
iLen += formatex(motd[iLen], (sizeof motd 1) - iLen,"</body></font></pre>");
    
show_motd(id,motd"GunXpMod Top 20");
}
public 
CompareXp(elem1[], elem2[])
{
    if(
elem1[1] > elem2[1])
        return -
1;
    else if(
elem1[1] < elem2[1])
        return 
1;
    
    return 
0;

// Command to set player Level
public cmd_give_level(idlevelcid
{
    if(!
cmd_access(idlevelcid3) || !get_pcvar_num(p_Enabled))
    {
        return 
PLUGIN_HANDLED;
    }
    
    new 
Arg1[64], Target
    read_argv
(1Arg163)
    
Target cmd_target(idArg10)
    
    new 
iLevel[32], Value
    read_argv
(2iLevel31)
    
Value str_to_num(iLevel)
    
    if(
iLevel[0] == '-'
    {
        
console_print(id"You can't have a '-' in the value!")
        return 
PLUGIN_HANDLED;
    }
    
    if(!
Target
    {
        
console_print(id"Target not found!")
        return 
PLUGIN_HANDLED;
    }
    
    if(
Value MAXLEVEL-1)
    {
        
console_print(id"You can't set a more than %d!"MAXLEVEL-1)
        return 
PLUGIN_HANDLED;
    }
    
    if(
Value 1)
    {
        
console_print(id"You can't set less than 1!")
        return 
PLUGIN_HANDLED;
    }
    
    new 
AdminName[32]
    
get_user_name(idAdminName31)
        
    new 
TargetName[32]
    
get_user_name(TargetTargetName31)
    
    
PlayerLevel[Target] = Value 1
    PlayerXp
[Target] = LEVELS[PlayerLevel[Target]]
    
check_level(Target)
    
    
client_printcolor(Target"/gADMIN /ctr%s /yEstablecio tu Nivel a /g%d"AdminNameValue)

    return 
PLUGIN_HANDLED;
}
// Save Player Info
SaveLevel(id)

    if ( 
get_pcvar_num(savexp) )
    {
        new 
authid[32]
        
get_user_authid(idauthid31)
        new 
szData[256];
        new 
szKey[64];
        
        
formatexszKey 63 "%s-ID" authid);
        
formatexszData 255 "%i#%i#" PlayerLevel[id], PlayerXp[id] );
    
        
nvault_setg_Vault szKey szData );
    }
    else
    {
        new 
authip[32]
        
get_user_ip(id,authip,31,1)
        new 
szData[256];
        new 
szKey[64];
        
        
formatexszKey 63 "%s-IP" authip );
        
formatexszData 255 "%i#%i#" PlayerLevel[id], PlayerXp[id] );
    
        
nvault_setg_Vault szKey szData );
    }
}
// Load Player Info
LoadLevel(id)
{
    if ( 
get_pcvar_num(savexp) )
    {
        new 
authid[32]
        
get_user_authid(idauthid31)
        new 
szData[256];
        new 
szKey[40];

        
formatexszKey 39 "%s-ID" authid );

        
formatex(szData 255"%i#%i#"PlayerLevel[id], PlayerXp[id]) 
        
        
nvault_get(g_VaultszKeyszData255

        
replace_all(szData 255"#"" ")
        new 
xp[32], level[32
        
parse(szDatalevel31xp31
        
PlayerLevel[id] = str_to_num(level)
        
PlayerXp[id] = str_to_num(xp)  
    }
    else
    {
        new 
authip[32]
        
get_user_ip(idauthip311)
        new 
szData[256];
        new 
szKey[40];

        
formatexszKey 39 "%s-IP" authip );

        
formatex(szData 255"%i#%i#"PlayerLevel[id], PlayerXp[id]) 
        
        
nvault_get(g_VaultszKeyszData255

        
replace_all(szData 255"#"" ")
        new 
xp[32], level[32
        
parse(szDatalevel31xp31
        
PlayerLevel[id] = str_to_num(level)
        
PlayerXp[id] = str_to_num(xp
    }
}
// ============================================================//
//                          [~ Natives ~]                          //
// ============================================================//
// Native: get_user_xp
public native_get_user_xp(id)
{
    return 
PlayerXp[id];
}
// Native: set_user_xp
public native_set_user_xp(idamount)
{
    
PlayerXp[id] = amount;
}
// Native: get_user_level
public native_get_user_level(id)
{
    return 
PlayerLevel[id];
}
// Native: set_user_xp
public native_set_user_level(idamount)
{
    
PlayerLevel[id] = amount;
}
// Native: Gets user level by Xp
public native_get_user_max_level(id)
{
    return 
LEVELS[PlayerLevel[id]];
}
// ============================================================//
//                          [~ Stocks ~]                          //
// ============================================================//
stock client_printcolor(const id, const input[], any:...)
{
    new 
count 1players[32];
    static 
msg[191];
    
vformat(msg,190,input,3);
    
replace_all(msg,190,"/g","^4");// green txt
    
replace_all(msg,190,"/y","^1");// orange txt
    
replace_all(msg,190,"/ctr","^3");// team txt
    
replace_all(msg,190,"/w","^0");// team txt
    
if (idplayers[0] = id; else get_players(players,count,"ch");
    for (new 
0counti++)
        if (
is_user_connected(players[i]))
        {
            
message_begin(MSG_ONE_UNRELIABLESayTxT_players[i]);
            
write_byte(players[i]);
            
write_string(msg);
            
message_end();
        }
}    
public 
StripPlayerWeapons(id

    
strip_user_weapons(id
    
set_pdata_int(idOFFSET_PRIMARYWEAPON0
    
give_item(id"weapon_knife");


Ese ya lo probe hace tiempo y tiene muchos errores al compilar, estoy usando otro que esta fix y es mejor, ademas si pruebo ese tendria el mismo error se seguiria bugeando con el plugin supply box.
DancingLmlDancing
Responder
#12
podrias usar native para llamar el check_level
Responder
#13
(14/04/2019, 05:26 PM)+rdNN! escribió: podrias usar native para llamar el check_level


Si ya lo pude solucionar yo, muchas gracias a todos por tratar de ayudarme se agradece mucho!!! RainbowExcitedeyes
DancingLmlDancing
Responder
#14
(14/04/2019, 05:32 PM)Boddah. escribió:
(14/04/2019, 05:26 PM)+rdNN! escribió: podrias usar native para llamar el check_level


Si ya lo pude solucionar yo, muchas gracias a todos por tratar de ayudarme se agradece mucho!!! RainbowExcitedeyes

Deja tú solución y añade al título [Solucionado].
Responder
#15
(14/04/2019, 05:49 PM)Chema escribió:
(14/04/2019, 05:32 PM)Boddah. escribió:
(14/04/2019, 05:26 PM)+rdNN! escribió: podrias usar native para llamar el check_level


Si ya lo pude solucionar yo, muchas gracias a todos por tratar de ayudarme se agradece mucho!!! RainbowExcitedeyes

Deja tú solución y añade al título [Solucionado].

Aqui dejo la solucion para todos los usuarios.


Archivos adjuntos
.sma   Descargar AMXX / supply_box_xp.sma (Tamaño: 511 bytes / Descargas: 12)
.sma   Descargar AMXX / gunxpmod.sma (Tamaño: 37.01 KB / Descargas: 44)
DancingLmlDancing
Responder


Salto de foro:


Usuarios navegando en este tema: 1 invitado(s)