Mensajes: 104
Temas: 42
Registro en: Mar 2020
Reputación:
0
Consegui esté plugin y lo que quiero es que si es posible permita hacer un menu que al escribir /models en say les abra un menu y les permita elegir una opción si activar los models de las armas y de los admins o desactivarlos, tengo esté sin ese menu pero en varios servidores he visto que tienen algo así con un menu me gustaría añadirselo a esté pero no se como, si tienen ese que vi en varios servidores mucho mejor
les agradecería mucho la ayuda
Código PHP:
/* * _______ _ _ __ __ * | _____/ | | | | \ \ __ / / * | | | | | | | | / \ | | * | | | |____| | | |/ __ \| | * | | ___ | ______ | | / \ | * | | |_ | | | | | | / \ | * | | | | | | | | | | | | * | |____| | | | | | | | | | * |_______/ |_| |_| \_/ \_/ * * * * Last Edited: 06-12-08 * * ============ * Changelog: * ============ * * v1.3 * -Bug Fixes * * v1.0 * -Initial Release * */ #define VERSION "1.3" #include <amxmodx> #include <amxmisc> #include <fakemeta> #define MAX_SOUNDS 50 #define MAX_p_MODELS 50 #define MAX_v_MODELS 50 #define MAX_w_MODELS 50 #define MAP_CONFIGS 1 new new_sounds [ MAX_SOUNDS ][ 48 ] new old_sounds [ MAX_SOUNDS ][ 48 ] new sounds_team [ MAX_SOUNDS ] new soundsnum new new_p_models [ MAX_p_MODELS ][ 48 ] new old_p_models [ MAX_p_MODELS ][ 48 ] new p_models_team [ MAX_p_MODELS ] new p_modelsnum new new_v_models [ MAX_v_MODELS ][ 48 ] new old_v_models [ MAX_v_MODELS ][ 48 ] new v_models_team [ MAX_p_MODELS ] new v_modelsnum new new_w_models [ MAX_w_MODELS ][ 48 ] new old_w_models [ MAX_w_MODELS ][ 48 ] new w_models_team [ MAX_p_MODELS ] new w_modelsnum new maxplayers public plugin_init () { register_plugin ( "Weapon Model + Sound Replacement" , VERSION , "GHW_Chronic" ) register_forward ( FM_EmitSound , "Sound_Hook" ) register_forward ( FM_SetModel , "W_Model_Hook" , 1 ) register_logevent ( "newround" , 2 , "1=Round_Start" ) register_event ( "CurWeapon" , "Changeweapon_Hook" , "be" , "1=1" ) maxplayers = get_maxplayers () } public plugin_precache () { new configfile [ 200 ] new configsdir [ 200 ] new map [ 32 ] get_configsdir ( configsdir , 199 ) get_mapname ( map , 31 ) format ( configfile , 199 , "%s/new_weapons_%s.ini" , configsdir , map ) if( file_exists ( configfile )) { load_models ( configfile ) } else { format ( configfile , 199 , "%s/new_weapons.ini" , configsdir ) load_models ( configfile ) } } public load_models ( configfile []) { if( file_exists ( configfile )) { new read [ 96 ], left [ 48 ], right [ 48 ], right2 [ 32 ], trash , team for(new i = 0 ; i < file_size ( configfile , 1 ); i ++) { read_file ( configfile , i , read , 95 , trash ) if( containi ( read , ";" )!= 0 && containi ( read , " " )!=- 1 ) { strbreak ( read , left , 47 , right , 47 ) team = 0 if( containi ( right , " " )!=- 1 ) { strbreak ( right , right , 47 , right2 , 31 ) replace_all ( right2 , 31 , "^"","") if( equali(right2," T ") || equali(right2," Terrorist ") || equali(right2," Terrorists ") || equali(right2," Blue ") || equali(right2,"B") || equali(right2," Allies ") || equali(right2," 1 ") ) team=1 else if( equali(right2," CT ") || equali(right2," Counter ") || equali(right2," Counter - Terrorist ") || equali(right2," Counter - Terrorists ") || equali(right2," CounterTerrorists ") || equali(right2," CounterTerrorist ") || equali(right2," Red ") || equali(right2," R ") || equali(right2," Axis ") || equali(right2," 2 ") ) team=2 else if( equali(right2," Yellow ") || equali(right2," Y ") || equali(right2," 3 ") ) team=3 else if( equali(right2," Green ") || equali(right2," G ") || equali(right2," 4 ") ) team=4 } replace_all(right,47," ^ "" , "" ) if( file_exists ( right )) { if( containi ( right , ".mdl" )== strlen ( right )- 4 ) { if(! precache_model ( right )) { log_amx ( "Error attempting to precache model: ^" % s ^ " (Line %d of new_weapons.ini)" , right , i + 1 ) } else if( containi ( left , "models/p_" )== 0 ) { format ( new_p_models [ p_modelsnum ], 47 , right ) format ( old_p_models [ p_modelsnum ], 47 , left ) p_models_team [ p_modelsnum ]= team p_modelsnum ++ } else if( containi ( left , "models/v_" )== 0 ) { format ( new_v_models [ v_modelsnum ], 47 , right ) format ( old_v_models [ v_modelsnum ], 47 , left ) v_models_team [ v_modelsnum ]= team v_modelsnum ++ } else if( containi ( left , "models/w_" )== 0 ) { format ( new_w_models [ w_modelsnum ], 47 , right ) format ( old_w_models [ w_modelsnum ], 47 , left ) w_models_team [ w_modelsnum ]= team w_modelsnum ++ } else { log_amx ( "Model type(p_ / v_ / w_) unknown for model: ^" % s ^ " (Line %d of new_weapons.ini)" , right , i + 1 ) } } else if( containi ( right , ".wav" )== strlen ( right )- 4 || containi ( right , ".mp3" )== strlen ( right )- 4 ) { replace ( right , 47 , "sound/" , "" ) replace ( left , 47 , "sound/" , "" ) if(! precache_sound ( right )) { log_amx ( "Error attempting to precache sound: ^" % s ^ " (Line %d of new_weapons.ini)" , right , i + 1 ) } else { format ( new_sounds [ soundsnum ], 47 , right ) format ( old_sounds [ soundsnum ], 47 , left ) sounds_team [ soundsnum ]= team soundsnum ++ } } else { log_amx ( "Invalid File: ^" % s ^ " (Line %d of new_weapons.ini)" , right , i + 1 ) } } else { log_amx ( "File Inexistent: ^" % s ^ " (Line %d of new_weapons.ini)" , right , i + 1 ) } /*if(!file_exists(left)) { log_amx("Warning: File Inexistent: ^"%s^" (Line %d of new_weapons.ini). ONLY A WARNING. PLUGIN WILL STILL WORK!!!!",left,i+1) }*/ } } } } public Changeweapon_Hook ( id ) { if(! is_user_alive ( id )) { return PLUGIN_CONTINUE } static model [ 32 ], i , team team = get_user_team ( id ) pev ( id , pev_viewmodel2 , model , 31 ) for( i = 0 ; i < v_modelsnum ; i ++) { if( equali ( model , old_v_models [ i ])) { if( v_models_team [ i ]== team || ! v_models_team [ i ]) { set_pev ( id , pev_viewmodel2 , new_v_models [ i ]) break; } } } pev ( id , pev_weaponmodel2 , model , 31 ) for( i = 0 ; i < p_modelsnum ; i ++) { if( equali ( model , old_p_models [ i ])) { if( p_models_team [ i ]== team || ! p_models_team [ i ]) { set_pev ( id , pev_weaponmodel2 , new_p_models [ i ]) break; } } } return PLUGIN_CONTINUE } public Sound_Hook ( id , channel , sample []) { if(! is_user_alive ( id )) { return FMRES_IGNORED } if( channel != CHAN_WEAPON && channel != CHAN_ITEM ) { return FMRES_IGNORED } static i , team team = get_user_team ( id ) for( i = 0 ; i < soundsnum ; i ++) { if( equali ( sample , old_sounds [ i ])) { if( sounds_team [ i ]== team || ! sounds_team [ i ]) { engfunc ( EngFunc_EmitSound , id , CHAN_WEAPON , new_sounds [ i ], 1.0 , ATTN_NORM , 0 , PITCH_NORM ) return FMRES_SUPERCEDE } } } return FMRES_IGNORED } public W_Model_Hook ( ent , model []) { if(! pev_valid ( ent )) { return FMRES_IGNORED } static i for( i = 0 ; i < w_modelsnum ; i ++) { if( equali ( model , old_w_models [ i ])) { engfunc ( EngFunc_SetModel , ent , new_w_models [ i ]) return FMRES_SUPERCEDE } } return FMRES_IGNORED } public newround () { static ent , classname [ 8 ], model [ 32 ] ent = engfunc ( EngFunc_FindEntityInSphere , maxplayers , Float :{ 0.0 , 0.0 , 0.0 }, 4800.0 ) while( ent ) { if( pev_valid ( ent )) { pev ( ent , pev_classname , classname , 7 ) if( containi ( classname , "armoury" )!=- 1 ) { pev ( ent , pev_model , model , 31 ) W_Model_Hook ( ent , model ) } } ent = engfunc ( EngFunc_FindEntityInSphere , ent , Float :{ 0.0 , 0.0 , 0.0 }, 4800.0 ) } }
Mensajes: 25
Temas: 3
Registro en: Jul 2020
Reputación:
0
12/10/2020, 06:02 PM
(Última modificación: 12/10/2020, 11:20 PM por gh0st . Edited 1 time in total.)
Prueba
Código PHP:
/* * _______ _ _ __ __ * | _____/ | | | | \ \ __ / / * | | | | | | | | / \ | | * | | | |____| | | |/ __ \| | * | | ___ | ______ | | / \ | * | | |_ | | | | | | / \ | * | | | | | | | | | | | | * | |____| | | | | | | | | | * |_______/ |_| |_| \_/ \_/ * * * * Last Edited: 06-12-08 * * ============ * Changelog: * ============ * * v1.3 * -Bug Fixes * * v1.0 * -Initial Release * */ #define VERSION "1.3" #include <amxmodx> #include <amxmisc> #include <fakemeta> #define MAX_SOUNDS 50 #define MAX_p_MODELS 50 #define MAX_v_MODELS 50 #define MAX_w_MODELS 50 #define MAP_CONFIGS 1 new new_sounds [ MAX_SOUNDS ][ 48 ] new old_sounds [ MAX_SOUNDS ][ 48 ] new sounds_team [ MAX_SOUNDS ] new soundsnum new new_p_models [ MAX_p_MODELS ][ 48 ] new old_p_models [ MAX_p_MODELS ][ 48 ] new p_models_team [ MAX_p_MODELS ] new p_modelsnum new new_v_models [ MAX_v_MODELS ][ 48 ] new old_v_models [ MAX_v_MODELS ][ 48 ] new v_models_team [ MAX_p_MODELS ] new v_modelsnum new new_w_models [ MAX_w_MODELS ][ 48 ] new old_w_models [ MAX_w_MODELS ][ 48 ] new w_models_team [ MAX_p_MODELS ] new w_modelsnum new maxplayers new bool : g_bModels [ 33 ] public plugin_init () { register_plugin ( "Weapon Model + Sound Replacement" , VERSION , "GHW_Chronic" ) register_forward ( FM_EmitSound , "Sound_Hook" ) register_forward ( FM_SetModel , "W_Model_Hook" , 1 ) register_logevent ( "newround" , 2 , "1=Round_Start" ) register_event ( "CurWeapon" , "Changeweapon_Hook" , "be" , "1=1" ) register_clcmd ( "say /models" , "cmdMenu" ) maxplayers = get_maxplayers () } public client_putinserver ( id ) { g_bModels [ id ] = true ; } public plugin_precache () { new configfile [ 200 ] new configsdir [ 200 ] new map [ 32 ] get_configsdir ( configsdir , 199 ) get_mapname ( map , 31 ) format ( configfile , 199 , "%s/new_weapons_%s.ini" , configsdir , map ) if( file_exists ( configfile )) { load_models ( configfile ) } else { format ( configfile , 199 , "%s/new_weapons.ini" , configsdir ) load_models ( configfile ) } } public load_models ( configfile []) { if( file_exists ( configfile )) { new read [ 96 ], left [ 48 ], right [ 48 ], right2 [ 32 ], trash , team for(new i = 0 ; i < file_size ( configfile , 1 ); i ++) { read_file ( configfile , i , read , 95 , trash ) if( containi ( read , ";" )!= 0 && containi ( read , " " )!=- 1 ) { strbreak ( read , left , 47 , right , 47 ) team = 0 if( containi ( right , " " )!=- 1 ) { strbreak ( right , right , 47 , right2 , 31 ) replace_all ( right2 , 31 , "^"","") if( equali(right2," T ") || equali(right2," Terrorist ") || equali(right2," Terrorists ") || equali(right2," Blue ") || equali(right2,"B") || equali(right2," Allies ") || equali(right2," 1 ") ) team=1 else if( equali(right2," CT ") || equali(right2," Counter ") || equali(right2," Counter - Terrorist ") || equali(right2," Counter - Terrorists ") || equali(right2," CounterTerrorists ") || equali(right2," CounterTerrorist ") || equali(right2," Red ") || equali(right2," R ") || equali(right2," Axis ") || equali(right2," 2 ") ) team=2 else if( equali(right2," Yellow ") || equali(right2," Y ") || equali(right2," 3 ") ) team=3 else if( equali(right2," Green ") || equali(right2," G ") || equali(right2," 4 ") ) team=4 } replace_all(right,47," ^ "" , "" ) if( file_exists ( right )) { if( containi ( right , ".mdl" )== strlen ( right )- 4 ) { if(! precache_model ( right )) { log_amx ( "Error attempting to precache model: ^" % s ^ " (Line %d of new_weapons.ini)" , right , i + 1 ) } else if( containi ( left , "models/p_" )== 0 ) { format ( new_p_models [ p_modelsnum ], 47 , right ) format ( old_p_models [ p_modelsnum ], 47 , left ) p_models_team [ p_modelsnum ]= team p_modelsnum ++ } else if( containi ( left , "models/v_" )== 0 ) { format ( new_v_models [ v_modelsnum ], 47 , right ) format ( old_v_models [ v_modelsnum ], 47 , left ) v_models_team [ v_modelsnum ]= team v_modelsnum ++ } else if( containi ( left , "models/w_" )== 0 ) { format ( new_w_models [ w_modelsnum ], 47 , right ) format ( old_w_models [ w_modelsnum ], 47 , left ) w_models_team [ w_modelsnum ]= team w_modelsnum ++ } else { log_amx ( "Model type(p_ / v_ / w_) unknown for model: ^" % s ^ " (Line %d of new_weapons.ini)" , right , i + 1 ) } } else if( containi ( right , ".wav" )== strlen ( right )- 4 || containi ( right , ".mp3" )== strlen ( right )- 4 ) { replace ( right , 47 , "sound/" , "" ) replace ( left , 47 , "sound/" , "" ) if(! precache_sound ( right )) { log_amx ( "Error attempting to precache sound: ^" % s ^ " (Line %d of new_weapons.ini)" , right , i + 1 ) } else { format ( new_sounds [ soundsnum ], 47 , right ) format ( old_sounds [ soundsnum ], 47 , left ) sounds_team [ soundsnum ]= team soundsnum ++ } } else { log_amx ( "Invalid File: ^" % s ^ " (Line %d of new_weapons.ini)" , right , i + 1 ) } } else { log_amx ( "File Inexistent: ^" % s ^ " (Line %d of new_weapons.ini)" , right , i + 1 ) } /*if(!file_exists(left)) { log_amx("Warning: File Inexistent: ^"%s^" (Line %d of new_weapons.ini). ONLY A WARNING. PLUGIN WILL STILL WORK!!!!",left,i+1) }*/ } } } } public Changeweapon_Hook ( id ) { if(! is_user_alive ( id ) || ! g_bModels [ id ]) { return PLUGIN_CONTINUE } static model [ 32 ], i , team team = get_user_team ( id ) pev ( id , pev_viewmodel2 , model , 31 ) for( i = 0 ; i < v_modelsnum ; i ++) { if( equali ( model , old_v_models [ i ])) { if( v_models_team [ i ]== team || ! v_models_team [ i ]) { set_pev ( id , pev_viewmodel2 , new_v_models [ i ]) break; } } } pev ( id , pev_weaponmodel2 , model , 31 ) for( i = 0 ; i < p_modelsnum ; i ++) { if( equali ( model , old_p_models [ i ])) { if( p_models_team [ i ]== team || ! p_models_team [ i ]) { set_pev ( id , pev_weaponmodel2 , new_p_models [ i ]) break; } } } return PLUGIN_CONTINUE } public Sound_Hook ( id , channel , sample []) { if(! is_user_alive ( id )) { return FMRES_IGNORED } if( channel != CHAN_WEAPON && channel != CHAN_ITEM ) { return FMRES_IGNORED } static i , team team = get_user_team ( id ) for( i = 0 ; i < soundsnum ; i ++) { if( equali ( sample , old_sounds [ i ])) { if( sounds_team [ i ]== team || ! sounds_team [ i ]) { engfunc ( EngFunc_EmitSound , id , CHAN_WEAPON , new_sounds [ i ], 1.0 , ATTN_NORM , 0 , PITCH_NORM ) return FMRES_SUPERCEDE } } } return FMRES_IGNORED } public W_Model_Hook ( ent , model []) { if(! pev_valid ( ent )) { return FMRES_IGNORED } static i for( i = 0 ; i < w_modelsnum ; i ++) { if( equali ( model , old_w_models [ i ]) && g_bModels [ i ]) { engfunc ( EngFunc_SetModel , ent , new_w_models [ i ]) return FMRES_SUPERCEDE } } return FMRES_IGNORED } public newround () { static ent , classname [ 8 ], model [ 32 ] ent = engfunc ( EngFunc_FindEntityInSphere , maxplayers , Float :{ 0.0 , 0.0 , 0.0 }, 4800.0 ) while( ent ) { if( pev_valid ( ent )) { pev ( ent , pev_classname , classname , 7 ) if( containi ( classname , "armoury" )!=- 1 ) { pev ( ent , pev_model , model , 31 ) W_Model_Hook ( ent , model ) } } ent = engfunc ( EngFunc_FindEntityInSphere , ent , Float :{ 0.0 , 0.0 , 0.0 }, 4800.0 ) } } public cmdMenu ( id ) { new menu = menu_create ( "Menu" , "h_menu" ); menu_additem ( menu , g_bModels [ id ] ? "Modelos armas : ACTIVADO" : "Modelos armas : DESACTIVADO" , "1" ) menu_display ( id , menu , 0 ) } public h_menu ( id , menu , item ) { menu_destroy ( menu ); if( item == MENU_EXIT ) return; switch( item ) { case 0 : { g_bModels [ id ] = ! g_bModels [ id ] cmdMenu ( id ) } } }
Mensajes: 104
Temas: 42
Registro en: Mar 2020
Reputación:
0
(12/10/2020, 06:02 PM) gh0st escribió: Prueba
Código PHP:
/* * _______ _ _ __ __ * | _____/ | | | | \ \ __ / / * | | | | | | | | / \ | | * | | | |____| | | |/ __ \| | * | | ___ | ______ | | / \ | * | | |_ | | | | | | / \ | * | | | | | | | | | | | | * | |____| | | | | | | | | | * |_______/ |_| |_| \_/ \_/ * * * * Last Edited: 06-12-08 * * ============ * Changelog: * ============ * * v1.3 * -Bug Fixes * * v1.0 * -Initial Release * */ #define VERSION "1.3" #include <amxmodx> #include <amxmisc> #include <fakemeta> #define MAX_SOUNDS 50 #define MAX_p_MODELS 50 #define MAX_v_MODELS 50 #define MAX_w_MODELS 50 #define MAP_CONFIGS 1 new new_sounds [ MAX_SOUNDS ][ 48 ] new old_sounds [ MAX_SOUNDS ][ 48 ] new sounds_team [ MAX_SOUNDS ] new soundsnum new new_p_models [ MAX_p_MODELS ][ 48 ] new old_p_models [ MAX_p_MODELS ][ 48 ] new p_models_team [ MAX_p_MODELS ] new p_modelsnum new new_v_models [ MAX_v_MODELS ][ 48 ] new old_v_models [ MAX_v_MODELS ][ 48 ] new v_models_team [ MAX_p_MODELS ] new v_modelsnum new new_w_models [ MAX_w_MODELS ][ 48 ] new old_w_models [ MAX_w_MODELS ][ 48 ] new w_models_team [ MAX_p_MODELS ] new w_modelsnum new maxplayers new bool : g_bModels [ 33 ] public plugin_init () { register_plugin ( "Weapon Model + Sound Replacement" , VERSION , "GHW_Chronic" ) register_forward ( FM_EmitSound , "Sound_Hook" ) register_forward ( FM_SetModel , "W_Model_Hook" , 1 ) register_logevent ( "newround" , 2 , "1=Round_Start" ) register_event ( "CurWeapon" , "Changeweapon_Hook" , "be" , "1=1" ) register_clcmd ( "say /models" , "menu" ) maxplayers = get_maxplayers () } public client_putinserver ( id ) { g_bModels [ id ] = true ; } public plugin_precache () { new configfile [ 200 ] new configsdir [ 200 ] new map [ 32 ] get_configsdir ( configsdir , 199 ) get_mapname ( map , 31 ) format ( configfile , 199 , "%s/new_weapons_%s.ini" , configsdir , map ) if( file_exists ( configfile )) { load_models ( configfile ) } else { format ( configfile , 199 , "%s/new_weapons.ini" , configsdir ) load_models ( configfile ) } } public load_models ( configfile []) { if( file_exists ( configfile )) { new read [ 96 ], left [ 48 ], right [ 48 ], right2 [ 32 ], trash , team for(new i = 0 ; i < file_size ( configfile , 1 ); i ++) { read_file ( configfile , i , read , 95 , trash ) if( containi ( read , ";" )!= 0 && containi ( read , " " )!=- 1 ) { strbreak ( read , left , 47 , right , 47 ) team = 0 if( containi ( right , " " )!=- 1 ) { strbreak ( right , right , 47 , right2 , 31 ) replace_all ( right2 , 31 , "^"","") if( equali(right2," T ") || equali(right2," Terrorist ") || equali(right2," Terrorists ") || equali(right2," Blue ") || equali(right2,"B") || equali(right2," Allies ") || equali(right2," 1 ") ) team=1 else if( equali(right2," CT ") || equali(right2," Counter ") || equali(right2," Counter - Terrorist ") || equali(right2," Counter - Terrorists ") || equali(right2," CounterTerrorists ") || equali(right2," CounterTerrorist ") || equali(right2," Red ") || equali(right2," R ") || equali(right2," Axis ") || equali(right2," 2 ") ) team=2 else if( equali(right2," Yellow ") || equali(right2," Y ") || equali(right2," 3 ") ) team=3 else if( equali(right2," Green ") || equali(right2," G ") || equali(right2," 4 ") ) team=4 } replace_all(right,47," ^ "" , "" ) if( file_exists ( right )) { if( containi ( right , ".mdl" )== strlen ( right )- 4 ) { if(! precache_model ( right )) { log_amx ( "Error attempting to precache model: ^" % s ^ " (Line %d of new_weapons.ini)" , right , i + 1 ) } else if( containi ( left , "models/p_" )== 0 ) { format ( new_p_models [ p_modelsnum ], 47 , right ) format ( old_p_models [ p_modelsnum ], 47 , left ) p_models_team [ p_modelsnum ]= team p_modelsnum ++ } else if( containi ( left , "models/v_" )== 0 ) { format ( new_v_models [ v_modelsnum ], 47 , right ) format ( old_v_models [ v_modelsnum ], 47 , left ) v_models_team [ v_modelsnum ]= team v_modelsnum ++ } else if( containi ( left , "models/w_" )== 0 ) { format ( new_w_models [ w_modelsnum ], 47 , right ) format ( old_w_models [ w_modelsnum ], 47 , left ) w_models_team [ w_modelsnum ]= team w_modelsnum ++ } else { log_amx ( "Model type(p_ / v_ / w_) unknown for model: ^" % s ^ " (Line %d of new_weapons.ini)" , right , i + 1 ) } } else if( containi ( right , ".wav" )== strlen ( right )- 4 || containi ( right , ".mp3" )== strlen ( right )- 4 ) { replace ( right , 47 , "sound/" , "" ) replace ( left , 47 , "sound/" , "" ) if(! precache_sound ( right )) { log_amx ( "Error attempting to precache sound: ^" % s ^ " (Line %d of new_weapons.ini)" , right , i + 1 ) } else { format ( new_sounds [ soundsnum ], 47 , right ) format ( old_sounds [ soundsnum ], 47 , left ) sounds_team [ soundsnum ]= team soundsnum ++ } } else { log_amx ( "Invalid File: ^" % s ^ " (Line %d of new_weapons.ini)" , right , i + 1 ) } } else { log_amx ( "File Inexistent: ^" % s ^ " (Line %d of new_weapons.ini)" , right , i + 1 ) } /*if(!file_exists(left)) { log_amx("Warning: File Inexistent: ^"%s^" (Line %d of new_weapons.ini). ONLY A WARNING. PLUGIN WILL STILL WORK!!!!",left,i+1) }*/ } } } } public menu ( id ) { new menu = menu_create ( "Menu" , "h_menu" ); menu_additem ( menu , g_bModels [ id ] ? "Modelos armas : ACTIVADO" : "Modelos armas : DESACTIVADO" , "1" ) menu_setprop ( id , menu , 0 ) } public h_menu ( id , menu , item ) { menu_destroy ( menu ); if( item == MENU_EXIT ) return; switch( item ) { case 0 : { g_bModels [ id ] = ! g_bModels [ id ] } } } public Changeweapon_Hook ( id ) { if(! is_user_alive ( id ) || ! g_bModels [ id ]) { return PLUGIN_CONTINUE } static model [ 32 ], i , team team = get_user_team ( id ) pev ( id , pev_viewmodel2 , model , 31 ) for( i = 0 ; i < v_modelsnum ; i ++) { if( equali ( model , old_v_models [ i ])) { if( v_models_team [ i ]== team || ! v_models_team [ i ]) { set_pev ( id , pev_viewmodel2 , new_v_models [ i ]) break; } } } pev ( id , pev_weaponmodel2 , model , 31 ) for( i = 0 ; i < p_modelsnum ; i ++) { if( equali ( model , old_p_models [ i ])) { if( p_models_team [ i ]== team || ! p_models_team [ i ]) { set_pev ( id , pev_weaponmodel2 , new_p_models [ i ]) break; } } } return PLUGIN_CONTINUE } public Sound_Hook ( id , channel , sample []) { if(! is_user_alive ( id )) { return FMRES_IGNORED } if( channel != CHAN_WEAPON && channel != CHAN_ITEM ) { return FMRES_IGNORED } static i , team team = get_user_team ( id ) for( i = 0 ; i < soundsnum ; i ++) { if( equali ( sample , old_sounds [ i ])) { if( sounds_team [ i ]== team || ! sounds_team [ i ]) { engfunc ( EngFunc_EmitSound , id , CHAN_WEAPON , new_sounds [ i ], 1.0 , ATTN_NORM , 0 , PITCH_NORM ) return FMRES_SUPERCEDE } } } return FMRES_IGNORED } public W_Model_Hook ( ent , model []) { if(! pev_valid ( ent )) { return FMRES_IGNORED } static i for( i = 0 ; i < w_modelsnum ; i ++) { if( equali ( model , old_w_models [ i ]) && g_bModels [ i ]) { engfunc ( EngFunc_SetModel , ent , new_w_models [ i ]) return FMRES_SUPERCEDE } } return FMRES_IGNORED } public newround () { static ent , classname [ 8 ], model [ 32 ] ent = engfunc ( EngFunc_FindEntityInSphere , maxplayers , Float :{ 0.0 , 0.0 , 0.0 }, 4800.0 ) while( ent ) { if( pev_valid ( ent )) { pev ( ent , pev_classname , classname , 7 ) if( containi ( classname , "armoury" )!=- 1 ) { pev ( ent , pev_model , model , 31 ) W_Model_Hook ( ent , model ) } } ent = engfunc ( EngFunc_FindEntityInSphere , ent , Float :{ 0.0 , 0.0 , 0.0 }, 4800.0 ) } }
No me funciono
Mensajes: 466
Temas: 36
Registro en: Jan 2014
Reputación:
5
Proba:
Código PHP:
#define VERSION "1.3" #include <amxmodx> #include <amxmisc> #include <fakemeta> #define MAX_SOUNDS 50 #define MAX_p_MODELS 50 #define MAX_v_MODELS 50 #define MAX_w_MODELS 50 #define MAP_CONFIGS 1 new new_sounds [ MAX_SOUNDS ][ 48 ] new old_sounds [ MAX_SOUNDS ][ 48 ] new sounds_team [ MAX_SOUNDS ] new soundsnum new new_p_models [ MAX_p_MODELS ][ 48 ] new old_p_models [ MAX_p_MODELS ][ 48 ] new p_models_team [ MAX_p_MODELS ] new p_modelsnum new new_v_models [ MAX_v_MODELS ][ 48 ] new old_v_models [ MAX_v_MODELS ][ 48 ] new v_models_team [ MAX_p_MODELS ] new v_modelsnum new new_w_models [ MAX_w_MODELS ][ 48 ] new old_w_models [ MAX_w_MODELS ][ 48 ] new w_models_team [ MAX_p_MODELS ] new w_modelsnum new maxplayers new gTurnModels [ 33 ]; public plugin_init () { register_plugin ( "Weapon Model + Sound Replacement" , VERSION , "GHW_Chronic" ) register_forward ( FM_EmitSound , "Sound_Hook" ) register_forward ( FM_SetModel , "W_Model_Hook" , 1 ) register_logevent ( "newround" , 2 , "1=Round_Start" ) register_clcmd ( "say /models" , "cmd_saymodels" ); register_event ( "CurWeapon" , "Changeweapon_Hook" , "be" , "1=1" ) maxplayers = get_maxplayers () } public plugin_precache () { new configfile [ 200 ] new configsdir [ 200 ] new map [ 32 ] get_configsdir ( configsdir , 199 ) get_mapname ( map , 31 ) format ( configfile , 199 , "%s/new_weapons_%s.ini" , configsdir , map ) if( file_exists ( configfile )) { load_models ( configfile ) } else { format ( configfile , 199 , "%s/new_weapons.ini" , configsdir ) load_models ( configfile ) } } public cmd_saymodels ( id ) { new gTitle [ 150 ]; new gMenu ; formatex ( gTitle , charsmax ( gTitle ), "Menu Models" ); gMenu = menu_create ( gTitle , "handled_menumodels" ); menu_additem ( gMenu , "Activar" , "1" , 0 , menu_makecallback ( "check_turn" )); menu_additem ( gMenu , "Desactivar" , "2" , 0 , menu_makecallback ( "check_turn" )); menu_display ( id , gMenu , 0 ); } public check_turn ( id , menu , item ) { if(! item ) return ( gTurnModels [ id ] == 1 ) ? ITEM_DISABLED : ITEM_ENABLED ; else return ( gTurnModels [ id ] == 0 ) ? ITEM_DISABLED : ITEM_ENABLED ; } public handled_menumodels ( id , menu , item ) { if( item == MENU_EXIT ) { menu_destroy ( menu ); return PLUGIN_HANDLED ; } switch( item ) { case 0 : { gTurnModels [ id ] = 1 } case 1 : { gTurnModels [ id ] = 0 ; } } return PLUGIN_HANDLED ; } public load_models ( configfile []) { if( file_exists ( configfile )) { new read [ 96 ], left [ 48 ], right [ 48 ], right2 [ 32 ], trash , team for(new i = 0 ; i < file_size ( configfile , 1 ); i ++) { read_file ( configfile , i , read , 95 , trash ) if( containi ( read , ";" )!= 0 && containi ( read , " " )!=- 1 ) { argbreak ( read , left , 47 , right , 47 ) team = 0 if( containi ( right , " " )!=- 1 ) { argbreak ( right , right , 47 , right2 , 31 ) replace_all ( right2 , 31 , "^"","") if( equali(right2," T ") || equali(right2," Terrorist ") || equali(right2," Terrorists ") || equali(right2," Blue ") || equali(right2,"B") || equali(right2," Allies ") || equali(right2," 1 ") ) team=1 else if ( equali(right2," CT ") || equali(right2," Counter ") || equali(right2," Counter - Terrorist ") || equali(right2," Counter - Terrorists ") || equali(right2," CounterTerrorists ") || equali(right2," CounterTerrorist ") || equali(right2," Red ") || equali(right2," R ") || equali(right2," Axis ") || equali(right2," 2 ") ) team=2 else if ( equali(right2," Yellow ") || equali(right2," Y ") || equali(right2," 3 ") ) team=3 else if ( equali(right2," Green ") || equali(right2," G ") || equali(right2," 4 ") ) team=4 } replace_all(right,47," ^ "" , "" ) if( file_exists ( right )) { if( containi ( right , ".mdl" )== strlen ( right )- 4 ) { if(! precache_model ( right )) { log_amx ( "Error attempting to precache model: ^" % s ^ " (Line %d of new_weapons.ini)" , right , i + 1 ) } else if( containi ( left , "models/p_" )== 0 ) { format ( new_p_models [ p_modelsnum ], 47 , right ) format ( old_p_models [ p_modelsnum ], 47 , left ) p_models_team [ p_modelsnum ]= team p_modelsnum ++ } else if( containi ( left , "models/v_" )== 0 ) { format ( new_v_models [ v_modelsnum ], 47 , right ) format ( old_v_models [ v_modelsnum ], 47 , left ) v_models_team [ v_modelsnum ]= team v_modelsnum ++ } else if( containi ( left , "models/w_" )== 0 ) { format ( new_w_models [ w_modelsnum ], 47 , right ) format ( old_w_models [ w_modelsnum ], 47 , left ) w_models_team [ w_modelsnum ]= team w_modelsnum ++ } else { log_amx ( "Model type(p_ / v_ / w_) unknown for model: ^" % s ^ " (Line %d of new_weapons.ini)" , right , i + 1 ) } } else if( containi ( right , ".wav" )== strlen ( right )- 4 || containi ( right , ".mp3" )== strlen ( right )- 4 ) { replace ( right , 47 , "sound/" , "" ) replace ( left , 47 , "sound/" , "" ) if(! precache_sound ( right )) { log_amx ( "Error attempting to precache sound: ^" % s ^ " (Line %d of new_weapons.ini)" , right , i + 1 ) } else { format ( new_sounds [ soundsnum ], 47 , right ) format ( old_sounds [ soundsnum ], 47 , left ) sounds_team [ soundsnum ]= team soundsnum ++ } } else { log_amx ( "Invalid File: ^" % s ^ " (Line %d of new_weapons.ini)" , right , i + 1 ) } } else { log_amx ( "File Inexistent: ^" % s ^ " (Line %d of new_weapons.ini)" , right , i + 1 ) } /*if(!file_exists(left)) { log_amx("Warning: File Inexistent: ^"%s^" (Line %d of new_weapons.ini). ONLY A WARNING. PLUGIN WILL STILL WORK!!!!",left,i+1) }*/ } } } } public Changeweapon_Hook ( id ) { if(! is_user_alive ( id ) && ! gTurnModels [ id ]) { return PLUGIN_CONTINUE } static model [ 32 ], i , team team = get_user_team ( id ) pev ( id , pev_viewmodel2 , model , 31 ) for( i = 0 ; i < v_modelsnum ; i ++) { if( equali ( model , old_v_models [ i ])) { if( v_models_team [ i ]== team || ! v_models_team [ i ]) { set_pev ( id , pev_viewmodel2 , new_v_models [ i ]) break; } } } pev ( id , pev_weaponmodel2 , model , 31 ) for( i = 0 ; i < p_modelsnum ; i ++) { if( equali ( model , old_p_models [ i ])) { if( p_models_team [ i ]== team || ! p_models_team [ i ]) { set_pev ( id , pev_weaponmodel2 , new_p_models [ i ]) break; } } } return PLUGIN_CONTINUE } public Sound_Hook ( id , channel , sample []) { if(! is_user_alive ( id ) && ! gTurnModels [ id ]) { return FMRES_IGNORED } if( channel != CHAN_WEAPON && channel != CHAN_ITEM ) { return FMRES_IGNORED } static i , team team = get_user_team ( id ) for( i = 0 ; i < soundsnum ; i ++) { if( equali ( sample , old_sounds [ i ])) { if( sounds_team [ i ]== team || ! sounds_team [ i ]) { engfunc ( EngFunc_EmitSound , id , CHAN_WEAPON , new_sounds [ i ], 1.0 , ATTN_NORM , 0 , PITCH_NORM ) return FMRES_SUPERCEDE } } } return FMRES_IGNORED } public W_Model_Hook ( ent , model []) { if(! pev_valid ( ent )) { return FMRES_IGNORED } static i for( i = 0 ; i < w_modelsnum ; i ++) { if( equali ( model , old_w_models [ i ])) { engfunc ( EngFunc_SetModel , ent , new_w_models [ i ]) return FMRES_SUPERCEDE } } return FMRES_IGNORED } public newround () { static ent , classname [ 8 ], model [ 32 ] ent = engfunc ( EngFunc_FindEntityInSphere , maxplayers , Float :{ 0.0 , 0.0 , 0.0 }, 4800.0 ) while( ent ) { if( pev_valid ( ent )) { pev ( ent , pev_classname , classname , 7 ) if( containi ( classname , "armoury" )!=- 1 ) { pev ( ent , pev_model , model , 31 ) W_Model_Hook ( ent , model ) } } ent = engfunc ( EngFunc_FindEntityInSphere , ent , Float :{ 0.0 , 0.0 , 0.0 }, 4800.0 ) } }
(12/03/2014, 08:11 PM) roccoxx escribió: jajajajajajajajajajajajajajajaajajajajajaajajajajajajajajajajajajajajajajajajajajajajajajajjajajjajajajajaja
todo eso elevado a la quinta potencia.
Mensajes: 104
Temas: 42
Registro en: Mar 2020
Reputación:
0
(12/10/2020, 09:58 PM) acetatomil escribió: Proba:
Código PHP:
#define VERSION "1.3" #include <amxmodx> #include <amxmisc> #include <fakemeta> #define MAX_SOUNDS 50 #define MAX_p_MODELS 50 #define MAX_v_MODELS 50 #define MAX_w_MODELS 50 #define MAP_CONFIGS 1 new new_sounds [ MAX_SOUNDS ][ 48 ] new old_sounds [ MAX_SOUNDS ][ 48 ] new sounds_team [ MAX_SOUNDS ] new soundsnum new new_p_models [ MAX_p_MODELS ][ 48 ] new old_p_models [ MAX_p_MODELS ][ 48 ] new p_models_team [ MAX_p_MODELS ] new p_modelsnum new new_v_models [ MAX_v_MODELS ][ 48 ] new old_v_models [ MAX_v_MODELS ][ 48 ] new v_models_team [ MAX_p_MODELS ] new v_modelsnum new new_w_models [ MAX_w_MODELS ][ 48 ] new old_w_models [ MAX_w_MODELS ][ 48 ] new w_models_team [ MAX_p_MODELS ] new w_modelsnum new maxplayers new gTurnModels [ 33 ]; public plugin_init () { register_plugin ( "Weapon Model + Sound Replacement" , VERSION , "GHW_Chronic" ) register_forward ( FM_EmitSound , "Sound_Hook" ) register_forward ( FM_SetModel , "W_Model_Hook" , 1 ) register_logevent ( "newround" , 2 , "1=Round_Start" ) register_clcmd ( "say /models" , "cmd_saymodels" ); register_event ( "CurWeapon" , "Changeweapon_Hook" , "be" , "1=1" ) maxplayers = get_maxplayers () } public plugin_precache () { new configfile [ 200 ] new configsdir [ 200 ] new map [ 32 ] get_configsdir ( configsdir , 199 ) get_mapname ( map , 31 ) format ( configfile , 199 , "%s/new_weapons_%s.ini" , configsdir , map ) if( file_exists ( configfile )) { load_models ( configfile ) } else { format ( configfile , 199 , "%s/new_weapons.ini" , configsdir ) load_models ( configfile ) } } public cmd_saymodels ( id ) { new gTitle [ 150 ]; new gMenu ; formatex ( gTitle , charsmax ( gTitle ), "Menu Models" ); gMenu = menu_create ( gTitle , "handled_menumodels" ); menu_additem ( gMenu , "Activar" , "1" , 0 , menu_makecallback ( "check_turn" )); menu_additem ( gMenu , "Desactivar" , "2" , 0 , menu_makecallback ( "check_turn" )); menu_display ( id , gMenu , 0 ); } public check_turn ( id , menu , item ) { if(! item ) return ( gTurnModels [ id ] == 1 ) ? ITEM_DISABLED : ITEM_ENABLED ; else return ( gTurnModels [ id ] == 0 ) ? ITEM_DISABLED : ITEM_ENABLED ; } public handled_menumodels ( id , menu , item ) { if( item == MENU_EXIT ) { menu_destroy ( menu ); return PLUGIN_HANDLED ; } switch( item ) { case 0 : { gTurnModels [ id ] = 1 } case 1 : { gTurnModels [ id ] = 0 ; } } return PLUGIN_HANDLED ; } public load_models ( configfile []) { if( file_exists ( configfile )) { new read [ 96 ], left [ 48 ], right [ 48 ], right2 [ 32 ], trash , team for(new i = 0 ; i < file_size ( configfile , 1 ); i ++) { read_file ( configfile , i , read , 95 , trash ) if( containi ( read , ";" )!= 0 && containi ( read , " " )!=- 1 ) { argbreak ( read , left , 47 , right , 47 ) team = 0 if( containi ( right , " " )!=- 1 ) { argbreak ( right , right , 47 , right2 , 31 ) replace_all ( right2 , 31 , "^"","") if( equali(right2," T ") || equali(right2," Terrorist ") || equali(right2," Terrorists ") || equali(right2," Blue ") || equali(right2,"B") || equali(right2," Allies ") || equali(right2," 1 ") ) team=1 else if ( equali(right2," CT ") || equali(right2," Counter ") || equali(right2," Counter - Terrorist ") || equali(right2," Counter - Terrorists ") || equali(right2," CounterTerrorists ") || equali(right2," CounterTerrorist ") || equali(right2," Red ") || equali(right2," R ") || equali(right2," Axis ") || equali(right2," 2 ") ) team=2 else if ( equali(right2," Yellow ") || equali(right2," Y ") || equali(right2," 3 ") ) team=3 else if ( equali(right2," Green ") || equali(right2," G ") || equali(right2," 4 ") ) team=4 } replace_all(right,47," ^ "" , "" ) if( file_exists ( right )) { if( containi ( right , ".mdl" )== strlen ( right )- 4 ) { if(! precache_model ( right )) { log_amx ( "Error attempting to precache model: ^" % s ^ " (Line %d of new_weapons.ini)" , right , i + 1 ) } else if( containi ( left , "models/p_" )== 0 ) { format ( new_p_models [ p_modelsnum ], 47 , right ) format ( old_p_models [ p_modelsnum ], 47 , left ) p_models_team [ p_modelsnum ]= team p_modelsnum ++ } else if( containi ( left , "models/v_" )== 0 ) { format ( new_v_models [ v_modelsnum ], 47 , right ) format ( old_v_models [ v_modelsnum ], 47 , left ) v_models_team [ v_modelsnum ]= team v_modelsnum ++ } else if( containi ( left , "models/w_" )== 0 ) { format ( new_w_models [ w_modelsnum ], 47 , right ) format ( old_w_models [ w_modelsnum ], 47 , left ) w_models_team [ w_modelsnum ]= team w_modelsnum ++ } else { log_amx ( "Model type(p_ / v_ / w_) unknown for model: ^" % s ^ " (Line %d of new_weapons.ini)" , right , i + 1 ) } } else if( containi ( right , ".wav" )== strlen ( right )- 4 || containi ( right , ".mp3" )== strlen ( right )- 4 ) { replace ( right , 47 , "sound/" , "" ) replace ( left , 47 , "sound/" , "" ) if(! precache_sound ( right )) { log_amx ( "Error attempting to precache sound: ^" % s ^ " (Line %d of new_weapons.ini)" , right , i + 1 ) } else { format ( new_sounds [ soundsnum ], 47 , right ) format ( old_sounds [ soundsnum ], 47 , left ) sounds_team [ soundsnum ]= team soundsnum ++ } } else { log_amx ( "Invalid File: ^" % s ^ " (Line %d of new_weapons.ini)" , right , i + 1 ) } } else { log_amx ( "File Inexistent: ^" % s ^ " (Line %d of new_weapons.ini)" , right , i + 1 ) } /*if(!file_exists(left)) { log_amx("Warning: File Inexistent: ^"%s^" (Line %d of new_weapons.ini). ONLY A WARNING. PLUGIN WILL STILL WORK!!!!",left,i+1) }*/ } } } } public Changeweapon_Hook ( id ) { if(! is_user_alive ( id ) && ! gTurnModels [ id ]) { return PLUGIN_CONTINUE } static model [ 32 ], i , team team = get_user_team ( id ) pev ( id , pev_viewmodel2 , model , 31 ) for( i = 0 ; i < v_modelsnum ; i ++) { if( equali ( model , old_v_models [ i ])) { if( v_models_team [ i ]== team || ! v_models_team [ i ]) { set_pev ( id , pev_viewmodel2 , new_v_models [ i ]) break; } } } pev ( id , pev_weaponmodel2 , model , 31 ) for( i = 0 ; i < p_modelsnum ; i ++) { if( equali ( model , old_p_models [ i ])) { if( p_models_team [ i ]== team || ! p_models_team [ i ]) { set_pev ( id , pev_weaponmodel2 , new_p_models [ i ]) break; } } } return PLUGIN_CONTINUE } public Sound_Hook ( id , channel , sample []) { if(! is_user_alive ( id ) && ! gTurnModels [ id ]) { return FMRES_IGNORED } if( channel != CHAN_WEAPON && channel != CHAN_ITEM ) { return FMRES_IGNORED } static i , team team = get_user_team ( id ) for( i = 0 ; i < soundsnum ; i ++) { if( equali ( sample , old_sounds [ i ])) { if( sounds_team [ i ]== team || ! sounds_team [ i ]) { engfunc ( EngFunc_EmitSound , id , CHAN_WEAPON , new_sounds [ i ], 1.0 , ATTN_NORM , 0 , PITCH_NORM ) return FMRES_SUPERCEDE } } } return FMRES_IGNORED } public W_Model_Hook ( ent , model []) { if(! pev_valid ( ent )) { return FMRES_IGNORED } static i for( i = 0 ; i < w_modelsnum ; i ++) { if( equali ( model , old_w_models [ i ])) { engfunc ( EngFunc_SetModel , ent , new_w_models [ i ]) return FMRES_SUPERCEDE } } return FMRES_IGNORED } public newround () { static ent , classname [ 8 ], model [ 32 ] ent = engfunc ( EngFunc_FindEntityInSphere , maxplayers , Float :{ 0.0 , 0.0 , 0.0 }, 4800.0 ) while( ent ) { if( pev_valid ( ent )) { pev ( ent , pev_classname , classname , 7 ) if( containi ( classname , "armoury" )!=- 1 ) { pev ( ent , pev_model , model , 31 ) W_Model_Hook ( ent , model ) } } ent = engfunc ( EngFunc_FindEntityInSphere , ent , Float :{ 0.0 , 0.0 , 0.0 }, 4800.0 ) } }
Me da error
Código:
Warning: Function "check_turn" should return a value on line 88
Error: Undefined symbol "argbreak" on line 121
Error: Undefined symbol "argbreak" on line 125
Warning: Loose indentation on line 175
Warning: Loose indentation on line 201
Warning: Loose indentation on line 222
Mensajes: 25
Temas: 3
Registro en: Jul 2020
Reputación:
0
12/10/2020, 10:48 PM
(Última modificación: 12/10/2020, 10:59 PM por gh0st . Edited 1 time in total.
Razón: me equivoque en algo pequeño
)
Prueba esto
Código PHP:
/* * _______ _ _ __ __ * | _____/ | | | | \ \ __ / / * | | | | | | | | / \ | | * | | | |____| | | |/ __ \| | * | | ___ | ______ | | / \ | * | | |_ | | | | | | / \ | * | | | | | | | | | | | | * | |____| | | | | | | | | | * |_______/ |_| |_| \_/ \_/ * * * * Last Edited: 06-12-08 * * ============ * Changelog: * ============ * * v1.3 * -Bug Fixes * * v1.0 * -Initial Release * */ #define VERSION "1.3" #include <amxmodx> #include <amxmisc> #include <fakemeta> #define MAX_SOUNDS 50 #define MAX_p_MODELS 50 #define MAX_v_MODELS 50 #define MAX_w_MODELS 50 #define MAP_CONFIGS 1 new new_sounds [ MAX_SOUNDS ][ 48 ] new old_sounds [ MAX_SOUNDS ][ 48 ] new sounds_team [ MAX_SOUNDS ] new soundsnum new new_p_models [ MAX_p_MODELS ][ 48 ] new old_p_models [ MAX_p_MODELS ][ 48 ] new p_models_team [ MAX_p_MODELS ] new p_modelsnum new new_v_models [ MAX_v_MODELS ][ 48 ] new old_v_models [ MAX_v_MODELS ][ 48 ] new v_models_team [ MAX_p_MODELS ] new v_modelsnum new new_w_models [ MAX_w_MODELS ][ 48 ] new old_w_models [ MAX_w_MODELS ][ 48 ] new w_models_team [ MAX_p_MODELS ] new w_modelsnum new maxplayers new bool : g_bModels [ 33 ] public plugin_init () { register_plugin ( "Weapon Model + Sound Replacement" , VERSION , "GHW_Chronic" ) register_forward ( FM_EmitSound , "Sound_Hook" ) register_forward ( FM_SetModel , "W_Model_Hook" , 1 ) register_logevent ( "newround" , 2 , "1=Round_Start" ) register_event ( "CurWeapon" , "Changeweapon_Hook" , "be" , "1=1" ) register_clcmd ( "say /models" , "cmdMenu" ) maxplayers = get_maxplayers () } public client_putinserver ( id ) { g_bModels [ id ] = true ; } public plugin_precache () { new configfile [ 200 ] new configsdir [ 200 ] new map [ 32 ] get_configsdir ( configsdir , 199 ) get_mapname ( map , 31 ) format ( configfile , 199 , "%s/new_weapons_%s.ini" , configsdir , map ) if( file_exists ( configfile )) { load_models ( configfile ) } else { format ( configfile , 199 , "%s/new_weapons.ini" , configsdir ) load_models ( configfile ) } } public load_models ( configfile []) { if( file_exists ( configfile )) { new read [ 96 ], left [ 48 ], right [ 48 ], right2 [ 32 ], trash , team for(new i = 0 ; i < file_size ( configfile , 1 ); i ++) { read_file ( configfile , i , read , 95 , trash ) if( containi ( read , ";" )!= 0 && containi ( read , " " )!=- 1 ) { strbreak ( read , left , 47 , right , 47 ) team = 0 if( containi ( right , " " )!=- 1 ) { strbreak ( right , right , 47 , right2 , 31 ) replace_all ( right2 , 31 , "^"","") if( equali(right2," T ") || equali(right2," Terrorist ") || equali(right2," Terrorists ") || equali(right2," Blue ") || equali(right2,"B") || equali(right2," Allies ") || equali(right2," 1 ") ) team=1 else if( equali(right2," CT ") || equali(right2," Counter ") || equali(right2," Counter - Terrorist ") || equali(right2," Counter - Terrorists ") || equali(right2," CounterTerrorists ") || equali(right2," CounterTerrorist ") || equali(right2," Red ") || equali(right2," R ") || equali(right2," Axis ") || equali(right2," 2 ") ) team=2 else if( equali(right2," Yellow ") || equali(right2," Y ") || equali(right2," 3 ") ) team=3 else if( equali(right2," Green ") || equali(right2," G ") || equali(right2," 4 ") ) team=4 } replace_all(right,47," ^ "" , "" ) if( file_exists ( right )) { if( containi ( right , ".mdl" )== strlen ( right )- 4 ) { if(! precache_model ( right )) { log_amx ( "Error attempting to precache model: ^" % s ^ " (Line %d of new_weapons.ini)" , right , i + 1 ) } else if( containi ( left , "models/p_" )== 0 ) { format ( new_p_models [ p_modelsnum ], 47 , right ) format ( old_p_models [ p_modelsnum ], 47 , left ) p_models_team [ p_modelsnum ]= team p_modelsnum ++ } else if( containi ( left , "models/v_" )== 0 ) { format ( new_v_models [ v_modelsnum ], 47 , right ) format ( old_v_models [ v_modelsnum ], 47 , left ) v_models_team [ v_modelsnum ]= team v_modelsnum ++ } else if( containi ( left , "models/w_" )== 0 ) { format ( new_w_models [ w_modelsnum ], 47 , right ) format ( old_w_models [ w_modelsnum ], 47 , left ) w_models_team [ w_modelsnum ]= team w_modelsnum ++ } else { log_amx ( "Model type(p_ / v_ / w_) unknown for model: ^" % s ^ " (Line %d of new_weapons.ini)" , right , i + 1 ) } } else if( containi ( right , ".wav" )== strlen ( right )- 4 || containi ( right , ".mp3" )== strlen ( right )- 4 ) { replace ( right , 47 , "sound/" , "" ) replace ( left , 47 , "sound/" , "" ) if(! precache_sound ( right )) { log_amx ( "Error attempting to precache sound: ^" % s ^ " (Line %d of new_weapons.ini)" , right , i + 1 ) } else { format ( new_sounds [ soundsnum ], 47 , right ) format ( old_sounds [ soundsnum ], 47 , left ) sounds_team [ soundsnum ]= team soundsnum ++ } } else { log_amx ( "Invalid File: ^" % s ^ " (Line %d of new_weapons.ini)" , right , i + 1 ) } } else { log_amx ( "File Inexistent: ^" % s ^ " (Line %d of new_weapons.ini)" , right , i + 1 ) } /*if(!file_exists(left)) { log_amx("Warning: File Inexistent: ^"%s^" (Line %d of new_weapons.ini). ONLY A WARNING. PLUGIN WILL STILL WORK!!!!",left,i+1) }*/ } } } } public Changeweapon_Hook ( id ) { if(! is_user_alive ( id ) && ! g_bModels [ id ]) { return PLUGIN_CONTINUE } static model [ 32 ], i , team team = get_user_team ( id ) pev ( id , pev_viewmodel2 , model , 31 ) for( i = 0 ; i < v_modelsnum ; i ++) { if( equali ( model , old_v_models [ i ])) { if( v_models_team [ i ]== team || ! v_models_team [ i ]) { set_pev ( id , pev_viewmodel2 , new_v_models [ i ]) break; } } } pev ( id , pev_weaponmodel2 , model , 31 ) for( i = 0 ; i < p_modelsnum ; i ++) { if( equali ( model , old_p_models [ i ])) { if( p_models_team [ i ]== team || ! p_models_team [ i ]) { set_pev ( id , pev_weaponmodel2 , new_p_models [ i ]) break; } } } return PLUGIN_CONTINUE } public Sound_Hook ( id , channel , sample []) { if(! is_user_alive ( id )) { return FMRES_IGNORED } if( channel != CHAN_WEAPON && channel != CHAN_ITEM ) { return FMRES_IGNORED } static i , team team = get_user_team ( id ) for( i = 0 ; i < soundsnum ; i ++) { if( equali ( sample , old_sounds [ i ])) { if( sounds_team [ i ]== team || ! sounds_team [ i ]) { engfunc ( EngFunc_EmitSound , id , CHAN_WEAPON , new_sounds [ i ], 1.0 , ATTN_NORM , 0 , PITCH_NORM ) return FMRES_SUPERCEDE } } } return FMRES_IGNORED } public W_Model_Hook ( ent , model []) { if(! pev_valid ( ent )) { return FMRES_IGNORED } static i for( i = 0 ; i < w_modelsnum ; i ++) { if( equali ( model , old_w_models [ i ]) && g_bModels [ i ]) { engfunc ( EngFunc_SetModel , ent , new_w_models [ i ]) return FMRES_SUPERCEDE } } return FMRES_IGNORED } public newround () { static ent , classname [ 8 ], model [ 32 ] ent = engfunc ( EngFunc_FindEntityInSphere , maxplayers , Float :{ 0.0 , 0.0 , 0.0 }, 4800.0 ) while( ent ) { if( pev_valid ( ent )) { pev ( ent , pev_classname , classname , 7 ) if( containi ( classname , "armoury" )!=- 1 ) { pev ( ent , pev_model , model , 31 ) W_Model_Hook ( ent , model ) } } ent = engfunc ( EngFunc_FindEntityInSphere , ent , Float :{ 0.0 , 0.0 , 0.0 }, 4800.0 ) } } public cmdMenu ( id ) { new menu = menu_create ( "Menu" , "h_menu" ); menu_additem ( menu , g_bModels [ id ] ? "Modelos armas : ACTIVADO" : "Modelos armas : DESACTIVADO" , "1" ) menu_display ( id , menu , 0 ) } public h_menu ( id , menu , item ) { menu_destroy ( menu ); if( item == MENU_EXIT ) return; switch( item ) { case 0 : { g_bModels [ id ] = ! g_bModels [ id ] cmdMenu ( id ) } } }
Mensajes: 104
Temas: 42
Registro en: Mar 2020
Reputación:
0
(12/10/2020, 10:48 PM) gh0st escribió: Prueba esto
Código PHP:
/* * _______ _ _ __ __ * | _____/ | | | | \ \ __ / / * | | | | | | | | / \ | | * | | | |____| | | |/ __ \| | * | | ___ | ______ | | / \ | * | | |_ | | | | | | / \ | * | | | | | | | | | | | | * | |____| | | | | | | | | | * |_______/ |_| |_| \_/ \_/ * * * * Last Edited: 06-12-08 * * ============ * Changelog: * ============ * * v1.3 * -Bug Fixes * * v1.0 * -Initial Release * */ #define VERSION "1.3" #include <amxmodx> #include <amxmisc> #include <fakemeta> #define MAX_SOUNDS 50 #define MAX_p_MODELS 50 #define MAX_v_MODELS 50 #define MAX_w_MODELS 50 #define MAP_CONFIGS 1 new new_sounds [ MAX_SOUNDS ][ 48 ] new old_sounds [ MAX_SOUNDS ][ 48 ] new sounds_team [ MAX_SOUNDS ] new soundsnum new new_p_models [ MAX_p_MODELS ][ 48 ] new old_p_models [ MAX_p_MODELS ][ 48 ] new p_models_team [ MAX_p_MODELS ] new p_modelsnum new new_v_models [ MAX_v_MODELS ][ 48 ] new old_v_models [ MAX_v_MODELS ][ 48 ] new v_models_team [ MAX_p_MODELS ] new v_modelsnum new new_w_models [ MAX_w_MODELS ][ 48 ] new old_w_models [ MAX_w_MODELS ][ 48 ] new w_models_team [ MAX_p_MODELS ] new w_modelsnum new maxplayers new bool : g_bModels [ 33 ] public plugin_init () { register_plugin ( "Weapon Model + Sound Replacement" , VERSION , "GHW_Chronic" ) register_forward ( FM_EmitSound , "Sound_Hook" ) register_forward ( FM_SetModel , "W_Model_Hook" , 1 ) register_logevent ( "newround" , 2 , "1=Round_Start" ) register_event ( "CurWeapon" , "Changeweapon_Hook" , "be" , "1=1" ) register_clcmd ( "say /models" , "cmdMenu" ) maxplayers = get_maxplayers () } public client_putinserver ( id ) { g_bModels [ id ] = true ; } public plugin_precache () { new configfile [ 200 ] new configsdir [ 200 ] new map [ 32 ] get_configsdir ( configsdir , 199 ) get_mapname ( map , 31 ) format ( configfile , 199 , "%s/new_weapons_%s.ini" , configsdir , map ) if( file_exists ( configfile )) { load_models ( configfile ) } else { format ( configfile , 199 , "%s/new_weapons.ini" , configsdir ) load_models ( configfile ) } } public load_models ( configfile []) { if( file_exists ( configfile )) { new read [ 96 ], left [ 48 ], right [ 48 ], right2 [ 32 ], trash , team for(new i = 0 ; i < file_size ( configfile , 1 ); i ++) { read_file ( configfile , i , read , 95 , trash ) if( containi ( read , ";" )!= 0 && containi ( read , " " )!=- 1 ) { strbreak ( read , left , 47 , right , 47 ) team = 0 if( containi ( right , " " )!=- 1 ) { strbreak ( right , right , 47 , right2 , 31 ) replace_all ( right2 , 31 , "^"","") if( equali(right2," T ") || equali(right2," Terrorist ") || equali(right2," Terrorists ") || equali(right2," Blue ") || equali(right2,"B") || equali(right2," Allies ") || equali(right2," 1 ") ) team=1 else if( equali(right2," CT ") || equali(right2," Counter ") || equali(right2," Counter - Terrorist ") || equali(right2," Counter - Terrorists ") || equali(right2," CounterTerrorists ") || equali(right2," CounterTerrorist ") || equali(right2," Red ") || equali(right2," R ") || equali(right2," Axis ") || equali(right2," 2 ") ) team=2 else if( equali(right2," Yellow ") || equali(right2," Y ") || equali(right2," 3 ") ) team=3 else if( equali(right2," Green ") || equali(right2," G ") || equali(right2," 4 ") ) team=4 } replace_all(right,47," ^ "" , "" ) if( file_exists ( right )) { if( containi ( right , ".mdl" )== strlen ( right )- 4 ) { if(! precache_model ( right )) { log_amx ( "Error attempting to precache model: ^" % s ^ " (Line %d of new_weapons.ini)" , right , i + 1 ) } else if( containi ( left , "models/p_" )== 0 ) { format ( new_p_models [ p_modelsnum ], 47 , right ) format ( old_p_models [ p_modelsnum ], 47 , left ) p_models_team [ p_modelsnum ]= team p_modelsnum ++ } else if( containi ( left , "models/v_" )== 0 ) { format ( new_v_models [ v_modelsnum ], 47 , right ) format ( old_v_models [ v_modelsnum ], 47 , left ) v_models_team [ v_modelsnum ]= team v_modelsnum ++ } else if( containi ( left , "models/w_" )== 0 ) { format ( new_w_models [ w_modelsnum ], 47 , right ) format ( old_w_models [ w_modelsnum ], 47 , left ) w_models_team [ w_modelsnum ]= team w_modelsnum ++ } else { log_amx ( "Model type(p_ / v_ / w_) unknown for model: ^" % s ^ " (Line %d of new_weapons.ini)" , right , i + 1 ) } } else if( containi ( right , ".wav" )== strlen ( right )- 4 || containi ( right , ".mp3" )== strlen ( right )- 4 ) { replace ( right , 47 , "sound/" , "" ) replace ( left , 47 , "sound/" , "" ) if(! precache_sound ( right )) { log_amx ( "Error attempting to precache sound: ^" % s ^ " (Line %d of new_weapons.ini)" , right , i + 1 ) } else { format ( new_sounds [ soundsnum ], 47 , right ) format ( old_sounds [ soundsnum ], 47 , left ) sounds_team [ soundsnum ]= team soundsnum ++ } } else { log_amx ( "Invalid File: ^" % s ^ " (Line %d of new_weapons.ini)" , right , i + 1 ) } } else { log_amx ( "File Inexistent: ^" % s ^ " (Line %d of new_weapons.ini)" , right , i + 1 ) } /*if(!file_exists(left)) { log_amx("Warning: File Inexistent: ^"%s^" (Line %d of new_weapons.ini). ONLY A WARNING. PLUGIN WILL STILL WORK!!!!",left,i+1) }*/ } } } } public Changeweapon_Hook ( id ) { if(! is_user_alive ( id ) && ! g_bModels [ id ]) { return PLUGIN_CONTINUE } static model [ 32 ], i , team team = get_user_team ( id ) pev ( id , pev_viewmodel2 , model , 31 ) for( i = 0 ; i < v_modelsnum ; i ++) { if( equali ( model , old_v_models [ i ])) { if( v_models_team [ i ]== team || ! v_models_team [ i ]) { set_pev ( id , pev_viewmodel2 , new_v_models [ i ]) break; } } } pev ( id , pev_weaponmodel2 , model , 31 ) for( i = 0 ; i < p_modelsnum ; i ++) { if( equali ( model , old_p_models [ i ])) { if( p_models_team [ i ]== team || ! p_models_team [ i ]) { set_pev ( id , pev_weaponmodel2 , new_p_models [ i ]) break; } } } return PLUGIN_CONTINUE } public Sound_Hook ( id , channel , sample []) { if(! is_user_alive ( id )) { return FMRES_IGNORED } if( channel != CHAN_WEAPON && channel != CHAN_ITEM ) { return FMRES_IGNORED } static i , team team = get_user_team ( id ) for( i = 0 ; i < soundsnum ; i ++) { if( equali ( sample , old_sounds [ i ])) { if( sounds_team [ i ]== team || ! sounds_team [ i ]) { engfunc ( EngFunc_EmitSound , id , CHAN_WEAPON , new_sounds [ i ], 1.0 , ATTN_NORM , 0 , PITCH_NORM ) return FMRES_SUPERCEDE } } } return FMRES_IGNORED } public W_Model_Hook ( ent , model []) { if(! pev_valid ( ent )) { return FMRES_IGNORED } static i for( i = 0 ; i < w_modelsnum ; i ++) { if( equali ( model , old_w_models [ i ]) && g_bModels [ i ]) { engfunc ( EngFunc_SetModel , ent , new_w_models [ i ]) return FMRES_SUPERCEDE } } return FMRES_IGNORED } public newround () { static ent , classname [ 8 ], model [ 32 ] ent = engfunc ( EngFunc_FindEntityInSphere , maxplayers , Float :{ 0.0 , 0.0 , 0.0 }, 4800.0 ) while( ent ) { if( pev_valid ( ent )) { pev ( ent , pev_classname , classname , 7 ) if( containi ( classname , "armoury" )!=- 1 ) { pev ( ent , pev_model , model , 31 ) W_Model_Hook ( ent , model ) } } ent = engfunc ( EngFunc_FindEntityInSphere , ent , Float :{ 0.0 , 0.0 , 0.0 }, 4800.0 ) } } public cmdMenu ( id ) { new menu = menu_create ( "Menu" , "h_menu" ); menu_additem ( menu , g_bModels [ id ] ? "Modelos armas : ACTIVADO" : "Modelos armas : DESACTIVADO" , "1" ) menu_display ( id , menu , 0 ) } public h_menu ( id , menu , item ) { menu_destroy ( menu ); if( item == MENU_EXIT ) return; switch( item ) { case 0 : { g_bModels [ id ] = ! g_bModels [ id ] cmdMenu ( id ) } } }
No me funciona bro
Mensajes: 144
Temas: 4
Registro en: Mar 2018
Reputación:
8
Los anteriores a simple vista deberían de funcionarte. Desconozco el motivo del por qué no. Aquí te dejo más de lo mismo, con suerte y te funciona
Código PHP:
/* * _______ _ _ __ __ * | _____/ | | | | \ \ __ / / * | | | | | | | | / \ | | * | | | |____| | | |/ __ \| | * | | ___ | ______ | | / \ | * | | |_ | | | | | | / \ | * | | | | | | | | | | | | * | |____| | | | | | | | | | * |_______/ |_| |_| \_/ \_/ * * * * Last Edited: 06-12-08 * * ============ * Changelog: * ============ * * v1.3 * -Bug Fixes * * v1.0 * -Initial Release * */ #define VERSION "1.3" #include <amxmodx> #include <amxmisc> #include <fakemeta> #define MAX_SOUNDS 50 #define MAX_p_MODELS 50 #define MAX_v_MODELS 50 #define MAX_w_MODELS 50 #define MAP_CONFIGS 1 new new_sounds [ MAX_SOUNDS ][ 48 ] new old_sounds [ MAX_SOUNDS ][ 48 ] new sounds_team [ MAX_SOUNDS ] new soundsnum new new_p_models [ MAX_p_MODELS ][ 48 ] new old_p_models [ MAX_p_MODELS ][ 48 ] new p_models_team [ MAX_p_MODELS ] new p_modelsnum new new_v_models [ MAX_v_MODELS ][ 48 ] new old_v_models [ MAX_v_MODELS ][ 48 ] new v_models_team [ MAX_p_MODELS ] new v_modelsnum new new_w_models [ MAX_w_MODELS ][ 48 ] new old_w_models [ MAX_w_MODELS ][ 48 ] new w_models_team [ MAX_p_MODELS ] new w_modelsnum new maxplayers new bool : g_Weapons [ 33 ] = true public plugin_init () { register_plugin ( "Weapon Model + Sound Replacement" , VERSION , "GHW_Chronic" ) register_forward ( FM_EmitSound , "Sound_Hook" ) register_forward ( FM_SetModel , "W_Model_Hook" , 1 ) register_logevent ( "newround" , 2 , "1=Round_Start" ) register_event ( "CurWeapon" , "Changeweapon_Hook" , "be" , "1=1" ) maxplayers = get_maxplayers () register_clcmd ( "say /skins" , "check_Skins" ) } public plugin_precache () { new configfile [ 200 ] new configsdir [ 200 ] new map [ 32 ] get_configsdir ( configsdir , 199 ) get_mapname ( map , 31 ) format ( configfile , 199 , "%s/new_weapons_%s.ini" , configsdir , map ) if( file_exists ( configfile )) { load_models ( configfile ) } else { format ( configfile , 199 , "%s/new_weapons.ini" , configsdir ) load_models ( configfile ) } } public load_models ( configfile []) { if( file_exists ( configfile )) { new read [ 96 ], left [ 48 ], right [ 48 ], right2 [ 32 ], trash , team for(new i = 0 ; i < file_size ( configfile , 1 ); i ++) { read_file ( configfile , i , read , 95 , trash ) if( containi ( read , ";" )!= 0 && containi ( read , " " )!=- 1 ) { strbreak ( read , left , 47 , right , 47 ) team = 0 if( containi ( right , " " )!=- 1 ) { strbreak ( right , right , 47 , right2 , 31 ) replace_all ( right2 , 31 , "^"","") if( equali(right2," T ") || equali(right2," Terrorist ") || equali(right2," Terrorists ") || equali(right2," Blue ") || equali(right2,"B") || equali(right2," Allies ") || equali(right2," 1 ") ) team=1 else if( equali(right2," CT ") || equali(right2," Counter ") || equali(right2," Counter - Terrorist ") || equali(right2," Counter - Terrorists ") || equali(right2," CounterTerrorists ") || equali(right2," CounterTerrorist ") || equali(right2," Red ") || equali(right2," R ") || equali(right2," Axis ") || equali(right2," 2 ") ) team=2 else if( equali(right2," Yellow ") || equali(right2," Y ") || equali(right2," 3 ") ) team=3 else if( equali(right2," Green ") || equali(right2," G ") || equali(right2," 4 ") ) team=4 } replace_all(right,47," ^ "" , "" ) if( file_exists ( right )) { if( containi ( right , ".mdl" )== strlen ( right )- 4 ) { if(! precache_model ( right )) { log_amx ( "Error attempting to precache model: ^" % s ^ " (Line %d of new_weapons.ini)" , right , i + 1 ) } else if( containi ( left , "models/p_" )== 0 ) { format ( new_p_models [ p_modelsnum ], 47 , right ) format ( old_p_models [ p_modelsnum ], 47 , left ) p_models_team [ p_modelsnum ]= team p_modelsnum ++ } else if( containi ( left , "models/v_" )== 0 ) { format ( new_v_models [ v_modelsnum ], 47 , right ) format ( old_v_models [ v_modelsnum ], 47 , left ) v_models_team [ v_modelsnum ]= team v_modelsnum ++ } else if( containi ( left , "models/w_" )== 0 ) { format ( new_w_models [ w_modelsnum ], 47 , right ) format ( old_w_models [ w_modelsnum ], 47 , left ) w_models_team [ w_modelsnum ]= team w_modelsnum ++ } else { log_amx ( "Model type(p_ / v_ / w_) unknown for model: ^" % s ^ " (Line %d of new_weapons.ini)" , right , i + 1 ) } } else if( containi ( right , ".wav" )== strlen ( right )- 4 || containi ( right , ".mp3" )== strlen ( right )- 4 ) { replace ( right , 47 , "sound/" , "" ) replace ( left , 47 , "sound/" , "" ) if(! precache_sound ( right )) { log_amx ( "Error attempting to precache sound: ^" % s ^ " (Line %d of new_weapons.ini)" , right , i + 1 ) } else { format ( new_sounds [ soundsnum ], 47 , right ) format ( old_sounds [ soundsnum ], 47 , left ) sounds_team [ soundsnum ]= team soundsnum ++ } } else { log_amx ( "Invalid File: ^" % s ^ " (Line %d of new_weapons.ini)" , right , i + 1 ) } } else { log_amx ( "File Inexistent: ^" % s ^ " (Line %d of new_weapons.ini)" , right , i + 1 ) } /*if(!file_exists(left)) { log_amx("Warning: File Inexistent: ^"%s^" (Line %d of new_weapons.ini). ONLY A WARNING. PLUGIN WILL STILL WORK!!!!",left,i+1) }*/ } } } } public Changeweapon_Hook ( id ) { if(! is_user_alive ( id ) || ! g_Weapons [ id ]) { return PLUGIN_CONTINUE } static model [ 32 ], i , team team = get_user_team ( id ) pev ( id , pev_viewmodel2 , model , 31 ) for( i = 0 ; i < v_modelsnum ; i ++) { if( equali ( model , old_v_models [ i ])) { if( v_models_team [ i ]== team || ! v_models_team [ i ]) { set_pev ( id , pev_viewmodel2 , new_v_models [ i ]) break; } } } pev ( id , pev_weaponmodel2 , model , 31 ) for( i = 0 ; i < p_modelsnum ; i ++) { if( equali ( model , old_p_models [ i ])) { if( p_models_team [ i ]== team || ! p_models_team [ i ]) { set_pev ( id , pev_weaponmodel2 , new_p_models [ i ]) break; } } } return PLUGIN_CONTINUE } public Sound_Hook ( id , channel , sample []) { if(! is_user_alive ( id ) || g_Weapons [ id ]) { return FMRES_IGNORED } if( channel != CHAN_WEAPON && channel != CHAN_ITEM ) { return FMRES_IGNORED } static i , team team = get_user_team ( id ) for( i = 0 ; i < soundsnum ; i ++) { if( equali ( sample , old_sounds [ i ])) { if( sounds_team [ i ]== team || ! sounds_team [ i ]) { engfunc ( EngFunc_EmitSound , id , CHAN_WEAPON , new_sounds [ i ], 1.0 , ATTN_NORM , 0 , PITCH_NORM ) return FMRES_SUPERCEDE } } } return FMRES_IGNORED } public W_Model_Hook ( ent , model []) { if(! pev_valid ( ent )) { return FMRES_IGNORED } static i for( i = 0 ; i < w_modelsnum ; i ++) { if( equali ( model , old_w_models [ i ])) { engfunc ( EngFunc_SetModel , ent , new_w_models [ i ]) return FMRES_SUPERCEDE } } return FMRES_IGNORED } public newround () { static ent , classname [ 8 ], model [ 32 ] ent = engfunc ( EngFunc_FindEntityInSphere , maxplayers , Float :{ 0.0 , 0.0 , 0.0 }, 4800.0 ) while( ent ) { if( pev_valid ( ent )) { pev ( ent , pev_classname , classname , 7 ) if( containi ( classname , "armoury" )!=- 1 ) { pev ( ent , pev_model , model , 31 ) W_Model_Hook ( ent , model ) } } ent = engfunc ( EngFunc_FindEntityInSphere , ent , Float :{ 0.0 , 0.0 , 0.0 }, 4800.0 ) } } public check_Skins ( id ) { switch( g_Weapons [ id ]) { case true : { client_print_color ( id , print_team_default , "^4[SKINS]^1 Las skins de las armas han sido ^4[DESACTIVADAS]^1!" ) g_Weapons [ id ] = false } case false : { client_print_color ( id , print_team_default , "^4[SKINS]^1 Las skins de las armas han sido ^4[ACTIVADAS]^1!" ) g_Weapons [ id ] = true } } return PLUGIN_HANDLED }
Mensajes: 25
Temas: 3
Registro en: Jul 2020
Reputación:
0
12/10/2020, 11:21 PM
(Última modificación: 12/10/2020, 11:24 PM por gh0st . Edited 1 time in total.)
Igual podrías explicar que es lo que no te funciona.
te digo esto ya que no explicas que es lo que no te anda y no tengo un sv para probarlo.
Mensajes: 104
Temas: 42
Registro en: Mar 2020
Reputación:
0
(12/10/2020, 11:15 PM) GabsHp escribió: Los anteriores a simple vista deberían de funcionarte. Desconozco el motivo del por qué no. Aquí te dejo más de lo mismo, con suerte y te funciona
Código PHP:
/* * _______ _ _ __ __ * | _____/ | | | | \ \ __ / / * | | | | | | | | / \ | | * | | | |____| | | |/ __ \| | * | | ___ | ______ | | / \ | * | | |_ | | | | | | / \ | * | | | | | | | | | | | | * | |____| | | | | | | | | | * |_______/ |_| |_| \_/ \_/ * * * * Last Edited: 06-12-08 * * ============ * Changelog: * ============ * * v1.3 * -Bug Fixes * * v1.0 * -Initial Release * */ #define VERSION "1.3" #include <amxmodx> #include <amxmisc> #include <fakemeta> #define MAX_SOUNDS 50 #define MAX_p_MODELS 50 #define MAX_v_MODELS 50 #define MAX_w_MODELS 50 #define MAP_CONFIGS 1 new new_sounds [ MAX_SOUNDS ][ 48 ] new old_sounds [ MAX_SOUNDS ][ 48 ] new sounds_team [ MAX_SOUNDS ] new soundsnum new new_p_models [ MAX_p_MODELS ][ 48 ] new old_p_models [ MAX_p_MODELS ][ 48 ] new p_models_team [ MAX_p_MODELS ] new p_modelsnum new new_v_models [ MAX_v_MODELS ][ 48 ] new old_v_models [ MAX_v_MODELS ][ 48 ] new v_models_team [ MAX_p_MODELS ] new v_modelsnum new new_w_models [ MAX_w_MODELS ][ 48 ] new old_w_models [ MAX_w_MODELS ][ 48 ] new w_models_team [ MAX_p_MODELS ] new w_modelsnum new maxplayers new bool : g_Weapons [ 33 ] = true public plugin_init () { register_plugin ( "Weapon Model + Sound Replacement" , VERSION , "GHW_Chronic" ) register_forward ( FM_EmitSound , "Sound_Hook" ) register_forward ( FM_SetModel , "W_Model_Hook" , 1 ) register_logevent ( "newround" , 2 , "1=Round_Start" ) register_event ( "CurWeapon" , "Changeweapon_Hook" , "be" , "1=1" ) maxplayers = get_maxplayers () register_clcmd ( "say /skins" , "check_Skins" ) } public plugin_precache () { new configfile [ 200 ] new configsdir [ 200 ] new map [ 32 ] get_configsdir ( configsdir , 199 ) get_mapname ( map , 31 ) format ( configfile , 199 , "%s/new_weapons_%s.ini" , configsdir , map ) if( file_exists ( configfile )) { load_models ( configfile ) } else { format ( configfile , 199 , "%s/new_weapons.ini" , configsdir ) load_models ( configfile ) } } public load_models ( configfile []) { if( file_exists ( configfile )) { new read [ 96 ], left [ 48 ], right [ 48 ], right2 [ 32 ], trash , team for(new i = 0 ; i < file_size ( configfile , 1 ); i ++) { read_file ( configfile , i , read , 95 , trash ) if( containi ( read , ";" )!= 0 && containi ( read , " " )!=- 1 ) { strbreak ( read , left , 47 , right , 47 ) team = 0 if( containi ( right , " " )!=- 1 ) { strbreak ( right , right , 47 , right2 , 31 ) replace_all ( right2 , 31 , "^"","") if( equali(right2," T ") || equali(right2," Terrorist ") || equali(right2," Terrorists ") || equali(right2," Blue ") || equali(right2,"B") || equali(right2," Allies ") || equali(right2," 1 ") ) team=1 else if( equali(right2," CT ") || equali(right2," Counter ") || equali(right2," Counter - Terrorist ") || equali(right2," Counter - Terrorists ") || equali(right2," CounterTerrorists ") || equali(right2," CounterTerrorist ") || equali(right2," Red ") || equali(right2," R ") || equali(right2," Axis ") || equali(right2," 2 ") ) team=2 else if( equali(right2," Yellow ") || equali(right2," Y ") || equali(right2," 3 ") ) team=3 else if( equali(right2," Green ") || equali(right2," G ") || equali(right2," 4 ") ) team=4 } replace_all(right,47," ^ "" , "" ) if( file_exists ( right )) { if( containi ( right , ".mdl" )== strlen ( right )- 4 ) { if(! precache_model ( right )) { log_amx ( "Error attempting to precache model: ^" % s ^ " (Line %d of new_weapons.ini)" , right , i + 1 ) } else if( containi ( left , "models/p_" )== 0 ) { format ( new_p_models [ p_modelsnum ], 47 , right ) format ( old_p_models [ p_modelsnum ], 47 , left ) p_models_team [ p_modelsnum ]= team p_modelsnum ++ } else if( containi ( left , "models/v_" )== 0 ) { format ( new_v_models [ v_modelsnum ], 47 , right ) format ( old_v_models [ v_modelsnum ], 47 , left ) v_models_team [ v_modelsnum ]= team v_modelsnum ++ } else if( containi ( left , "models/w_" )== 0 ) { format ( new_w_models [ w_modelsnum ], 47 , right ) format ( old_w_models [ w_modelsnum ], 47 , left ) w_models_team [ w_modelsnum ]= team w_modelsnum ++ } else { log_amx ( "Model type(p_ / v_ / w_) unknown for model: ^" % s ^ " (Line %d of new_weapons.ini)" , right , i + 1 ) } } else if( containi ( right , ".wav" )== strlen ( right )- 4 || containi ( right , ".mp3" )== strlen ( right )- 4 ) { replace ( right , 47 , "sound/" , "" ) replace ( left , 47 , "sound/" , "" ) if(! precache_sound ( right )) { log_amx ( "Error attempting to precache sound: ^" % s ^ " (Line %d of new_weapons.ini)" , right , i + 1 ) } else { format ( new_sounds [ soundsnum ], 47 , right ) format ( old_sounds [ soundsnum ], 47 , left ) sounds_team [ soundsnum ]= team soundsnum ++ } } else { log_amx ( "Invalid File: ^" % s ^ " (Line %d of new_weapons.ini)" , right , i + 1 ) } } else { log_amx ( "File Inexistent: ^" % s ^ " (Line %d of new_weapons.ini)" , right , i + 1 ) } /*if(!file_exists(left)) { log_amx("Warning: File Inexistent: ^"%s^" (Line %d of new_weapons.ini). ONLY A WARNING. PLUGIN WILL STILL WORK!!!!",left,i+1) }*/ } } } } public Changeweapon_Hook ( id ) { if(! is_user_alive ( id ) || ! g_Weapons [ id ]) { return PLUGIN_CONTINUE } static model [ 32 ], i , team team = get_user_team ( id ) pev ( id , pev_viewmodel2 , model , 31 ) for( i = 0 ; i < v_modelsnum ; i ++) { if( equali ( model , old_v_models [ i ])) { if( v_models_team [ i ]== team || ! v_models_team [ i ]) { set_pev ( id , pev_viewmodel2 , new_v_models [ i ]) break; } } } pev ( id , pev_weaponmodel2 , model , 31 ) for( i = 0 ; i < p_modelsnum ; i ++) { if( equali ( model , old_p_models [ i ])) { if( p_models_team [ i ]== team || ! p_models_team [ i ]) { set_pev ( id , pev_weaponmodel2 , new_p_models [ i ]) break; } } } return PLUGIN_CONTINUE } public Sound_Hook ( id , channel , sample []) { if(! is_user_alive ( id ) || g_Weapons [ id ]) { return FMRES_IGNORED } if( channel != CHAN_WEAPON && channel != CHAN_ITEM ) { return FMRES_IGNORED } static i , team team = get_user_team ( id ) for( i = 0 ; i < soundsnum ; i ++) { if( equali ( sample , old_sounds [ i ])) { if( sounds_team [ i ]== team || ! sounds_team [ i ]) { engfunc ( EngFunc_EmitSound , id , CHAN_WEAPON , new_sounds [ i ], 1.0 , ATTN_NORM , 0 , PITCH_NORM ) return FMRES_SUPERCEDE } } } return FMRES_IGNORED } public W_Model_Hook ( ent , model []) { if(! pev_valid ( ent )) { return FMRES_IGNORED } static i for( i = 0 ; i < w_modelsnum ; i ++) { if( equali ( model , old_w_models [ i ])) { engfunc ( EngFunc_SetModel , ent , new_w_models [ i ]) return FMRES_SUPERCEDE } } return FMRES_IGNORED } public newround () { static ent , classname [ 8 ], model [ 32 ] ent = engfunc ( EngFunc_FindEntityInSphere , maxplayers , Float :{ 0.0 , 0.0 , 0.0 }, 4800.0 ) while( ent ) { if( pev_valid ( ent )) { pev ( ent , pev_classname , classname , 7 ) if( containi ( classname , "armoury" )!=- 1 ) { pev ( ent , pev_model , model , 31 ) W_Model_Hook ( ent , model ) } } ent = engfunc ( EngFunc_FindEntityInSphere , ent , Float :{ 0.0 , 0.0 , 0.0 }, 4800.0 ) } } public check_Skins ( id ) { switch( g_Weapons [ id ]) { case true : { client_print_color ( id , print_team_default , "^4[SKINS]^1 Las skins de las armas han sido ^4[DESACTIVADAS]^1!" ) g_Weapons [ id ] = false } case false : { client_print_color ( id , print_team_default , "^4[SKINS]^1 Las skins de las armas han sido ^4[ACTIVADAS]^1!" ) g_Weapons [ id ] = true } } return PLUGIN_HANDLED }
Tampoco me funciona bro, los otros dos dejaba las skins y no abria ni el menu ni nada pero el tuyo no abre ni el menu ni deja las skins ni nada bro
Mensajes: 25
Temas: 3
Registro en: Jul 2020
Reputación:
0
13/10/2020, 12:06 AM
(Última modificación: 13/10/2020, 12:08 AM por gh0st . Edited 1 time in total.)
(12/10/2020, 11:55 PM) SettTG escribió: Tampoco me funciona bro, los otros dos dejaba las skins y no abria ni el menu ni nada pero el tuyo no abre ni el menu ni deja las skins ni nada bro
Tuve la oportunidad de probar el primero que te deje y si anda, tienes que cambiar el arma y desaparece el skin.
pd : aparte proba ya que edite el primero que te deje ya que no abría el menú por un error mío.
Mensajes: 466
Temas: 36
Registro en: Jan 2014
Reputación:
5
(12/10/2020, 10:44 PM) SettTG escribió: Me da error
Código:
Warning: Function "check_turn" should return a value on line 88
Error: Undefined symbol "argbreak" on line 121
Error: Undefined symbol "argbreak" on line 125
Warning: Loose indentation on line 175
Warning: Loose indentation on line 201
Warning: Loose indentation on line 222
Actualiza Amx.
(12/03/2014, 08:11 PM) roccoxx escribió: jajajajajajajajajajajajajajajaajajajajajaajajajajajajajajajajajajajajajajajajajajajajajajajjajajjajajajajaja
todo eso elevado a la quinta potencia.
Mensajes: 104
Temas: 42
Registro en: Mar 2020
Reputación:
0
15/10/2020, 06:48 PM
(Última modificación: 15/10/2020, 06:58 PM por SettTG .)
(13/10/2020, 02:12 PM) acetatomil escribió: Actualiza Amx.
Era eso lo siento, Muchísimas gracias a todos
(13/10/2020, 12:06 AM) gh0st escribió: Tuve la oportunidad de probar el primero que te deje y si anda, tienes que cambiar el arma y desaparece el skin.
pd : aparte proba ya que edite el primero que te deje ya que no abría el menú por un error mío.
Como puedo hacer para que al tener los models desactivados así se cambie el mapa se sigan manteniendo desactivados?
Mensajes: 123
Temas: 16
Registro en: May 2019
Reputación:
2
(15/10/2020, 06:48 PM) SettTG escribió: Era eso lo siento, Muchísimas gracias a todos
Como puedo hacer para que al tener los models desactivados así se cambie el mapa se sigan manteniendo desactivados?
ocupar algún guardado, tienes para escoger en el foro hay muchos creo que hay adv_vault, fvault, sqlite, mysql y no se que mas ahí xd pero busca uno y te ayudo sin ningún problema.
Mensajes: 104
Temas: 42
Registro en: Mar 2020
Reputación:
0
(15/10/2020, 08:09 PM) Kiltr0 escribió: ocupar algún guardado, tienes para escoger en el foro hay muchos creo que hay adv_vault, fvault, sqlite, mysql y no se que mas ahí xd pero busca uno y te ayudo sin ningún problema.
adv_vault me parece bien pero el problema es que no se agregar todo eso xd
Mensajes: 123
Temas: 16
Registro en: May 2019
Reputación:
2
(15/10/2020, 09:52 PM) SettTG escribió: adv_vault me parece bien pero el problema es que no se agregar todo eso xd
Prueba y me avisas, recuerda agregar el adv_vault.amxx arriba de este plugin.
Código PHP:
/* * _______ _ _ __ __ * | _____/ | | | | \ \ __ / / * | | | | | | | | / \ | | * | | | |____| | | |/ __ \| | * | | ___ | ______ | | / \ | * | | |_ | | | | | | / \ | * | | | | | | | | | | | | * | |____| | | | | | | | | | * |_______/ |_| |_| \_/ \_/ * * * * Last Edited: 06-12-08 * * ============ * Changelog: * ============ * * v1.3 * -Bug Fixes * * v1.0 * -Initial Release * */ #define VERSION "1.3" #include <amxmodx> #include <amxmisc> #include <fakemeta> #include <adv_vault> #define MAX_SOUNDS 50 #define MAX_p_MODELS 50 #define MAX_v_MODELS 50 #define MAX_w_MODELS 50 #define MAP_CONFIGS 1 new new_sounds [ MAX_SOUNDS ][ 48 ] new old_sounds [ MAX_SOUNDS ][ 48 ] new sounds_team [ MAX_SOUNDS ] new soundsnum new new_p_models [ MAX_p_MODELS ][ 48 ] new old_p_models [ MAX_p_MODELS ][ 48 ] new p_models_team [ MAX_p_MODELS ] new p_modelsnum new new_v_models [ MAX_v_MODELS ][ 48 ] new old_v_models [ MAX_v_MODELS ][ 48 ] new v_models_team [ MAX_p_MODELS ] new v_modelsnum new new_w_models [ MAX_w_MODELS ][ 48 ] new old_w_models [ MAX_w_MODELS ][ 48 ] new w_models_team [ MAX_p_MODELS ] new w_modelsnum new maxplayers new name [ 33 ][ 32 ], g_model [ 33 ]; new archivo [ 2 ]; public plugin_init () { register_plugin ( "Weapon Model + Sound Replacement" , VERSION , "GHW_Chronic" ) register_forward ( FM_EmitSound , "Sound_Hook" ) register_forward ( FM_SetModel , "W_Model_Hook" , 1 ) register_logevent ( "newround" , 2 , "1=Round_Start" ) register_event ( "CurWeapon" , "Changeweapon_Hook" , "be" , "1=1" ) register_clcmd ( "say /models" , "cmdMenu" ) maxplayers = get_maxplayers () archivo [ 0 ] = adv_vault_open ( "db" , false ), archivo [ 1 ] = adv_vault_register_field ( archivo [ 0 ], "modelo" ) adv_vault_init ( archivo [ 0 ]) } public plugin_precache () { new configfile [ 200 ] new configsdir [ 200 ] new map [ 32 ] get_configsdir ( configsdir , 199 ) get_mapname ( map , 31 ) format ( configfile , 199 , "%s/new_weapons_%s.ini" , configsdir , map ) if( file_exists ( configfile )) { load_models ( configfile ) } else { format ( configfile , 199 , "%s/new_weapons.ini" , configsdir ) load_models ( configfile ) } } public load_models ( configfile []) { if( file_exists ( configfile )) { new read [ 96 ], left [ 48 ], right [ 48 ], right2 [ 32 ], trash , team for(new i = 0 ; i < file_size ( configfile , 1 ); i ++) { read_file ( configfile , i , read , 95 , trash ) if( containi ( read , ";" )!= 0 && containi ( read , " " )!=- 1 ) { strbreak ( read , left , 47 , right , 47 ) team = 0 if( containi ( right , " " )!=- 1 ) { strbreak ( right , right , 47 , right2 , 31 ) replace_all ( right2 , 31 , "^"","") if( equali(right2," T ") || equali(right2," Terrorist ") || equali(right2," Terrorists ") || equali(right2," Blue ") || equali(right2,"B") || equali(right2," Allies ") || equali(right2," 1 ") ) team=1 else if( equali(right2," CT ") || equali(right2," Counter ") || equali(right2," Counter - Terrorist ") || equali(right2," Counter - Terrorists ") || equali(right2," CounterTerrorists ") || equali(right2," CounterTerrorist ") || equali(right2," Red ") || equali(right2," R ") || equali(right2," Axis ") || equali(right2," 2 ") ) team=2 else if( equali(right2," Yellow ") || equali(right2," Y ") || equali(right2," 3 ") ) team=3 else if( equali(right2," Green ") || equali(right2," G ") || equali(right2," 4 ") ) team=4 } replace_all(right,47," ^ "" , "" ) if( file_exists ( right )) { if( containi ( right , ".mdl" )== strlen ( right )- 4 ) { if(! precache_model ( right )) { log_amx ( "Error attempting to precache model: ^" % s ^ " (Line %d of new_weapons.ini)" , right , i + 1 ) } else if( containi ( left , "models/p_" )== 0 ) { format ( new_p_models [ p_modelsnum ], 47 , right ) format ( old_p_models [ p_modelsnum ], 47 , left ) p_models_team [ p_modelsnum ]= team p_modelsnum ++ } else if( containi ( left , "models/v_" )== 0 ) { format ( new_v_models [ v_modelsnum ], 47 , right ) format ( old_v_models [ v_modelsnum ], 47 , left ) v_models_team [ v_modelsnum ]= team v_modelsnum ++ } else if( containi ( left , "models/w_" )== 0 ) { format ( new_w_models [ w_modelsnum ], 47 , right ) format ( old_w_models [ w_modelsnum ], 47 , left ) w_models_team [ w_modelsnum ]= team w_modelsnum ++ } else { log_amx ( "Model type(p_ / v_ / w_) unknown for model: ^" % s ^ " (Line %d of new_weapons.ini)" , right , i + 1 ) } } else if( containi ( right , ".wav" )== strlen ( right )- 4 || containi ( right , ".mp3" )== strlen ( right )- 4 ) { replace ( right , 47 , "sound/" , "" ) replace ( left , 47 , "sound/" , "" ) if(! precache_sound ( right )) { log_amx ( "Error attempting to precache sound: ^" % s ^ " (Line %d of new_weapons.ini)" , right , i + 1 ) } else { format ( new_sounds [ soundsnum ], 47 , right ) format ( old_sounds [ soundsnum ], 47 , left ) sounds_team [ soundsnum ]= team soundsnum ++ } } else { log_amx ( "Invalid File: ^" % s ^ " (Line %d of new_weapons.ini)" , right , i + 1 ) } } else { log_amx ( "File Inexistent: ^" % s ^ " (Line %d of new_weapons.ini)" , right , i + 1 ) } /*if(!file_exists(left)) { log_amx("Warning: File Inexistent: ^"%s^" (Line %d of new_weapons.ini). ONLY A WARNING. PLUGIN WILL STILL WORK!!!!",left,i+1) }*/ } } } } public client_putinserver ( id ) { get_user_name ( id , name [ id ], charsmax ( name )) vault ( id , 2 ) } public client_disconnect ( id ) { vault ( id , 1 ) } public Changeweapon_Hook ( id ) { if(! is_user_alive ( id ) || ! g_model [ id ]) { return PLUGIN_CONTINUE } static model [ 32 ], i , team team = get_user_team ( id ) pev ( id , pev_viewmodel2 , model , 31 ) for( i = 0 ; i < v_modelsnum ; i ++) { if( equali ( model , old_v_models [ i ])) { if( v_models_team [ i ]== team || ! v_models_team [ i ]) { set_pev ( id , pev_viewmodel2 , new_v_models [ i ]) break; } } } pev ( id , pev_weaponmodel2 , model , 31 ) for( i = 0 ; i < p_modelsnum ; i ++) { if( equali ( model , old_p_models [ i ])) { if( p_models_team [ i ]== team || ! p_models_team [ i ]) { set_pev ( id , pev_weaponmodel2 , new_p_models [ i ]) break; } } } return PLUGIN_CONTINUE } public Sound_Hook ( id , channel , sample []) { if(! is_user_alive ( id )) { return FMRES_IGNORED } if( channel != CHAN_WEAPON && channel != CHAN_ITEM ) { return FMRES_IGNORED } static i , team team = get_user_team ( id ) for( i = 0 ; i < soundsnum ; i ++) { if( equali ( sample , old_sounds [ i ])) { if( sounds_team [ i ]== team || ! sounds_team [ i ]) { engfunc ( EngFunc_EmitSound , id , CHAN_WEAPON , new_sounds [ i ], 1.0 , ATTN_NORM , 0 , PITCH_NORM ) return FMRES_SUPERCEDE } } } return FMRES_IGNORED } public W_Model_Hook ( ent , model []) { if(! pev_valid ( ent )) { return FMRES_IGNORED } static i for( i = 0 ; i < w_modelsnum ; i ++) { if( equali ( model , old_w_models [ i ]) && g_model [ i ]) { engfunc ( EngFunc_SetModel , ent , new_w_models [ i ]) return FMRES_SUPERCEDE } } return FMRES_IGNORED } public newround () { static ent , classname [ 8 ], model [ 32 ] ent = engfunc ( EngFunc_FindEntityInSphere , maxplayers , Float :{ 0.0 , 0.0 , 0.0 }, 4800.0 ) while( ent ) { if( pev_valid ( ent )) { pev ( ent , pev_classname , classname , 7 ) if( containi ( classname , "armoury" )!=- 1 ) { pev ( ent , pev_model , model , 31 ) W_Model_Hook ( ent , model ) } } ent = engfunc ( EngFunc_FindEntityInSphere , ent , Float :{ 0.0 , 0.0 , 0.0 }, 4800.0 ) } } public cmdMenu ( id ) { new menu = menu_create ( "Menu" , "h_menu" ); menu_additem ( menu , g_model [ id ] ? "Modelos armas : ACTIVADO" : "Modelos armas : DESACTIVADO" , "1" ) menu_display ( id , menu , 0 ) } public h_menu ( id , menu , item ) { menu_destroy ( menu ); if( item == MENU_EXIT ) return; switch( item ) { case 0 : { g_model [ id ] = ! g_model [ id ] cmdMenu ( id ) } } } public vault ( id , save_load ) { if( save_load == 1 ) { if(! is_user_connected ( id )) return; adv_vault_set_start ( archivo [ 0 ]); adv_vault_set_field ( archivo [ 0 ], archivo [ 1 ], g_model [ id ]); adv_vault_set_end ( archivo [ 0 ], 0 , name [ id ]) } else if( save_load == 2 ) { if(! adv_vault_get_prepare ( archivo [ 0 ], _ , name [ id ])) return; g_model [ id ] = adv_vault_get_field ( archivo [ 0 ], archivo [ 1 ]) } }
Mensajes: 104
Temas: 42
Registro en: Mar 2020
Reputación:
0
(16/10/2020, 12:34 AM) Kiltr0 escribió: Prueba y me avisas, recuerda agregar el adv_vault.amxx arriba de este plugin.
Código PHP:
/* * _______ _ _ __ __ * | _____/ | | | | \ \ __ / / * | | | | | | | | / \ | | * | | | |____| | | |/ __ \| | * | | ___ | ______ | | / \ | * | | |_ | | | | | | / \ | * | | | | | | | | | | | | * | |____| | | | | | | | | | * |_______/ |_| |_| \_/ \_/ * * * * Last Edited: 06-12-08 * * ============ * Changelog: * ============ * * v1.3 * -Bug Fixes * * v1.0 * -Initial Release * */ #define VERSION "1.3" #include <amxmodx> #include <amxmisc> #include <fakemeta> #include <adv_vault> #define MAX_SOUNDS 50 #define MAX_p_MODELS 50 #define MAX_v_MODELS 50 #define MAX_w_MODELS 50 #define MAP_CONFIGS 1 new new_sounds [ MAX_SOUNDS ][ 48 ] new old_sounds [ MAX_SOUNDS ][ 48 ] new sounds_team [ MAX_SOUNDS ] new soundsnum new new_p_models [ MAX_p_MODELS ][ 48 ] new old_p_models [ MAX_p_MODELS ][ 48 ] new p_models_team [ MAX_p_MODELS ] new p_modelsnum new new_v_models [ MAX_v_MODELS ][ 48 ] new old_v_models [ MAX_v_MODELS ][ 48 ] new v_models_team [ MAX_p_MODELS ] new v_modelsnum new new_w_models [ MAX_w_MODELS ][ 48 ] new old_w_models [ MAX_w_MODELS ][ 48 ] new w_models_team [ MAX_p_MODELS ] new w_modelsnum new maxplayers new name [ 33 ][ 32 ], g_model [ 33 ]; new archivo [ 2 ]; public plugin_init () { register_plugin ( "Weapon Model + Sound Replacement" , VERSION , "GHW_Chronic" ) register_forward ( FM_EmitSound , "Sound_Hook" ) register_forward ( FM_SetModel , "W_Model_Hook" , 1 ) register_logevent ( "newround" , 2 , "1=Round_Start" ) register_event ( "CurWeapon" , "Changeweapon_Hook" , "be" , "1=1" ) register_clcmd ( "say /models" , "cmdMenu" ) maxplayers = get_maxplayers () archivo [ 0 ] = adv_vault_open ( "db" , false ), archivo [ 1 ] = adv_vault_register_field ( archivo [ 0 ], "modelo" ) adv_vault_init ( archivo [ 0 ]) } public plugin_precache () { new configfile [ 200 ] new configsdir [ 200 ] new map [ 32 ] get_configsdir ( configsdir , 199 ) get_mapname ( map , 31 ) format ( configfile , 199 , "%s/new_weapons_%s.ini" , configsdir , map ) if( file_exists ( configfile )) { load_models ( configfile ) } else { format ( configfile , 199 , "%s/new_weapons.ini" , configsdir ) load_models ( configfile ) } } public load_models ( configfile []) { if( file_exists ( configfile )) { new read [ 96 ], left [ 48 ], right [ 48 ], right2 [ 32 ], trash , team for(new i = 0 ; i < file_size ( configfile , 1 ); i ++) { read_file ( configfile , i , read , 95 , trash ) if( containi ( read , ";" )!= 0 && containi ( read , " " )!=- 1 ) { strbreak ( read , left , 47 , right , 47 ) team = 0 if( containi ( right , " " )!=- 1 ) { strbreak ( right , right , 47 , right2 , 31 ) replace_all ( right2 , 31 , "^"","") if( equali(right2," T ") || equali(right2," Terrorist ") || equali(right2," Terrorists ") || equali(right2," Blue ") || equali(right2,"B") || equali(right2," Allies ") || equali(right2," 1 ") ) team=1 else if( equali(right2," CT ") || equali(right2," Counter ") || equali(right2," Counter - Terrorist ") || equali(right2," Counter - Terrorists ") || equali(right2," CounterTerrorists ") || equali(right2," CounterTerrorist ") || equali(right2," Red ") || equali(right2," R ") || equali(right2," Axis ") || equali(right2," 2 ") ) team=2 else if( equali(right2," Yellow ") || equali(right2," Y ") || equali(right2," 3 ") ) team=3 else if( equali(right2," Green ") || equali(right2," G ") || equali(right2," 4 ") ) team=4 } replace_all(right,47," ^ "" , "" ) if( file_exists ( right )) { if( containi ( right , ".mdl" )== strlen ( right )- 4 ) { if(! precache_model ( right )) { log_amx ( "Error attempting to precache model: ^" % s ^ " (Line %d of new_weapons.ini)" , right , i + 1 ) } else if( containi ( left , "models/p_" )== 0 ) { format ( new_p_models [ p_modelsnum ], 47 , right ) format ( old_p_models [ p_modelsnum ], 47 , left ) p_models_team [ p_modelsnum ]= team p_modelsnum ++ } else if( containi ( left , "models/v_" )== 0 ) { format ( new_v_models [ v_modelsnum ], 47 , right ) format ( old_v_models [ v_modelsnum ], 47 , left ) v_models_team [ v_modelsnum ]= team v_modelsnum ++ } else if( containi ( left , "models/w_" )== 0 ) { format ( new_w_models [ w_modelsnum ], 47 , right ) format ( old_w_models [ w_modelsnum ], 47 , left ) w_models_team [ w_modelsnum ]= team w_modelsnum ++ } else { log_amx ( "Model type(p_ / v_ / w_) unknown for model: ^" % s ^ " (Line %d of new_weapons.ini)" , right , i + 1 ) } } else if( containi ( right , ".wav" )== strlen ( right )- 4 || containi ( right , ".mp3" )== strlen ( right )- 4 ) { replace ( right , 47 , "sound/" , "" ) replace ( left , 47 , "sound/" , "" ) if(! precache_sound ( right )) { log_amx ( "Error attempting to precache sound: ^" % s ^ " (Line %d of new_weapons.ini)" , right , i + 1 ) } else { format ( new_sounds [ soundsnum ], 47 , right ) format ( old_sounds [ soundsnum ], 47 , left ) sounds_team [ soundsnum ]= team soundsnum ++ } } else { log_amx ( "Invalid File: ^" % s ^ " (Line %d of new_weapons.ini)" , right , i + 1 ) } } else { log_amx ( "File Inexistent: ^" % s ^ " (Line %d of new_weapons.ini)" , right , i + 1 ) } /*if(!file_exists(left)) { log_amx("Warning: File Inexistent: ^"%s^" (Line %d of new_weapons.ini). ONLY A WARNING. PLUGIN WILL STILL WORK!!!!",left,i+1) }*/ } } } } public client_putinserver ( id ) { get_user_name ( id , name [ id ], charsmax ( name )) vault ( id , 2 ) } public client_disconnect ( id ) { vault ( id , 1 ) } public Changeweapon_Hook ( id ) { if(! is_user_alive ( id ) || ! g_model [ id ]) { return PLUGIN_CONTINUE } static model [ 32 ], i , team team = get_user_team ( id ) pev ( id , pev_viewmodel2 , model , 31 ) for( i = 0 ; i < v_modelsnum ; i ++) { if( equali ( model , old_v_models [ i ])) { if( v_models_team [ i ]== team || ! v_models_team [ i ]) { set_pev ( id , pev_viewmodel2 , new_v_models [ i ]) break; } } } pev ( id , pev_weaponmodel2 , model , 31 ) for( i = 0 ; i < p_modelsnum ; i ++) { if( equali ( model , old_p_models [ i ])) { if( p_models_team [ i ]== team || ! p_models_team [ i ]) { set_pev ( id , pev_weaponmodel2 , new_p_models [ i ]) break; } } } return PLUGIN_CONTINUE } public Sound_Hook ( id , channel , sample []) { if(! is_user_alive ( id )) { return FMRES_IGNORED } if( channel != CHAN_WEAPON && channel != CHAN_ITEM ) { return FMRES_IGNORED } static i , team team = get_user_team ( id ) for( i = 0 ; i < soundsnum ; i ++) { if( equali ( sample , old_sounds [ i ])) { if( sounds_team [ i ]== team || ! sounds_team [ i ]) { engfunc ( EngFunc_EmitSound , id , CHAN_WEAPON , new_sounds [ i ], 1.0 , ATTN_NORM , 0 , PITCH_NORM ) return FMRES_SUPERCEDE } } } return FMRES_IGNORED } public W_Model_Hook ( ent , model []) { if(! pev_valid ( ent )) { return FMRES_IGNORED } static i for( i = 0 ; i < w_modelsnum ; i ++) { if( equali ( model , old_w_models [ i ]) && g_model [ i ]) { engfunc ( EngFunc_SetModel , ent , new_w_models [ i ]) return FMRES_SUPERCEDE } } return FMRES_IGNORED } public newround () { static ent , classname [ 8 ], model [ 32 ] ent = engfunc ( EngFunc_FindEntityInSphere , maxplayers , Float :{ 0.0 , 0.0 , 0.0 }, 4800.0 ) while( ent ) { if( pev_valid ( ent )) { pev ( ent , pev_classname , classname , 7 ) if( containi ( classname , "armoury" )!=- 1 ) { pev ( ent , pev_model , model , 31 ) W_Model_Hook ( ent , model ) } } ent = engfunc ( EngFunc_FindEntityInSphere , ent , Float :{ 0.0 , 0.0 , 0.0 }, 4800.0 ) } } public cmdMenu ( id ) { new menu = menu_create ( "Menu" , "h_menu" ); menu_additem ( menu , g_model [ id ] ? "Modelos armas : ACTIVADO" : "Modelos armas : DESACTIVADO" , "1" ) menu_display ( id , menu , 0 ) } public h_menu ( id , menu , item ) { menu_destroy ( menu ); if( item == MENU_EXIT ) return; switch( item ) { case 0 : { g_model [ id ] = ! g_model [ id ] cmdMenu ( id ) } } } public vault ( id , save_load ) { if( save_load == 1 ) { if(! is_user_connected ( id )) return; adv_vault_set_start ( archivo [ 0 ]); adv_vault_set_field ( archivo [ 0 ], archivo [ 1 ], g_model [ id ]); adv_vault_set_end ( archivo [ 0 ], 0 , name [ id ]) } else if( save_load == 2 ) { if(! adv_vault_get_prepare ( archivo [ 0 ], _ , name [ id ])) return; g_model [ id ] = adv_vault_get_field ( archivo [ 0 ], archivo [ 1 ]) } }
No me funciona bro, no salen las skins ni el menu sale como si el plugin no estuviera activado