Mensajes: 174
Temas: 60
Registro en: Oct 2018
Reputación:
1
Mensajes: 657
Temas: 14
Registro en: Oct 2013
Reputación:
3
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.
Mensajes: 174
Temas: 60
Registro en: Oct 2018
Reputación:
1
11/04/2019, 10:48 PM
(Última modificación: 11/04/2019, 11:47 PM por Boddah. . Edited 1 time in total.)
(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.
Mensajes: 657
Temas: 14
Registro en: Oct 2013
Reputación:
3
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
https://amxmodx-es.com/Thread-ZP-TUT-Cre...-Da%C3%B1o
Mensajes: 174
Temas: 60
Registro en: Oct 2018
Reputación:
1
12/04/2019, 09:48 PM
(Última modificación: 12/04/2019, 09:48 PM por Boddah. . Edited 1 time in total.)
(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
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.
Mensajes: 173
Temas: 49
Registro en: Aug 2017
Reputación:
0
(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
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 gLevel [ 33 ], gXp [ 33 ]; 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 ( 1 ); new iVictim = read_data ( 2 ); if( iAttacker == iVictim || ! is_user_connected ( iAttacker ) || ! is_user_connected ( iVictim ) ) return; gXp [ iAttacker ] += get_pcvar_num ( cvarXPAGanar ); UpdateLevel ( iAttacker ); } public UpdateLevel ( id ) { new iSubido = false ; while( gXp [ id ] >= NextLevel ( gLevel [ id ] ) && gLevel [ id ] < LevelMax ) { ++ gLevel [ id ]; iSubido = true ; } if( iSubido ) { client_print ( id , print_chat , "Subiste al nivel %d" , gLevel [ id ] ); iSubido = false ; } }
Y esta mini guia de Skylar, sabes google no muerde
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...
Mensajes: 174
Temas: 60
Registro en: Oct 2018
Reputación:
1
12/04/2019, 10:27 PM
(Última modificación: 12/04/2019, 10:35 PM por Boddah. . Edited 3 times in total.)
(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
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 gLevel [ 33 ], gXp [ 33 ]; 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 ( 1 ); new iVictim = read_data ( 2 ); if( iAttacker == iVictim || ! is_user_connected ( iAttacker ) || ! is_user_connected ( iVictim ) ) return; gXp [ iAttacker ] += get_pcvar_num ( cvarXPAGanar ); UpdateLevel ( iAttacker ); } public UpdateLevel ( id ) { new iSubido = false ; while( gXp [ id ] >= NextLevel ( gLevel [ id ] ) && gLevel [ id ] < LevelMax ) { ++ gLevel [ id ]; iSubido = true ; } if( iSubido ) { client_print ( id , print_chat , "Subiste al nivel %d" , gLevel [ id ] ); iSubido = false ; } }
Y esta mini guia de Skylar, sabes google no muerde
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
Mensajes: 173
Temas: 49
Registro en: Aug 2017
Reputación:
0
(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...
Mensajes: 174
Temas: 60
Registro en: Oct 2018
Reputación:
1
12/04/2019, 10:57 PM
(Última modificación: 12/04/2019, 10:58 PM por Boddah. . Edited 1 time in total.)
(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 cajaCó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 [ 3 ] = { - 8.01 , - 8.09 , 0.0 } new Float : maxModel [ 3 ] = { 8.12 , 8.09 , 22.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_pickup [ 33 ]; new pickupCount [ 33 ]; // 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 [ 3 ], Float : box_angles [ 3 ] } new Array: SupplyBoxesContents ; // <- Content holder // enum _ : SupplyContentsArray { box_id , box_name [ 35 ], pickupForwardItem } // Server specifics // new cvar_pickupTimes , cvar_timesPerRound , cvar_amountSpawn , cvar_team , cvar_spawnEvery ; new maxPlayers , mapName [ 32 ], configurationFile [ 258 ], lines ; new forwardResult , spawnCount ; public plugin_precache ( ) { precache_model ( SupplyBoxModel ); precache_sound ( PickupSound ); precache_sound ( SUPPLY_BOX_SOUND ); SupplyBoxes = ArrayCreate ( SupplyBoxesArray ); SupplyBoxesContents = ArrayCreate ( SupplyContentsArray ); EmptyCfgLines = ArrayCreate ( 1 , 1 ); } public plugin_init ( ) { register_plugin ( PLUGIN , VERSION , AUTHOR ); 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_touch ( entSupply , "player" , "supply_box_pickup" ); register_logevent ( "RoundEnd" , 2 , "1=Round_End" ); register_logevent ( "RoundStart" , 2 , "1=Round_Start" ); RegisterHam ( Ham_Spawn , "player" , "playerSpawn" , 1 ); register_clcmd ( "supplybox" , "supplyAdminMenu" ); maxPlayers = get_maxplayers ( ); } public plugin_cfg ( ) { get_mapname ( mapName , charsmax ( mapName ) ); add ( mapName , charsmax ( mapName ), ".cfg" , 0 ); get_configsdir ( configurationFile , charsmax ( configurationFile ) ); add ( configurationFile , charsmax ( configurationFile ), "/SupplyBoxes/" , 0 ); if( ! dir_exists ( configurationFile ) ) mkdir ( configurationFile ); add ( configurationFile , charsmax ( configurationFile ), mapName , 0 ); if( ! file_exists ( configurationFile ) ) { new m_map_cfg = fopen ( configurationFile , "wt" ); fclose ( m_map_cfg ); } fillSupplyArray ( ); } public plugin_natives ( ) { register_native ( "register_box_content" , "native_register_content" ); } public client_disconnect ( id ) { can_pickup [ id ] = false ; pickupCount [ id ] = 0 ; } public client_putinserver ( id ) { can_pickup [ id ] = false ; pickupCount [ id ] = 0 ; } public RoundStart ( ) { if( get_pcvar_float ( cvar_spawnEvery ) < 30.0 ) set_task ( 30.0 , "spawnSupplyBoxes" , TASK_ID_SPAWN_BOXES , _ , _ , "b" ); else set_task ( get_pcvar_float ( cvar_spawnEvery ), "spawnSupplyBoxes" , TASK_ID_SPAWN_BOXES , _ , _ , "b" ); } public RoundEnd ( ) { remove_task ( TASK_ID_SPAWN_BOXES ); for( new index = 1 ; index < maxPlayers ; index ++ ) pickupCount [ index ] = 0 ; spawnCount = 0 ; remove_supply_boxes ( ); } public playerSpawn ( id ) { if( ! is_user_alive ( id ) || get_user_team ( id ) != get_pcvar_num ( cvar_team ) ) can_pickup [ id ] = false ; else can_pickup [ id ] = true ; } public fillSupplyArray ( ) { new data [ 258 ]; new Float : Origin [ 3 ], Float : Angles [ 3 ]; new const text_parser [ 6 ][ 8 ]; new file = fopen ( configurationFile , "r" ); while( fgets ( file , data , charsmax ( data ) - 1 ) ) { lines ++; if( data [ 0 ] == ' ' ) { ArrayPushCell ( EmptyCfgLines , lines ); continue; } parse ( data , text_parser [ 0 ], 7 , text_parser [ 1 ], 7 , text_parser [ 2 ], 7 , text_parser [ 3 ], 7 , text_parser [ 4 ], 7 , text_parser [ 5 ], 7 ); Origin [ 0 ] = str_to_float ( text_parser [ 0 ] ); Origin [ 1 ] = str_to_float ( text_parser [ 1 ] ); Origin [ 2 ] = str_to_float ( text_parser [ 2 ] ); Angles [ 0 ] = str_to_float ( text_parser [ 3 ] ); Angles [ 1 ] = str_to_float ( text_parser [ 4 ] ); Angles [ 2 ] = str_to_float ( text_parser [ 5 ] ); AddSupplyToArray ( Origin , Angles , lines ); } fclose ( file ); } public supplyAdminMenu ( id ) { if( !( get_user_flags ( id ) & ADMIN_IMMUNITY ) || ! is_user_alive ( id ) ) return PLUGIN_HANDLED ; new menu = menu_create ( "\r[Umbrella Hell] \yMenu SupplyBox" , "supply_menu_handler" ); menu_additem ( menu , "Poner una SupplyBox" , "1" ); menu_additem ( menu , "Borrar una SupplyBox" , "2" ); menu_setprop ( menu , MPROP_EXIT , MEXIT_ALL ); menu_display ( id , menu , 0 ); return PLUGIN_HANDLED ; } public supply_menu_handler ( id , menu , item ) { if( ! is_user_alive ( id ) ) return PLUGIN_HANDLED ; if( item == MENU_EXIT ) { menu_destroy ( menu ); return PLUGIN_HANDLED ; } new data [ 6 ], name [ 64 ], access , callback , key ; menu_item_getinfo ( menu , item , access , data , 5 , name , charsmax ( name ), callback ); key = str_to_num ( data ); switch( key ) { case 1 : { new TargetOrigin [ 3 ], Float : Target [ 3 ], Float : Angles [ 3 ]; get_user_origin ( id , TargetOrigin , 3 ); Target [ 0 ] = float ( TargetOrigin [ 0 ] ); Target [ 1 ] = float ( TargetOrigin [ 1 ] ); Target [ 2 ] = float ( TargetOrigin [ 2 ] ); entity_get_vector ( id , EV_VEC_v_angle , Angles ); Angles [ 0 ] = 0.0 ; CreateSupplyBox ( Target , Angles ); } case 2 : { new entity , body ; get_user_aiming ( id , entity , body , 500 ); deleteSupplyBox ( entity ); } } supplyAdminMenu ( id ); return PLUGIN_HANDLED ; } public CreateSupplyBox ( Float : Origins [ 3 ], Float : Angles [ 3 ] ) { new szData [ 248 ], line_to_item ; format ( szData , charsmax ( szData ), "%f %f %f %f %f %f" , Origins [ 0 ], Origins [ 1 ], Origins [ 2 ], Angles [ 0 ], Angles [ 1 ], Angles [ 2 ] ); if( ArraySize ( EmptyCfgLines ) > 0 ) { new emptyLineId = ArrayGetCell ( EmptyCfgLines , 0 ); ArrayDeleteItem ( EmptyCfgLines , 0 ); write_file ( configurationFile , szData , emptyLineId - 1 ); line_to_item = emptyLineId ; } else { lines ++; write_file ( configurationFile , szData ); line_to_item = lines ; } AddSupplyToArray ( Origins , Angles , line_to_item ); spawnSupplyBox ( Origins , Angles , line_to_item ); } public AddSupplyToArray ( Float : Origin [ 3 ], Float : Angles [ 3 ], id ) { new Data [ SupplyBoxesArray ]; Data [ line_id ] = id ; Data [ box_origin ] = _ : Origin ; Data [ box_angles ] = _ : Angles ; ArrayPushArray ( SupplyBoxes , Data ); } public deleteSupplyBox ( ent ) { if( pev_valid ( ent ) ) { new class_name_ent [ 64 ]; entity_get_string ( ent , EV_SZ_classname , class_name_ent , charsmax ( class_name_ent ) ); if( equal ( class_name_ent , entSupply ) ) { new size = ArraySize ( SupplyBoxes ); new item_id = pev ( ent , pev_iuser1 ); for( new i = 0 ; i < size ; i ++ ) { new DataArray [ SupplyBoxesArray ]; ArrayGetArray ( SupplyBoxes , i , DataArray ); if( DataArray [ line_id ] == item_id ) { lines --; remove_entity ( ent ); ArrayPushCell ( EmptyCfgLines , item_id ); write_file ( configurationFile , " " , item_id - 1 ); ArrayDeleteItem ( SupplyBoxes , i ); break; } } } } } public spawnSupplyBoxes ( ) { if( ArraySize ( SupplyBoxes ) < 1 || ArraySize ( SupplyBoxesContents ) < 1 || spawnCount >= get_pcvar_num ( cvar_timesPerRound ) ) { remove_task ( TASK_ID_SPAWN_BOXES ); return; } remove_supply_boxes ( ); spawnCount ++; new Float : Orig [ 3 ], Float : Angl [ 3 ]; new AmountCvar = get_pcvar_num ( cvar_amountSpawn ); new ArraySizeBox = ArraySize ( SupplyBoxes ); new size = ( AmountCvar == 0 || AmountCvar > ArraySizeBox ) ? ArraySizeBox : AmountCvar ; new Data [ SupplyBoxesArray ]; new count , randomId ; new Array: Boxes = ArrayCreate ( SupplyBoxesArray ); for( new index = 0 ; index < ArraySizeBox ; index ++ ) { ArrayGetArray ( SupplyBoxes , index , Data ); ArrayPushArray ( Boxes , Data ); } do { randomId = random ( ArraySizeBox ); ArrayGetArray ( Boxes , randomId , Data ); Orig [ 0 ] = Data [ box_origin ][ 0 ]; Angl [ 0 ] = Data [ box_angles ][ 0 ]; Orig [ 1 ] = Data [ box_origin ][ 1 ]; Angl [ 1 ] = Data [ box_angles ][ 1 ]; Orig [ 2 ] = Data [ box_origin ][ 2 ]; Angl [ 2 ] = Data [ box_angles ][ 2 ]; spawnSupplyBox ( Orig , Angl , Data [ line_id ] ); count ++; ArrayDeleteItem ( Boxes , randomId ); ArraySizeBox --; } while( count < size ); client_cmd ( 0 , "spk %s" , SUPPLY_BOX_SOUND ); client_print ( 0 , print_center , ".... Presents arrived ..." ) } public remove_supply_boxes ( ) { new ent = - 1 ; while( ( ent = engfunc ( EngFunc_FindEntityByString , ent , "classname" , entSupply ) ) ) remove_entity ( ent ); } public spawnSupplyBox ( Float : pOrigins [ 3 ], Float : pAngles [ 3 ], line_idas ) { new entity = create_entity ( "info_target" ); entity_set_string ( entity , EV_SZ_classname , entSupply ); entity_set_int ( entity , EV_INT_solid , SOLID_BBOX ); entity_set_origin ( entity , pOrigins ); entity_set_vector ( entity , EV_VEC_angles , pAngles ); entity_set_model ( entity , SupplyBoxModel ); entity_set_size ( entity , minModel , maxModel ); entity_set_int ( entity , EV_INT_renderfx , kRenderFxGlowShell ); entity_set_vector ( entity , EV_VEC_rendercolor , Float :{ 221.0 , 173.0 , 237.0 } ); set_pev ( entity , pev_iuser1 , line_idas ); } public supply_box_pickup ( box , player ) { if( ! is_user_alive ( player ) || ! can_pickup [ player ] ) return; new randomDrop = random ( ArraySize ( SupplyBoxesContents ) ); new Data [ SupplyContentsArray ]; ArrayGetArray ( SupplyBoxesContents , randomDrop , Data ); ExecuteForward ( Data [ pickupForwardItem ], forwardResult , player ); if( get_pcvar_num ( cvar_pickupTimes ) > 0 ) { pickupCount [ player ]++; if( pickupCount [ player ] >= get_pcvar_num ( cvar_pickupTimes ) ) can_pickup [ player ] = false ; } chatcolor ( player , "!g[Umbrella Hell] !yHas encontrado una ^3SupplyBox !ycon !g%s!" , Data [ box_name ] ); client_cmd ( player , "spk %s" , PickupSound ); remove_entity ( box ); } public native_register_content ( plugin_id , paramaters_num ) { new BoxName [ 32 ]; get_string ( 1 , BoxName , charsmax ( BoxName ) ); new Data [ SupplyContentsArray ]; Data [ box_id ] = ArraySize ( SupplyBoxesContents ); Data [ box_name ] = BoxName ; Data [ pickupForwardItem ] = CreateOneForward ( plugin_id , "sb_pickup_event" , FP_CELL ); ArrayPushArray ( SupplyBoxesContents , Data ); // Debuging // // log_amx( "Registered box content name: %s and id: %d", BoxName, Data[ box_id ] ); // Return id to original plugin // return Data [ box_id ]; } stock chatcolor ( id , const input [], any :...) { static szMsg [ 191 ], msgSayText ; if (! msgSayText ) msgSayText = get_user_msgid ( "SayText" ); vformat ( szMsg , 190 , input , 3 ); replace_all ( szMsg , 190 , "!g" , "^4" ); replace_all ( szMsg , 190 , "!y" , "^1" ); replace_all ( szMsg , 190 , "!team" , "^3" ); message_begin ( id ? MSG_ONE_UNRELIABLE : MSG_BROADCAST , msgSayText , . player = id ); write_byte ( id ? id : 33 ); write_string ( szMsg ); message_end (); } El problema que tiene esque te da la xp y todo , pero 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 xp , como 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)
Mensajes: 173
Temas: 49
Registro en: Aug 2017
Reputación:
0
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_maxplayers , g_msgHudSync1 , SayTxT , enable_grenades ; new levelspr , levelspr2 , show_level_text , show_rank ; new savexp , xp_kill , xp_triple , enable_triple , triple_kills , xp_ultra , ultra_kills , enable_ultra , p_Enabled , level_style ; new enable_admin_xp , admin_xp ; // Entity specifics // new entSupply [ ] = "supply_box_entity" ; new Float : minModel [ 3 ] = { - 8.01 , - 8.09 , 0.0 } new Float : maxModel [ 3 ] = { 8.12 , 8.09 , 22.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_pickup [ 33 ]; new pickupCount [ 33 ]; // 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 [ 3 ], Float : box_angles [ 3 ] } new Array: SupplyBoxesContents ; // <- Content holder // enum _ : SupplyContentsArray { box_id , box_name [ 35 ], pickupForwardItem } // Server specifics // new cvar_pickupTimes , cvar_timesPerRound , cvar_amountSpawn , cvar_team , cvar_spawnEvery ; new maxPlayers , mapName [ 32 ], configurationFile [ 258 ], lines ; new forwardResult , spawnCount ; new const LevelUp [] = "umbrella/levelup.wav" ; //mac10// new const LEVELS [ MAXLEVEL ] = { 90 , 180 , 300 , 450 , 700 , 1200 , 1800 , 2800 , 4100 , 5200 , 6000 , 6800 , 8200 , 10200 , 12000 , 15000 , 17500 , 20500 , 25500 , //<-aug// 29000 , 35000 , 46000 , 58000 , 150000 }; // 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 ] = { 17 , 16 , 1 , 11 , 26 , 10 , 23 , 7 , 12 , 19 , 30 , 3 , 18 , 15 , 14 , 21 , 5 , 28 , 22 , 8 , 27 , 13 , 24 , 20 }; // Weapons ID(CSW) new const AMMO2CONST [ MAXLEVEL ] = { 400 , 400 , 400 , 400 , 400 , 400 , 400 , 400 , 400 , 400 , 400 , 400 , 90 , 400 , 400 , 80 , 80 , 400 , 400 , 400 , 400 , 200 , 200 , 400 }; // Weapons Ammo /*================================================================================ [Plugin natives,precache,init] =================================================================================*/ public plugin_init () { register_plugin ( PLUGIN , VERSION , AUTHOR ); register_cvar ( "gxm_version" , VERSION , FCVAR_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_touch ( entSupply , "player" , "supply_box_pickup" ); register_logevent ( "RoundEnd" , 2 , "1=Round_End" ); register_logevent ( "RoundStart" , 2 , "1=Round_Start" ); RegisterHam ( Ham_Spawn , "player" , "playerSpawn" , 1 ); 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_model ( SupplyBoxModel ); precache_sound ( PickupSound ); precache_sound ( SUPPLY_BOX_SOUND ); SupplyBoxes = ArrayCreate ( SupplyBoxesArray ); SupplyBoxesContents = ArrayCreate ( SupplyContentsArray ); EmptyCfgLines = ArrayCreate ( 1 , 1 ); engfunc ( EngFunc_PrecacheSound , LevelUp ); } 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_mapname ( mapName , charsmax ( mapName ) ); add ( mapName , charsmax ( mapName ), ".cfg" , 0 ); get_configsdir ( configurationFile , charsmax ( configurationFile ) ); add ( configurationFile , charsmax ( configurationFile ), "/SupplyBoxes/" , 0 ); if( ! dir_exists ( configurationFile ) ) mkdir ( configurationFile ); add ( configurationFile , charsmax ( configurationFile ), mapName , 0 ); if( ! file_exists ( configurationFile ) ) { new m_map_cfg = fopen ( configurationFile , "wt" ); fclose ( m_map_cfg ); } fillSupplyArray ( ); } public plugin_end () { //Close the vault when the plugin ends (map change\server shutdown\restart) nvault_close ( g_Vault ); } public client_authorized ( id ) { g_remember_selection [ id ] = 0 ; LoadLevel ( id ) } public client_disconnect ( id ) { SaveLevel ( id ) can_pickup [ id ] = false ; pickupCount [ id ] = 0 ; } public client_putinserver ( id ) { can_pickup [ id ] = false ; pickupCount [ id ] = 0 ; } public RoundStart ( ) { if( get_pcvar_float ( cvar_spawnEvery ) < 30.0 ) set_task ( 30.0 , "spawnSupplyBoxes" , TASK_ID_SPAWN_BOXES , _ , _ , "b" ); else set_task ( get_pcvar_float ( cvar_spawnEvery ), "spawnSupplyBoxes" , TASK_ID_SPAWN_BOXES , _ , _ , "b" ); } public RoundEnd ( ) { remove_task ( TASK_ID_SPAWN_BOXES ); for( new index = 1 ; index < maxPlayers ; index ++ ) pickupCount [ index ] = 0 ; spawnCount = 0 ; remove_supply_boxes ( ); } public playerSpawn ( id ) { if( ! is_user_alive ( id ) || get_user_team ( id ) != get_pcvar_num ( cvar_team ) ) can_pickup [ id ] = false ; else can_pickup [ id ] = true ; } public fillSupplyArray ( ) { new data [ 258 ]; new Float : Origin [ 3 ], Float : Angles [ 3 ]; new const text_parser [ 6 ][ 8 ]; new file = fopen ( configurationFile , "r" ); while( fgets ( file , data , charsmax ( data ) - 1 ) ) { lines ++; if( data [ 0 ] == ' ' ) { ArrayPushCell ( EmptyCfgLines , lines ); continue; } parse ( data , text_parser [ 0 ], 7 , text_parser [ 1 ], 7 , text_parser [ 2 ], 7 , text_parser [ 3 ], 7 , text_parser [ 4 ], 7 , text_parser [ 5 ], 7 ); Origin [ 0 ] = str_to_float ( text_parser [ 0 ] ); Origin [ 1 ] = str_to_float ( text_parser [ 1 ] ); Origin [ 2 ] = str_to_float ( text_parser [ 2 ] ); Angles [ 0 ] = str_to_float ( text_parser [ 3 ] ); Angles [ 1 ] = str_to_float ( text_parser [ 4 ] ); Angles [ 2 ] = str_to_float ( text_parser [ 5 ] ); AddSupplyToArray ( Origin , Angles , lines ); } fclose ( file ); } public supplyAdminMenu ( id ) { if( !( get_user_flags ( id ) & ADMIN_IMMUNITY ) || ! is_user_alive ( id ) ) return PLUGIN_HANDLED ; new menu = menu_create ( "\r[Umbrella Hell] \yMenu SupplyBox" , "supply_menu_handler" ); menu_additem ( menu , "Poner una SupplyBox" , "1" ); menu_additem ( menu , "Borrar una SupplyBox" , "2" ); menu_setprop ( menu , MPROP_EXIT , MEXIT_ALL ); menu_display ( id , menu , 0 ); return PLUGIN_HANDLED ; } public supply_menu_handler ( id , menu , item ) { if( ! is_user_alive ( id ) ) return PLUGIN_HANDLED ; if( item == MENU_EXIT ) { menu_destroy ( menu ); return PLUGIN_HANDLED ; } new data [ 6 ], name [ 64 ], access , callback , key ; menu_item_getinfo ( menu , item , access , data , 5 , name , charsmax ( name ), callback ); key = str_to_num ( data ); switch( key ) { case 1 : { new TargetOrigin [ 3 ], Float : Target [ 3 ], Float : Angles [ 3 ]; get_user_origin ( id , TargetOrigin , 3 ); Target [ 0 ] = float ( TargetOrigin [ 0 ] ); Target [ 1 ] = float ( TargetOrigin [ 1 ] ); Target [ 2 ] = float ( TargetOrigin [ 2 ] ); entity_get_vector ( id , EV_VEC_v_angle , Angles ); Angles [ 0 ] = 0.0 ; CreateSupplyBox ( Target , Angles ); } case 2 : { new entity , body ; get_user_aiming ( id , entity , body , 500 ); deleteSupplyBox ( entity ); } } supplyAdminMenu ( id ); return PLUGIN_HANDLED ; } public CreateSupplyBox ( Float : Origins [ 3 ], Float : Angles [ 3 ] ) { new szData [ 248 ], line_to_item ; format ( szData , charsmax ( szData ), "%f %f %f %f %f %f" , Origins [ 0 ], Origins [ 1 ], Origins [ 2 ], Angles [ 0 ], Angles [ 1 ], Angles [ 2 ] ); if( ArraySize ( EmptyCfgLines ) > 0 ) { new emptyLineId = ArrayGetCell ( EmptyCfgLines , 0 ); ArrayDeleteItem ( EmptyCfgLines , 0 ); write_file ( configurationFile , szData , emptyLineId - 1 ); line_to_item = emptyLineId ; } else { lines ++; write_file ( configurationFile , szData ); line_to_item = lines ; } AddSupplyToArray ( Origins , Angles , line_to_item ); spawnSupplyBox ( Origins , Angles , line_to_item ); } public AddSupplyToArray ( Float : Origin [ 3 ], Float : Angles [ 3 ], id ) { new Data [ SupplyBoxesArray ]; Data [ line_id ] = id ; Data [ box_origin ] = _ : Origin ; Data [ box_angles ] = _ : Angles ; ArrayPushArray ( SupplyBoxes , Data ); } public deleteSupplyBox ( ent ) { if( pev_valid ( ent ) ) { new class_name_ent [ 64 ]; entity_get_string ( ent , EV_SZ_classname , class_name_ent , charsmax ( class_name_ent ) ); if( equal ( class_name_ent , entSupply ) ) { new size = ArraySize ( SupplyBoxes ); new item_id = pev ( ent , pev_iuser1 ); for( new i = 0 ; i < size ; i ++ ) { new DataArray [ SupplyBoxesArray ]; ArrayGetArray ( SupplyBoxes , i , DataArray ); if( DataArray [ line_id ] == item_id ) { lines --; remove_entity ( ent ); ArrayPushCell ( EmptyCfgLines , item_id ); write_file ( configurationFile , " " , item_id - 1 ); ArrayDeleteItem ( SupplyBoxes , i ); break; } } } } } public spawnSupplyBoxes ( ) { if( ArraySize ( SupplyBoxes ) < 1 || ArraySize ( SupplyBoxesContents ) < 1 || spawnCount >= get_pcvar_num ( cvar_timesPerRound ) ) { remove_task ( TASK_ID_SPAWN_BOXES ); return; } remove_supply_boxes ( ); spawnCount ++; new Float : Orig [ 3 ], Float : Angl [ 3 ]; new AmountCvar = get_pcvar_num ( cvar_amountSpawn ); new ArraySizeBox = ArraySize ( SupplyBoxes ); new size = ( AmountCvar == 0 || AmountCvar > ArraySizeBox ) ? ArraySizeBox : AmountCvar ; new Data [ SupplyBoxesArray ]; new count , randomId ; new Array: Boxes = ArrayCreate ( SupplyBoxesArray ); for( new index = 0 ; index < ArraySizeBox ; index ++ ) { ArrayGetArray ( SupplyBoxes , index , Data ); ArrayPushArray ( Boxes , Data ); } do { randomId = random ( ArraySizeBox ); ArrayGetArray ( Boxes , randomId , Data ); Orig [ 0 ] = Data [ box_origin ][ 0 ]; Angl [ 0 ] = Data [ box_angles ][ 0 ]; Orig [ 1 ] = Data [ box_origin ][ 1 ]; Angl [ 1 ] = Data [ box_angles ][ 1 ]; Orig [ 2 ] = Data [ box_origin ][ 2 ]; Angl [ 2 ] = Data [ box_angles ][ 2 ]; spawnSupplyBox ( Orig , Angl , Data [ line_id ] ); count ++; ArrayDeleteItem ( Boxes , randomId ); ArraySizeBox --; } while( count < size ); client_cmd ( 0 , "spk %s" , SUPPLY_BOX_SOUND ); client_print ( 0 , print_center , ".... Presents arrived ..." ) } public remove_supply_boxes ( ) { new ent = - 1 ; while( ( ent = engfunc ( EngFunc_FindEntityByString , ent , "classname" , entSupply ) ) ) remove_entity ( ent ); } public spawnSupplyBox ( Float : pOrigins [ 3 ], Float : pAngles [ 3 ], line_idas ) { new entity = create_entity ( "info_target" ); entity_set_string ( entity , EV_SZ_classname , entSupply ); entity_set_int ( entity , EV_INT_solid , SOLID_BBOX ); entity_set_origin ( entity , pOrigins ); entity_set_vector ( entity , EV_VEC_angles , pAngles ); entity_set_model ( entity , SupplyBoxModel ); entity_set_size ( entity , minModel , maxModel ); entity_set_int ( entity , EV_INT_renderfx , kRenderFxGlowShell ); entity_set_vector ( entity , EV_VEC_rendercolor , Float :{ 221.0 , 173.0 , 237.0 } ); set_pev ( entity , pev_iuser1 , line_idas ); } public supply_box_pickup ( box , player ) { if( ! is_user_alive ( player ) || ! can_pickup [ player ] ) return; new randomDrop = random ( ArraySize ( SupplyBoxesContents ) ); new Data [ SupplyContentsArray ]; ArrayGetArray ( SupplyBoxesContents , randomDrop , Data ); ExecuteForward ( Data [ pickupForwardItem ], forwardResult , player ); if( get_pcvar_num ( cvar_pickupTimes ) > 0 ) { pickupCount [ player ]++; if( pickupCount [ player ] >= get_pcvar_num ( cvar_pickupTimes ) ) can_pickup [ player ] = false ; } ColorChat ( player , GREEN , "!g[Umbrella Hell] !yHas encontrado una ^3SupplyBox !ycon !g%s!" , Data [ box_name ] ); client_cmd ( player , "spk %s" , PickupSound ); remove_entity ( box ); } public native_register_content ( plugin_id , paramaters_num ) { new BoxName [ 32 ]; get_string ( 1 , BoxName , charsmax ( BoxName ) ); new Data [ SupplyContentsArray ]; Data [ box_id ] = ArraySize ( SupplyBoxesContents ); Data [ box_name ] = BoxName ; Data [ pickupForwardItem ] = CreateOneForward ( plugin_id , "sb_pickup_event" , FP_CELL ); ArrayPushArray ( SupplyBoxesContents , Data ); // Debuging // // log_amx( "Registered box content name: %s and id: %d", BoxName, Data[ box_id ] ); // Return id to original plugin // return Data [ box_id ]; } public Message_StatusIcon ( iMsgId , MSG_DEST , id ) { if( ! get_pcvar_num ( p_Enabled ) ) return PLUGIN_HANDLED ; static szIcon [ 5 ] get_msg_arg_string ( 2 , szIcon , 4 ) 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 ( ent , id ) { if (! is_user_connected ( id ) || ! is_user_alive ( id ) || ! pev_valid ( ent ) ) return FMRES_IGNORED ; static szEntModel [ 32 ]; pev ( ent , pev_model , szEntModel , 31 ); for (new level_equip_id = PlayerLevel [ id ] + 1 ; level_equip_id < MAXLEVEL ; level_equip_id ++) { if ( equali ( szEntModel , 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 ) == 2 ) { 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_victim , g_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(( 1 <= 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 ( 0 , 255 , 50 , 0.50 , 0.33 , 1 , 2.0 , 2.0 ) ShowSyncHudMsg ( g_attacker , g_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 ( 0 , 255 , 50 , 0.50 , 0.33 , 1 , 2.0 , 2.0 ) ShowSyncHudMsg ( g_attacker , g_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 ( 0 , 255 , 50 , 0.45 , 0.33 , 1 , 2.0 , 2.0 ) ShowSyncHudMsg ( g_attacker , g_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 ( 0 , 255 , 50 , 0.45 , 0.33 , 1 , 2.0 , 2.0 ) ShowSyncHudMsg ( g_attacker , g_msgHudSync1 , "%L" , LANG_SERVER , "ULTRA_XP" , counted_ultra ) } } } check_level ( g_attacker ) } } #endif #if defined ZOMBIE_PLAGUE public zp_user_infected_post ( g_victim , g_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(( 1 <= 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 ( 0 , 255 , 50 , 0.50 , 0.33 , 1 , 2.0 , 2.0 ) ShowSyncHudMsg ( g_attacker , g_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 ( 0 , 255 , 50 , 0.50 , 0.33 , 1 , 2.0 , 2.0 ) ShowSyncHudMsg ( g_attacker , g_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 ( 0 , 255 , 50 , 0.45 , 0.33 , 1 , 2.0 , 2.0 ) ShowSyncHudMsg ( g_attacker , g_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 ( 0 , 255 , 50 , 0.45 , 0.33 , 1 , 2.0 , 2.0 ) ShowSyncHudMsg ( g_attacker , g_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(( 1 <= 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 ( 0 , 255 , 50 , 0.50 , 0.33 , 1 , 2.0 , 2.0 ) ShowSyncHudMsg ( g_attacker , g_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 ( 0 , 255 , 50 , 0.50 , 0.33 , 1 , 2.0 , 2.0 ) ShowSyncHudMsg ( g_attacker , g_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 ( 0 , 255 , 50 , 0.45 , 0.33 , 1 , 2.0 , 2.0 ) ShowSyncHudMsg ( g_attacker , g_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 ( 0 , 255 , 50 , 0.45 , 0.33 , 1 , 2.0 , 2.0 ) ShowSyncHudMsg ( g_attacker , g_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 != 0 && get_pcvar_num ( p_Enabled )) { static sName [ 32 ]; get_user_name ( target , sName , 31 ) set_hudmessage ( 255 , 255 , 255 , 0.6 , - 1.0 , 0 , 0.0 , 6.0 , 0.0 , 0.0 , 2 ) ShowSyncHudMsg ( id , g_msgHudSync1 , "%L" , LANG_SERVER , "LEVEL_TEXT" , sName , PlayerLevel [ 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 ( 255 , 0 , 0 , 0.02 , 0.33 , 0 , 0.0 , 0.3 , 0.0 , 0.0 ) ShowSyncHudMsg ( id , g_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 ( szTitle , 63 , "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 ( id , szMotd , szTitle ) return PLUGIN_HANDLED ; } public check_level ( id ) { if( PlayerLevel [ id ] < MAXLEVEL - 1 && 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 ( id , p_origin , 0 ); set_sprite ( p_origin , levelspr , 30 ) set_sprite ( p_origin , levelspr2 , 30 ) } emit_sound ( id , CHAN_ITEM , LevelUp , 1.0 , ATTN_NORM , 0 , PITCH_NORM ); static name [ 32 ] ; get_user_name ( id , name , charsmax ( name )); client_printcolor ( 0 , "%L" , LANG_SERVER , "LEVEL_UP" , name , PlayerLevel [ 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 - 1 - len , "%L" , LANG_SERVER , "TITLE_MENU_INFO" ) len += formatex ( menu [ len ], sizeof menu - 1 - len , "\r1. \w%L" , id , "INFO" ) if ( get_pcvar_num ( show_rank ) ) { xKeys3 |= ( MENU_KEY_2 ) len += formatex ( menu [ len ], sizeof menu - 1 - len , "^n\r2. \wTop 20^n" ) } else { len += formatex ( menu [ len ], sizeof menu - 1 - 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 - 1 - len , "\r3. \w%L^n" , id , "ITEM_LIST" ) if ( is_user_alive ( id ) ) { xKeys3 |= ( MENU_KEY_4 ) len += formatex ( menu [ len ], sizeof menu - 1 - len , "\r4. \w%L^n" , id , "UNLOCKS_SHOP_TEXT" ) } } len += formatex ( menu [ len ], sizeof menu - 1 - len , "^n^n\r0.\w %L" , id , "EXIT_MENU" ) show_menu ( id , xKeys3 , menu , - 1 , "Main Menu" ) } public main_menu_info ( id , key ) { 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_int ( id ); callfunc_end (); } } case 3 : { if( callfunc_begin ( "item_upgrades" , "gunxpmod_shop.amxx" ) == 1 ) { callfunc_push_int ( id ); 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 - 1 - len , "%L" , LANG_SERVER , "TITLE_MENU" , PlayerLevel [ id ], PlayerXp [ id ], LEVELS [ PlayerLevel [ id ]]) len += formatex ( menu [ len ], sizeof menu - 1 - len , "%L" , LANG_SERVER , "CHOOSE_TEXT" ) len += formatex ( menu [ len ], sizeof menu - 1 - len , "%L" , LANG_SERVER , "LAST_GUNS" ) len += formatex ( menu [ len ], sizeof menu - 1 - len , "^n^n\r0.\w %L" , id , "EXIT_MENU" ) show_menu ( id , xKeys2 , menu , - 1 , "Main Level Menu" ) } public main_menu_level ( id , key ) { if ( ! is_user_alive ( id ) ) return PLUGIN_HANDLED ; switch ( key ) { case 0 : // back { first_check_menu ( id ) } case 1 : // next { give_weapon_menu ( id , g_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 + 7 , sizeof ( LEVELS )); new iPosNum = 0 ; // Title len += formatex ( menu [ len ], sizeof menu - 1 - 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 - 1 - len , "%L" , LANG_SERVER , "INACTIVE_MENU" , ++ iPosNum , RANK [class], class) } else { xKeys |= ( 1 << iPosNum ++); len += formatex ( menu [ len ], sizeof menu - 1 - len , "%L" , LANG_SERVER , "ACTIVE_MENU" , class- MENU_STARTID + 1 , RANK [class], class) } } if ( MENU_STARTID != 0 && MENU_STARTID != 21 ) { xKeys |= ( 1 << 7 ) xKeys |= ( 1 << 8 ) len += formatex ( menu [ len ], sizeof menu - 1 - 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 == 0 ) { xKeys |= ( 1 << 8 ) len += formatex ( menu [ len ], sizeof menu - 1 - 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 - 1 - len , "^n\r8.\w %L^n^n\r0.\w %L" , id , "BACK_MENU" , id , "EXIT_MENU" ) } show_menu ( id , xKeys , menu , - 1 , "Level by Menu" ) } public menu_level ( id , key ) { if ( ! is_user_alive ( id ) ) return PLUGIN_HANDLED ; if ( key >= 7 || key - 1 >= PlayerLevel [ id ]) { switch ( key ) { case 7 : // back { if ( MENU_STARTID - 7 >= 0 ) MENU_STARTID -= 7 } case 8 : // next { if ( MENU_STARTID + 7 < 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 ( id , selected ); return PLUGIN_HANDLED ; } public give_weapon_menu ( id , selection ) { #if defined ZOMBIE_SWARM if( get_user_team ( id ) == 2 && 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 ( id , AMMOCONST [ selection ])) { give_item ( id , WEAPONCONST [ selection ]); } cs_set_user_bpammo ( id , AMMOCONST [ 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 ( id , AMMOCONST [ selection ])) { give_item ( id , WEAPONCONST [ selection ]); } cs_set_user_bpammo ( id , AMMOCONST [ selection ], AMMO2CONST [ selection ]) } #endif } public give_weapon ( id ) { #if defined ZOMBIE_SWARM if( get_user_team ( id ) == 2 && 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 ( id , AMMOCONST [ PlayerLevel [ id ]])) { give_item ( id , WEAPONCONST [ PlayerLevel [ id ]]); } cs_set_user_bpammo ( id , AMMOCONST [ 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 ( id , AMMOCONST [ PlayerLevel [ id ]])) { give_item ( id , WEAPONCONST [ PlayerLevel [ id ]]); } cs_set_user_bpammo ( id , AMMOCONST [ PlayerLevel [ id ]], AMMO2CONST [ PlayerLevel [ id ]]) } #endif } public set_sprite ( p_origin [ 3 ], sprite , radius ) { // Explosion message_begin ( MSG_BROADCAST , SVC_TEMPENTITY , p_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 i = 0 ; i < num ; i ++) { index = players [ i ]; Sort [ count ][ 0 ] = index ; Sort [ count ][ 1 ] = PlayerXp [ index ]; count ++; } SortCustom2D ( Sort , count , "CompareXp" ); new motd [ 1501 ], iLen ; iLen = formatex ( motd , sizeof 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 y = clamp ( count , 0 , 20 ); new name [ 32 ], kindex ; for(new x = 0 ; x < y ; x ++) { 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" , x + 1 , name , Sort [ 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 ( id , level , cid ) { if(! cmd_access ( id , level , cid , 3 ) || ! get_pcvar_num ( p_Enabled )) { return PLUGIN_HANDLED ; } new Arg1 [ 64 ], Target read_argv ( 1 , Arg1 , 63 ) Target = cmd_target ( id , Arg1 , 0 ) new iLevel [ 32 ], Value read_argv ( 2 , iLevel , 31 ) 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 ( id , AdminName , 31 ) new TargetName [ 32 ] get_user_name ( Target , TargetName , 31 ) PlayerLevel [ Target ] = Value - 1 PlayerXp [ Target ] = LEVELS [ PlayerLevel [ Target ]] check_level ( Target ) client_printcolor ( Target , "/gADMIN /ctr%s /yEstablecio tu Nivel a /g%d" , AdminName , Value ) return PLUGIN_HANDLED ; } // Save Player Info SaveLevel ( id ) { if ( get_pcvar_num ( savexp ) ) { new authid [ 32 ] get_user_authid ( id , authid , 31 ) new szData [ 256 ]; new szKey [ 64 ]; formatex ( szKey , 63 , "%s-ID" , authid ); formatex ( szData , 255 , "%i#%i#" , PlayerLevel [ id ], PlayerXp [ id ] ); nvault_set ( g_Vault , szKey , szData ); } else { new authip [ 32 ] get_user_ip ( id , authip , 31 , 1 ) new szData [ 256 ]; new szKey [ 64 ]; formatex ( szKey , 63 , "%s-IP" , authip ); formatex ( szData , 255 , "%i#%i#" , PlayerLevel [ id ], PlayerXp [ id ] ); nvault_set ( g_Vault , szKey , szData ); } } // Load Player Info LoadLevel ( id ) { if ( get_pcvar_num ( savexp ) ) { new authid [ 32 ] get_user_authid ( id , authid , 31 ) new szData [ 256 ]; new szKey [ 40 ]; formatex ( szKey , 39 , "%s-ID" , authid ); formatex ( szData , 255 , "%i#%i#" , PlayerLevel [ id ], PlayerXp [ id ]) nvault_get ( g_Vault , szKey , szData , 255 ) replace_all ( szData , 255 , "#" , " " ) new xp [ 32 ], level [ 32 ] parse ( szData , level , 31 , xp , 31 ) PlayerLevel [ id ] = str_to_num ( level ) PlayerXp [ id ] = str_to_num ( xp ) } else { new authip [ 32 ] get_user_ip ( id , authip , 31 , 1 ) new szData [ 256 ]; new szKey [ 40 ]; formatex ( szKey , 39 , "%s-IP" , authip ); formatex ( szData , 255 , "%i#%i#" , PlayerLevel [ id ], PlayerXp [ id ]) nvault_get ( g_Vault , szKey , szData , 255 ) replace_all ( szData , 255 , "#" , " " ) new xp [ 32 ], level [ 32 ] parse ( szData , level , 31 , xp , 31 ) 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 ( id , amount ) { 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 ( id , amount ) { 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 = 1 , players [ 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 ( id ) players [ 0 ] = id ; else get_players ( players , count , "ch" ); for (new i = 0 ; i < count ; i ++) if ( is_user_connected ( players [ i ])) { message_begin ( MSG_ONE_UNRELIABLE , SayTxT , _ , players [ i ]); write_byte ( players [ i ]); write_string ( msg ); message_end (); } } public StripPlayerWeapons ( id ) { strip_user_weapons ( id ) set_pdata_int ( id , OFFSET_PRIMARYWEAPON , 0 ) 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...
Mensajes: 174
Temas: 60
Registro en: Oct 2018
Reputación:
1
(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_maxplayers , g_msgHudSync1 , SayTxT , enable_grenades ; new levelspr , levelspr2 , show_level_text , show_rank ; new savexp , xp_kill , xp_triple , enable_triple , triple_kills , xp_ultra , ultra_kills , enable_ultra , p_Enabled , level_style ; new enable_admin_xp , admin_xp ; // Entity specifics // new entSupply [ ] = "supply_box_entity" ; new Float : minModel [ 3 ] = { - 8.01 , - 8.09 , 0.0 } new Float : maxModel [ 3 ] = { 8.12 , 8.09 , 22.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_pickup [ 33 ]; new pickupCount [ 33 ]; // 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 [ 3 ], Float : box_angles [ 3 ] } new Array: SupplyBoxesContents ; // <- Content holder // enum _ : SupplyContentsArray { box_id , box_name [ 35 ], pickupForwardItem } // Server specifics // new cvar_pickupTimes , cvar_timesPerRound , cvar_amountSpawn , cvar_team , cvar_spawnEvery ; new maxPlayers , mapName [ 32 ], configurationFile [ 258 ], lines ; new forwardResult , spawnCount ; new const LevelUp [] = "umbrella/levelup.wav" ; //mac10// new const LEVELS [ MAXLEVEL ] = { 90 , 180 , 300 , 450 , 700 , 1200 , 1800 , 2800 , 4100 , 5200 , 6000 , 6800 , 8200 , 10200 , 12000 , 15000 , 17500 , 20500 , 25500 , //<-aug// 29000 , 35000 , 46000 , 58000 , 150000 }; // 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 ] = { 17 , 16 , 1 , 11 , 26 , 10 , 23 , 7 , 12 , 19 , 30 , 3 , 18 , 15 , 14 , 21 , 5 , 28 , 22 , 8 , 27 , 13 , 24 , 20 }; // Weapons ID(CSW) new const AMMO2CONST [ MAXLEVEL ] = { 400 , 400 , 400 , 400 , 400 , 400 , 400 , 400 , 400 , 400 , 400 , 400 , 90 , 400 , 400 , 80 , 80 , 400 , 400 , 400 , 400 , 200 , 200 , 400 }; // Weapons Ammo /*================================================================================ [Plugin natives,precache,init] =================================================================================*/ public plugin_init () { register_plugin ( PLUGIN , VERSION , AUTHOR ); register_cvar ( "gxm_version" , VERSION , FCVAR_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_touch ( entSupply , "player" , "supply_box_pickup" ); register_logevent ( "RoundEnd" , 2 , "1=Round_End" ); register_logevent ( "RoundStart" , 2 , "1=Round_Start" ); RegisterHam ( Ham_Spawn , "player" , "playerSpawn" , 1 ); 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_model ( SupplyBoxModel ); precache_sound ( PickupSound ); precache_sound ( SUPPLY_BOX_SOUND ); SupplyBoxes = ArrayCreate ( SupplyBoxesArray ); SupplyBoxesContents = ArrayCreate ( SupplyContentsArray ); EmptyCfgLines = ArrayCreate ( 1 , 1 ); engfunc ( EngFunc_PrecacheSound , LevelUp ); } 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_mapname ( mapName , charsmax ( mapName ) ); add ( mapName , charsmax ( mapName ), ".cfg" , 0 ); get_configsdir ( configurationFile , charsmax ( configurationFile ) ); add ( configurationFile , charsmax ( configurationFile ), "/SupplyBoxes/" , 0 ); if( ! dir_exists ( configurationFile ) ) mkdir ( configurationFile ); add ( configurationFile , charsmax ( configurationFile ), mapName , 0 ); if( ! file_exists ( configurationFile ) ) { new m_map_cfg = fopen ( configurationFile , "wt" ); fclose ( m_map_cfg ); } fillSupplyArray ( ); } public plugin_end () { //Close the vault when the plugin ends (map change\server shutdown\restart) nvault_close ( g_Vault ); } public client_authorized ( id ) { g_remember_selection [ id ] = 0 ; LoadLevel ( id ) } public client_disconnect ( id ) { SaveLevel ( id ) can_pickup [ id ] = false ; pickupCount [ id ] = 0 ; } public client_putinserver ( id ) { can_pickup [ id ] = false ; pickupCount [ id ] = 0 ; } public RoundStart ( ) { if( get_pcvar_float ( cvar_spawnEvery ) < 30.0 ) set_task ( 30.0 , "spawnSupplyBoxes" , TASK_ID_SPAWN_BOXES , _ , _ , "b" ); else set_task ( get_pcvar_float ( cvar_spawnEvery ), "spawnSupplyBoxes" , TASK_ID_SPAWN_BOXES , _ , _ , "b" ); } public RoundEnd ( ) { remove_task ( TASK_ID_SPAWN_BOXES ); for( new index = 1 ; index < maxPlayers ; index ++ ) pickupCount [ index ] = 0 ; spawnCount = 0 ; remove_supply_boxes ( ); } public playerSpawn ( id ) { if( ! is_user_alive ( id ) || get_user_team ( id ) != get_pcvar_num ( cvar_team ) ) can_pickup [ id ] = false ; else can_pickup [ id ] = true ; } public fillSupplyArray ( ) { new data [ 258 ]; new Float : Origin [ 3 ], Float : Angles [ 3 ]; new const text_parser [ 6 ][ 8 ]; new file = fopen ( configurationFile , "r" ); while( fgets ( file , data , charsmax ( data ) - 1 ) ) { lines ++; if( data [ 0 ] == ' ' ) { ArrayPushCell ( EmptyCfgLines , lines ); continue; } parse ( data , text_parser [ 0 ], 7 , text_parser [ 1 ], 7 , text_parser [ 2 ], 7 , text_parser [ 3 ], 7 , text_parser [ 4 ], 7 , text_parser [ 5 ], 7 ); Origin [ 0 ] = str_to_float ( text_parser [ 0 ] ); Origin [ 1 ] = str_to_float ( text_parser [ 1 ] ); Origin [ 2 ] = str_to_float ( text_parser [ 2 ] ); Angles [ 0 ] = str_to_float ( text_parser [ 3 ] ); Angles [ 1 ] = str_to_float ( text_parser [ 4 ] ); Angles [ 2 ] = str_to_float ( text_parser [ 5 ] ); AddSupplyToArray ( Origin , Angles , lines ); } fclose ( file ); } public supplyAdminMenu ( id ) { if( !( get_user_flags ( id ) & ADMIN_IMMUNITY ) || ! is_user_alive ( id ) ) return PLUGIN_HANDLED ; new menu = menu_create ( "\r[Umbrella Hell] \yMenu SupplyBox" , "supply_menu_handler" ); menu_additem ( menu , "Poner una SupplyBox" , "1" ); menu_additem ( menu , "Borrar una SupplyBox" , "2" ); menu_setprop ( menu , MPROP_EXIT , MEXIT_ALL ); menu_display ( id , menu , 0 ); return PLUGIN_HANDLED ; } public supply_menu_handler ( id , menu , item ) { if( ! is_user_alive ( id ) ) return PLUGIN_HANDLED ; if( item == MENU_EXIT ) { menu_destroy ( menu ); return PLUGIN_HANDLED ; } new data [ 6 ], name [ 64 ], access , callback , key ; menu_item_getinfo ( menu , item , access , data , 5 , name , charsmax ( name ), callback ); key = str_to_num ( data ); switch( key ) { case 1 : { new TargetOrigin [ 3 ], Float : Target [ 3 ], Float : Angles [ 3 ]; get_user_origin ( id , TargetOrigin , 3 ); Target [ 0 ] = float ( TargetOrigin [ 0 ] ); Target [ 1 ] = float ( TargetOrigin [ 1 ] ); Target [ 2 ] = float ( TargetOrigin [ 2 ] ); entity_get_vector ( id , EV_VEC_v_angle , Angles ); Angles [ 0 ] = 0.0 ; CreateSupplyBox ( Target , Angles ); } case 2 : { new entity , body ; get_user_aiming ( id , entity , body , 500 ); deleteSupplyBox ( entity ); } } supplyAdminMenu ( id ); return PLUGIN_HANDLED ; } public CreateSupplyBox ( Float : Origins [ 3 ], Float : Angles [ 3 ] ) { new szData [ 248 ], line_to_item ; format ( szData , charsmax ( szData ), "%f %f %f %f %f %f" , Origins [ 0 ], Origins [ 1 ], Origins [ 2 ], Angles [ 0 ], Angles [ 1 ], Angles [ 2 ] ); if( ArraySize ( EmptyCfgLines ) > 0 ) { new emptyLineId = ArrayGetCell ( EmptyCfgLines , 0 ); ArrayDeleteItem ( EmptyCfgLines , 0 ); write_file ( configurationFile , szData , emptyLineId - 1 ); line_to_item = emptyLineId ; } else { lines ++; write_file ( configurationFile , szData ); line_to_item = lines ; } AddSupplyToArray ( Origins , Angles , line_to_item ); spawnSupplyBox ( Origins , Angles , line_to_item ); } public AddSupplyToArray ( Float : Origin [ 3 ], Float : Angles [ 3 ], id ) { new Data [ SupplyBoxesArray ]; Data [ line_id ] = id ; Data [ box_origin ] = _ : Origin ; Data [ box_angles ] = _ : Angles ; ArrayPushArray ( SupplyBoxes , Data ); } public deleteSupplyBox ( ent ) { if( pev_valid ( ent ) ) { new class_name_ent [ 64 ]; entity_get_string ( ent , EV_SZ_classname , class_name_ent , charsmax ( class_name_ent ) ); if( equal ( class_name_ent , entSupply ) ) { new size = ArraySize ( SupplyBoxes ); new item_id = pev ( ent , pev_iuser1 ); for( new i = 0 ; i < size ; i ++ ) { new DataArray [ SupplyBoxesArray ]; ArrayGetArray ( SupplyBoxes , i , DataArray ); if( DataArray [ line_id ] == item_id ) { lines --; remove_entity ( ent ); ArrayPushCell ( EmptyCfgLines , item_id ); write_file ( configurationFile , " " , item_id - 1 ); ArrayDeleteItem ( SupplyBoxes , i ); break; } } } } } public spawnSupplyBoxes ( ) { if( ArraySize ( SupplyBoxes ) < 1 || ArraySize ( SupplyBoxesContents ) < 1 || spawnCount >= get_pcvar_num ( cvar_timesPerRound ) ) { remove_task ( TASK_ID_SPAWN_BOXES ); return; } remove_supply_boxes ( ); spawnCount ++; new Float : Orig [ 3 ], Float : Angl [ 3 ]; new AmountCvar = get_pcvar_num ( cvar_amountSpawn ); new ArraySizeBox = ArraySize ( SupplyBoxes ); new size = ( AmountCvar == 0 || AmountCvar > ArraySizeBox ) ? ArraySizeBox : AmountCvar ; new Data [ SupplyBoxesArray ]; new count , randomId ; new Array: Boxes = ArrayCreate ( SupplyBoxesArray ); for( new index = 0 ; index < ArraySizeBox ; index ++ ) { ArrayGetArray ( SupplyBoxes , index , Data ); ArrayPushArray ( Boxes , Data ); } do { randomId = random ( ArraySizeBox ); ArrayGetArray ( Boxes , randomId , Data ); Orig [ 0 ] = Data [ box_origin ][ 0 ]; Angl [ 0 ] = Data [ box_angles ][ 0 ]; Orig [ 1 ] = Data [ box_origin ][ 1 ]; Angl [ 1 ] = Data [ box_angles ][ 1 ]; Orig [ 2 ] = Data [ box_origin ][ 2 ]; Angl [ 2 ] = Data [ box_angles ][ 2 ]; spawnSupplyBox ( Orig , Angl , Data [ line_id ] ); count ++; ArrayDeleteItem ( Boxes , randomId ); ArraySizeBox --; } while( count < size ); client_cmd ( 0 , "spk %s" , SUPPLY_BOX_SOUND ); client_print ( 0 , print_center , ".... Presents arrived ..." ) } public remove_supply_boxes ( ) { new ent = - 1 ; while( ( ent = engfunc ( EngFunc_FindEntityByString , ent , "classname" , entSupply ) ) ) remove_entity ( ent ); } public spawnSupplyBox ( Float : pOrigins [ 3 ], Float : pAngles [ 3 ], line_idas ) { new entity = create_entity ( "info_target" ); entity_set_string ( entity , EV_SZ_classname , entSupply ); entity_set_int ( entity , EV_INT_solid , SOLID_BBOX ); entity_set_origin ( entity , pOrigins ); entity_set_vector ( entity , EV_VEC_angles , pAngles ); entity_set_model ( entity , SupplyBoxModel ); entity_set_size ( entity , minModel , maxModel ); entity_set_int ( entity , EV_INT_renderfx , kRenderFxGlowShell ); entity_set_vector ( entity , EV_VEC_rendercolor , Float :{ 221.0 , 173.0 , 237.0 } ); set_pev ( entity , pev_iuser1 , line_idas ); } public supply_box_pickup ( box , player ) { if( ! is_user_alive ( player ) || ! can_pickup [ player ] ) return; new randomDrop = random ( ArraySize ( SupplyBoxesContents ) ); new Data [ SupplyContentsArray ]; ArrayGetArray ( SupplyBoxesContents , randomDrop , Data ); ExecuteForward ( Data [ pickupForwardItem ], forwardResult , player ); if( get_pcvar_num ( cvar_pickupTimes ) > 0 ) { pickupCount [ player ]++; if( pickupCount [ player ] >= get_pcvar_num ( cvar_pickupTimes ) ) can_pickup [ player ] = false ; } ColorChat ( player , GREEN , "!g[Umbrella Hell] !yHas encontrado una ^3SupplyBox !ycon !g%s!" , Data [ box_name ] ); client_cmd ( player , "spk %s" , PickupSound ); remove_entity ( box ); } public native_register_content ( plugin_id , paramaters_num ) { new BoxName [ 32 ]; get_string ( 1 , BoxName , charsmax ( BoxName ) ); new Data [ SupplyContentsArray ]; Data [ box_id ] = ArraySize ( SupplyBoxesContents ); Data [ box_name ] = BoxName ; Data [ pickupForwardItem ] = CreateOneForward ( plugin_id , "sb_pickup_event" , FP_CELL ); ArrayPushArray ( SupplyBoxesContents , Data ); // Debuging // // log_amx( "Registered box content name: %s and id: %d", BoxName, Data[ box_id ] ); // Return id to original plugin // return Data [ box_id ]; } public Message_StatusIcon ( iMsgId , MSG_DEST , id ) { if( ! get_pcvar_num ( p_Enabled ) ) return PLUGIN_HANDLED ; static szIcon [ 5 ] get_msg_arg_string ( 2 , szIcon , 4 ) 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 ( ent , id ) { if (! is_user_connected ( id ) || ! is_user_alive ( id ) || ! pev_valid ( ent ) ) return FMRES_IGNORED ; static szEntModel [ 32 ]; pev ( ent , pev_model , szEntModel , 31 ); for (new level_equip_id = PlayerLevel [ id ] + 1 ; level_equip_id < MAXLEVEL ; level_equip_id ++) { if ( equali ( szEntModel , 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 ) == 2 ) { 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_victim , g_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(( 1 <= 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 ( 0 , 255 , 50 , 0.50 , 0.33 , 1 , 2.0 , 2.0 ) ShowSyncHudMsg ( g_attacker , g_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 ( 0 , 255 , 50 , 0.50 , 0.33 , 1 , 2.0 , 2.0 ) ShowSyncHudMsg ( g_attacker , g_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 ( 0 , 255 , 50 , 0.45 , 0.33 , 1 , 2.0 , 2.0 ) ShowSyncHudMsg ( g_attacker , g_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 ( 0 , 255 , 50 , 0.45 , 0.33 , 1 , 2.0 , 2.0 ) ShowSyncHudMsg ( g_attacker , g_msgHudSync1 , "%L" , LANG_SERVER , "ULTRA_XP" , counted_ultra ) } } } check_level ( g_attacker ) } } #endif #if defined ZOMBIE_PLAGUE public zp_user_infected_post ( g_victim , g_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(( 1 <= 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 ( 0 , 255 , 50 , 0.50 , 0.33 , 1 , 2.0 , 2.0 ) ShowSyncHudMsg ( g_attacker , g_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 ( 0 , 255 , 50 , 0.50 , 0.33 , 1 , 2.0 , 2.0 ) ShowSyncHudMsg ( g_attacker , g_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 ( 0 , 255 , 50 , 0.45 , 0.33 , 1 , 2.0 , 2.0 ) ShowSyncHudMsg ( g_attacker , g_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 ( 0 , 255 , 50 , 0.45 , 0.33 , 1 , 2.0 , 2.0 ) ShowSyncHudMsg ( g_attacker , g_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(( 1 <= 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 ( 0 , 255 , 50 , 0.50 , 0.33 , 1 , 2.0 , 2.0 ) ShowSyncHudMsg ( g_attacker , g_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 ( 0 , 255 , 50 , 0.50 , 0.33 , 1 , 2.0 , 2.0 ) ShowSyncHudMsg ( g_attacker , g_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 ( 0 , 255 , 50 , 0.45 , 0.33 , 1 , 2.0 , 2.0 ) ShowSyncHudMsg ( g_attacker , g_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 ( 0 , 255 , 50 , 0.45 , 0.33 , 1 , 2.0 , 2.0 ) ShowSyncHudMsg ( g_attacker , g_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 != 0 && get_pcvar_num ( p_Enabled )) { static sName [ 32 ]; get_user_name ( target , sName , 31 ) set_hudmessage ( 255 , 255 , 255 , 0.6 , - 1.0 , 0 , 0.0 , 6.0 , 0.0 , 0.0 , 2 ) ShowSyncHudMsg ( id , g_msgHudSync1 , "%L" , LANG_SERVER , "LEVEL_TEXT" , sName , PlayerLevel [ 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 ( 255 , 0 , 0 , 0.02 , 0.33 , 0 , 0.0 , 0.3 , 0.0 , 0.0 ) ShowSyncHudMsg ( id , g_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 ( szTitle , 63 , "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 ( id , szMotd , szTitle ) return PLUGIN_HANDLED ; } public check_level ( id ) { if( PlayerLevel [ id ] < MAXLEVEL - 1 && 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 ( id , p_origin , 0 ); set_sprite ( p_origin , levelspr , 30 ) set_sprite ( p_origin , levelspr2 , 30 ) } emit_sound ( id , CHAN_ITEM , LevelUp , 1.0 , ATTN_NORM , 0 , PITCH_NORM ); static name [ 32 ] ; get_user_name ( id , name , charsmax ( name )); client_printcolor ( 0 , "%L" , LANG_SERVER , "LEVEL_UP" , name , PlayerLevel [ 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 - 1 - len , "%L" , LANG_SERVER , "TITLE_MENU_INFO" ) len += formatex ( menu [ len ], sizeof menu - 1 - len , "\r1. \w%L" , id , "INFO" ) if ( get_pcvar_num ( show_rank ) ) { xKeys3 |= ( MENU_KEY_2 ) len += formatex ( menu [ len ], sizeof menu - 1 - len , "^n\r2. \wTop 20^n" ) } else { len += formatex ( menu [ len ], sizeof menu - 1 - 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 - 1 - len , "\r3. \w%L^n" , id , "ITEM_LIST" ) if ( is_user_alive ( id ) ) { xKeys3 |= ( MENU_KEY_4 ) len += formatex ( menu [ len ], sizeof menu - 1 - len , "\r4. \w%L^n" , id , "UNLOCKS_SHOP_TEXT" ) } } len += formatex ( menu [ len ], sizeof menu - 1 - len , "^n^n\r0.\w %L" , id , "EXIT_MENU" ) show_menu ( id , xKeys3 , menu , - 1 , "Main Menu" ) } public main_menu_info ( id , key ) { 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_int ( id ); callfunc_end (); } } case 3 : { if( callfunc_begin ( "item_upgrades" , "gunxpmod_shop.amxx" ) == 1 ) { callfunc_push_int ( id ); 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 - 1 - len , "%L" , LANG_SERVER , "TITLE_MENU" , PlayerLevel [ id ], PlayerXp [ id ], LEVELS [ PlayerLevel [ id ]]) len += formatex ( menu [ len ], sizeof menu - 1 - len , "%L" , LANG_SERVER , "CHOOSE_TEXT" ) len += formatex ( menu [ len ], sizeof menu - 1 - len , "%L" , LANG_SERVER , "LAST_GUNS" ) len += formatex ( menu [ len ], sizeof menu - 1 - len , "^n^n\r0.\w %L" , id , "EXIT_MENU" ) show_menu ( id , xKeys2 , menu , - 1 , "Main Level Menu" ) } public main_menu_level ( id , key ) { if ( ! is_user_alive ( id ) ) return PLUGIN_HANDLED ; switch ( key ) { case 0 : // back { first_check_menu ( id ) } case 1 : // next { give_weapon_menu ( id , g_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 + 7 , sizeof ( LEVELS )); new iPosNum = 0 ; // Title len += formatex ( menu [ len ], sizeof menu - 1 - 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 - 1 - len , "%L" , LANG_SERVER , "INACTIVE_MENU" , ++ iPosNum , RANK [class], class) } else { xKeys |= ( 1 << iPosNum ++); len += formatex ( menu [ len ], sizeof menu - 1 - len , "%L" , LANG_SERVER , "ACTIVE_MENU" , class- MENU_STARTID + 1 , RANK [class], class) } } if ( MENU_STARTID != 0 && MENU_STARTID != 21 ) { xKeys |= ( 1 << 7 ) xKeys |= ( 1 << 8 ) len += formatex ( menu [ len ], sizeof menu - 1 - 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 == 0 ) { xKeys |= ( 1 << 8 ) len += formatex ( menu [ len ], sizeof menu - 1 - 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 - 1 - len , "^n\r8.\w %L^n^n\r0.\w %L" , id , "BACK_MENU" , id , "EXIT_MENU" ) } show_menu ( id , xKeys , menu , - 1 , "Level by Menu" ) } public menu_level ( id , key ) { if ( ! is_user_alive ( id ) ) return PLUGIN_HANDLED ; if ( key >= 7 || key - 1 >= PlayerLevel [ id ]) { switch ( key ) { case 7 : // back { if ( MENU_STARTID - 7 >= 0 ) MENU_STARTID -= 7 } case 8 : // next { if ( MENU_STARTID + 7 < 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 ( id , selected ); return PLUGIN_HANDLED ; } public give_weapon_menu ( id , selection ) { #if defined ZOMBIE_SWARM if( get_user_team ( id ) == 2 && 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 ( id , AMMOCONST [ selection ])) { give_item ( id , WEAPONCONST [ selection ]); } cs_set_user_bpammo ( id , AMMOCONST [ 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 ( id , AMMOCONST [ selection ])) { give_item ( id , WEAPONCONST [ selection ]); } cs_set_user_bpammo ( id , AMMOCONST [ selection ], AMMO2CONST [ selection ]) } #endif } public give_weapon ( id ) { #if defined ZOMBIE_SWARM if( get_user_team ( id ) == 2 && 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 ( id , AMMOCONST [ PlayerLevel [ id ]])) { give_item ( id , WEAPONCONST [ PlayerLevel [ id ]]); } cs_set_user_bpammo ( id , AMMOCONST [ 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 ( id , AMMOCONST [ PlayerLevel [ id ]])) { give_item ( id , WEAPONCONST [ PlayerLevel [ id ]]); } cs_set_user_bpammo ( id , AMMOCONST [ PlayerLevel [ id ]], AMMO2CONST [ PlayerLevel [ id ]]) } #endif } public set_sprite ( p_origin [ 3 ], sprite , radius ) { // Explosion message_begin ( MSG_BROADCAST , SVC_TEMPENTITY , p_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 i = 0 ; i < num ; i ++) { index = players [ i ]; Sort [ count ][ 0 ] = index ; Sort [ count ][ 1 ] = PlayerXp [ index ]; count ++; } SortCustom2D ( Sort , count , "CompareXp" ); new motd [ 1501 ], iLen ; iLen = formatex ( motd , sizeof 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 y = clamp ( count , 0 , 20 ); new name [ 32 ], kindex ; for(new x = 0 ; x < y ; x ++) { 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" , x + 1 , name , Sort [ 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 ( id , level , cid ) { if(! cmd_access ( id , level , cid , 3 ) || ! get_pcvar_num ( p_Enabled )) { return PLUGIN_HANDLED ; } new Arg1 [ 64 ], Target read_argv ( 1 , Arg1 , 63 ) Target = cmd_target ( id , Arg1 , 0 ) new iLevel [ 32 ], Value read_argv ( 2 , iLevel , 31 ) 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 ( id , AdminName , 31 ) new TargetName [ 32 ] get_user_name ( Target , TargetName , 31 ) PlayerLevel [ Target ] = Value - 1 PlayerXp [ Target ] = LEVELS [ PlayerLevel [ Target ]] check_level ( Target ) client_printcolor ( Target , "/gADMIN /ctr%s /yEstablecio tu Nivel a /g%d" , AdminName , Value ) return PLUGIN_HANDLED ; } // Save Player Info SaveLevel ( id ) { if ( get_pcvar_num ( savexp ) ) { new authid [ 32 ] get_user_authid ( id , authid , 31 ) new szData [ 256 ]; new szKey [ 64 ]; formatex ( szKey , 63 , "%s-ID" , authid ); formatex ( szData , 255 , "%i#%i#" , PlayerLevel [ id ], PlayerXp [ id ] ); nvault_set ( g_Vault , szKey , szData ); } else { new authip [ 32 ] get_user_ip ( id , authip , 31 , 1 ) new szData [ 256 ]; new szKey [ 64 ]; formatex ( szKey , 63 , "%s-IP" , authip ); formatex ( szData , 255 , "%i#%i#" , PlayerLevel [ id ], PlayerXp [ id ] ); nvault_set ( g_Vault , szKey , szData ); } } // Load Player Info LoadLevel ( id ) { if ( get_pcvar_num ( savexp ) ) { new authid [ 32 ] get_user_authid ( id , authid , 31 ) new szData [ 256 ]; new szKey [ 40 ]; formatex ( szKey , 39 , "%s-ID" , authid ); formatex ( szData , 255 , "%i#%i#" , PlayerLevel [ id ], PlayerXp [ id ]) nvault_get ( g_Vault , szKey , szData , 255 ) replace_all ( szData , 255 , "#" , " " ) new xp [ 32 ], level [ 32 ] parse ( szData , level , 31 , xp , 31 ) PlayerLevel [ id ] = str_to_num ( level ) PlayerXp [ id ] = str_to_num ( xp ) } else { new authip [ 32 ] get_user_ip ( id , authip , 31 , 1 ) new szData [ 256 ]; new szKey [ 40 ]; formatex ( szKey , 39 , "%s-IP" , authip ); formatex ( szData , 255 , "%i#%i#" , PlayerLevel [ id ], PlayerXp [ id ]) nvault_get ( g_Vault , szKey , szData , 255 ) replace_all ( szData , 255 , "#" , " " ) new xp [ 32 ], level [ 32 ] parse ( szData , level , 31 , xp , 31 ) 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 ( id , amount ) { 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 ( id , amount ) { 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 = 1 , players [ 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 ( id ) players [ 0 ] = id ; else get_players ( players , count , "ch" ); for (new i = 0 ; i < count ; i ++) if ( is_user_connected ( players [ i ])) { message_begin ( MSG_ONE_UNRELIABLE , SayTxT , _ , players [ i ]); write_byte ( players [ i ]); write_string ( msg ); message_end (); } } public StripPlayerWeapons ( id ) { strip_user_weapons ( id ) set_pdata_int ( id , OFFSET_PRIMARYWEAPON , 0 ) 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.
Mensajes: 299
Temas: 44
Registro en: Aug 2016
Reputación:
2
podrias usar native para llamar el check_level
Mensajes: 174
Temas: 60
Registro en: Oct 2018
Reputación:
1
(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!!!
Mensajes: 3,077
Temas: 33
Registro en: May 2017
Reputación:
34
(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!!!
Deja tú solución y añade al título [Solucionado].
Mensajes: 174
Temas: 60
Registro en: Oct 2018
Reputación:
1