GHW Weapon Replacement na flagę
Jaszczurek
01.06.2017
Witam, czy mógłby ktoś przerobić ten plugin aby modele były tylko dla VIPA?
Plugin musi być na flagę "t".
/* * _______ _ _ __ __ * | _____/ | | | | \ \ __ / / * | | | | | | | | / \ | | * | | | |____| | | |/ __ \| | * | | ___ | ______ | | / \ | * | | |_ | | | | | | / \ | * | | | | | | | | | | | | * | |____| | | | | | | | | | * |_______/ |_| |_| \_/ \_/ * * * * 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 <hamsandwich> #define MAX_SOUNDS 50 #define MAX_p_MODELS 50 #define MAX_v_MODELS 50 #define MAX_w_MODELS 50 #define MAP_CONFIGS 1 new Array: vArrayModels; 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: bModels[ 33 ]; new const WEAPONENTNAMES[][] = { "", "weapon_p228", "", "weapon_scout", "weapon_hegrenade", "weapon_xm1014", "weapon_c4", "weapon_mac10", "weapon_aug", "weapon_smokegrenade", "weapon_elite", "weapon_fiveseven", "weapon_ump45", "weapon_sg550", "weapon_galil", "weapon_famas", "weapon_usp", "weapon_glock18", "weapon_awp", "weapon_mp5navy", "weapon_m249", "weapon_m3", "weapon_m4a1", "weapon_tmp", "weapon_g3sg1", "weapon_flashbang", "weapon_deagle", "weapon_sg552", "weapon_ak47", "weapon_knife", "weapon_p90" } 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_forward( FM_UpdateClientData , "fmClientData" , 1 ); maxplayers = get_maxplayers(); for (new i = 1; i < sizeof WEAPONENTNAMES; i++) if (WEAPONENTNAMES[i][0]) RegisterHam(Ham_Item_Deploy, WEAPONENTNAMES[i], "fwItemDeploy", 1) register_clcmd( "say /models" , "modelCommand" ); register_clcmd( "say /modele" , "modelCommand" ); register_clcmd( "say_team /models" , "modelCommand" ); register_clcmd( "say_team /modele" , "modelCommand" ); } public modelCommand( id ){ bModels[ id ] = !bModels[ id ]; return PLUGIN_HANDLED; } public client_connect( id ){ 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[]){ vArrayModels = ArrayCreate( 3 , 1 ); new iArray[ 3 ]; 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) { new iPrecache = precache_model(right); if(!iPrecache) { 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) { new iPrecacheOld = precache_model( left ); if( iPrecacheOld ){ iArray[ 0 ] = iPrecacheOld; iArray[ 1 ] = iPrecache; iArray[ 2 ] = team; ArrayPushArray( vArrayModels , iArray ) } } 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 fmClientData( id, sendweapons, cd_handle ){ if( !is_user_connected( id ) || !bModels[ id ] || get_cd( cd_handle , CD_ViewModel ) == 0){ return FMRES_IGNORED; } new iArray[ 3 ] , oldWeapon = get_cd( cd_handle , CD_ViewModel ); for( new i = 0 ; i < ArraySize( vArrayModels ) ; i++ ){ ArrayGetArray( vArrayModels , i , iArray ); if( iArray[ 0 ] == oldWeapon && ( !iArray[ 2 ] || iArray[ 2 ] == get_user_team( id ) ) ){ set_cd( cd_handle , CD_ViewModel , iArray[ 1 ] ); return FMRES_HANDLED; } } return FMRES_IGNORED; } public fwItemDeploy(wpn){ static iOwner; iOwner = pev(wpn,pev_owner); if( !is_user_alive( iOwner ) ){ return PLUGIN_CONTINUE; } static model[ 64 ], iPosition, team team = get_user_team( iOwner ); pev( iOwner ,pev_viewmodel2,model,charsmax( model ) ); for( iPosition = 0; iPosition < v_modelsnum; iPosition++) { if(equali(model,old_v_models[ iPosition ])) { if(v_models_team[ iPosition ]==team || !v_models_team[ iPosition ]) { set_pev( iOwner ,pev_viewmodel2,new_v_models[ iPosition ]) break; } } } pev( iOwner,pev_weaponmodel2,model, charsmax( model ) ); for( iPosition =0; iPosition < p_modelsnum; iPosition++) { if(equali(model,old_p_models[ iPosition ])) { if(p_models_team[ iPosition ]==team || !p_models_team[ iPosition ]) { set_pev( iOwner ,pev_weaponmodel2,new_p_models[ iPosition ]) break; } } } return PLUGIN_CONTINUE; } 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_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) } }
Edited by Jaszczurek, 01.06.2017 19:05.
d0naciak
01.06.2017
public fmClientData( id, sendweapons, cd_handle ){ if( !is_user_connected( id ) || !bModels[ id ] || !(get_user_flags(id) & ADMIN_LEVEL_H) || get_cd( cd_handle , CD_ViewModel ) == 0){ return FMRES_IGNORED; } new iArray[ 3 ] , oldWeapon = get_cd( cd_handle , CD_ViewModel ); for( new i = 0 ; i < ArraySize( vArrayModels ) ; i++ ){ ArrayGetArray( vArrayModels , i , iArray ); if( iArray[ 0 ] == oldWeapon && ( !iArray[ 2 ] || iArray[ 2 ] == get_user_team( id ) ) ){ set_cd( cd_handle , CD_ViewModel , iArray[ 1 ] ); return FMRES_HANDLED; } } return FMRES_IGNORED; }
Jaszczurek
02.06.2017
public fmClientData( id, sendweapons, cd_handle ){ if( !is_user_connected( id ) || !bModels[ id ] || !(get_user_flags(id) & ADMIN_LEVEL_H) || get_cd( cd_handle , CD_ViewModel ) == 0){ return FMRES_IGNORED; } new iArray[ 3 ] , oldWeapon = get_cd( cd_handle , CD_ViewModel ); for( new i = 0 ; i < ArraySize( vArrayModels ) ; i++ ){ ArrayGetArray( vArrayModels , i , iArray ); if( iArray[ 0 ] == oldWeapon && ( !iArray[ 2 ] || iArray[ 2 ] == get_user_team( id ) ) ){ set_cd( cd_handle , CD_ViewModel , iArray[ 1 ] ); return FMRES_HANDLED; } } return FMRES_IGNORED; }
Mam to podmienić zamiast tego?
public fmClientData( id, sendweapons, cd_handle ){ if( !is_user_connected( id ) || !bModels[ id ] || get_cd( cd_handle , CD_ViewModel ) == 0){ return FMRES_IGNORED; } new iArray[ 3 ] , oldWeapon = get_cd( cd_handle , CD_ViewModel ); for( new i = 0 ; i < ArraySize( vArrayModels ) ; i++ ){ ArrayGetArray( vArrayModels , i , iArray ); if( iArray[ 0 ] == oldWeapon && ( !iArray[ 2 ] || iArray[ 2 ] == get_user_team( id ) ) ){ set_cd( cd_handle , CD_ViewModel , iArray[ 1 ] ); return FMRES_HANDLED;
Jaszczurek
03.06.2017
Tak, podmień cały public fmClientData
Niestety nie działa, nie pobiera modeli z serwera.
Errorów również żadnych nie ma.
d0naciak
03.06.2017
Skąd wziąłeś ten plugin tak swoją drogą? Bo nie wiem po co tutaj jest to:
Skorzystaj z tego pluginu http://darkgl.pl/201...aczenia-modeli/i podmień to co Ci wysłałem wcześniej.
P.S. Tak swoją drogą to tez odjebałem, bo jak ktoś nie będzie miał VIPa to nie będzie w ogóle widział tych skinów, a chyba chciałbyś żeby ten co nie ma VIPa widział u VIPa (jako spect) modele co nie?
public fwItemDeploy(wpn){ static iOwner; iOwner = pev(wpn,pev_owner); if( !is_user_alive( iOwner ) ){ return PLUGIN_CONTINUE; } static model[ 64 ], iPosition, team team = get_user_team( iOwner ); pev( iOwner ,pev_viewmodel2,model,charsmax( model ) ); for( iPosition = 0; iPosition < v_modelsnum; iPosition++) { if(equali(model,old_v_models[ iPosition ])) { if(v_models_team[ iPosition ]==team || !v_models_team[ iPosition ]) { set_pev( iOwner ,pev_viewmodel2,new_v_models[ iPosition ]) break; } } } pev( iOwner,pev_weaponmodel2,model, charsmax( model ) ); for( iPosition =0; iPosition < p_modelsnum; iPosition++) { if(equali(model,old_p_models[ iPosition ])) { if(p_models_team[ iPosition ]==team || !p_models_team[ iPosition ]) { set_pev( iOwner ,pev_weaponmodel2,new_p_models[ iPosition ]) break; } } } return PLUGIN_CONTINUE; }
Jaszczurek
03.06.2017
Skąd wziąłeś ten plugin tak swoją drogą? Bo nie wiem po co tutaj jest to:
Skorzystaj z tego pluginu http://darkgl.pl/201...aczenia-modeli/i podmień to co Ci wysłałem wcześniej.
P.S. Tak swoją drogą to tez odjebałem, bo jak ktoś nie będzie miał VIPa to nie będzie w ogóle widział tych skinów, a chyba chciałbyś żeby ten co nie ma VIPa widział u VIPa (jako spect) modele co nie?
Na tym pluginie co wysłałeś właśnie było to sprawdzane, tym od Darka, lecz nie ściąga modeli.
Tak, jak ktoś nie ma vipa to musi widzieć modele u innych graczy.
Jaszczurek
03.06.2017
EDIT:
Jednak miałem inny plugin z tego linku - http://darkgl.pl/201...odmiany-modeli/
Sprawdziłem z tego linku co wysłałeś i działa, tylko właśnie ludzie bez vipa nie widzą skinów.
d0naciak
07.06.2017
Czekaj, spróbujmy to tak (to co wcześniej wysłałem weź usuń, to moje fmClientData:
public Changeweapon_Hook(id) { if(!is_user_alive(id) || !(get_user_flags(id) & ADMIN_LEVEL_H)) { return PLUGIN_CONTINUE } static model[32], i, team team = get_user_team(id) 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 }
Jaszczurek
08.06.2017
Czekaj, spróbujmy to tak (to co wcześniej wysłałem weź usuń, to moje fmClientData:
public Changeweapon_Hook(id) { if(!is_user_alive(id) || !(get_user_flags(id) & ADMIN_LEVEL_H)) { return PLUGIN_CONTINUE } static model[32], i, team team = get_user_team(id) 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 }
Teraz ludzie bez vipa mają skiny.
W sensie u kogoś kto nie ma vipa, patrząc z osoby trzeciej tych skinów nie widać, ale oni je mają.
Dirr
08.06.2017
Witam, czy mógłby ktoś przerobić ten plugin aby modele były tylko dla VIPA?
Plugin musi być na flagę "t".
Nie lepiej użyć tego pluginu
#include <amxmodx> #include <cstrike> #include <engine> public plugin_init() { register_plugin("Plugin", "0.1", "Eapl"); register_event("CurWeapon","CurWeapon","be","1=1"); } public plugin_precache() { precache_model("models/player/vip/v_ak47.mdl"); precache_model("models/player/vip/v_m4a1.mdl"); precache_model("models/player/vip/v_awp.mdl"); precache_model("models/player/vip/v_knife.mdl"); } public CurWeapon(id) { new weapon = read_data(2); if(!(get_user_flags(id) & ADMIN_LEVEL_H)) return PLUGIN_CONTINUE; if(weapon == CSW_AK47) entity_set_string(id, EV_SZ_viewmodel, "models/player/vip/v_ak47.mdl"); if(weapon == CSW_M4A1) entity_set_string(id, EV_SZ_viewmodel, "models/player/vip/v_m4a1.mdl"); if(weapon == CSW_AWP) entity_set_string(id, EV_SZ_viewmodel, "models/player/vip/v_awp.mdl"); if(weapon == CSW_KNIFE) entity_set_string(id, EV_SZ_viewmodel, "models/player/vip/v_knife.mdl"); return PLUGIN_CONTINUE; }
Jaszczurek
09.06.2017
Witam, czy mógłby ktoś przerobić ten plugin aby modele były tylko dla VIPA?
Plugin musi być na flagę "t".
Nie lepiej użyć tego pluginu
#include <amxmodx> #include <cstrike> #include <engine> public plugin_init() { register_plugin("Plugin", "0.1", "Eapl"); register_event("CurWeapon","CurWeapon","be","1=1"); } public plugin_precache() { precache_model("models/player/vip/v_ak47.mdl"); precache_model("models/player/vip/v_m4a1.mdl"); precache_model("models/player/vip/v_awp.mdl"); precache_model("models/player/vip/v_knife.mdl"); } public CurWeapon(id) { new weapon = read_data(2); if(!(get_user_flags(id) & ADMIN_LEVEL_H)) return PLUGIN_CONTINUE; if(weapon == CSW_AK47) entity_set_string(id, EV_SZ_viewmodel, "models/player/vip/v_ak47.mdl"); if(weapon == CSW_M4A1) entity_set_string(id, EV_SZ_viewmodel, "models/player/vip/v_m4a1.mdl"); if(weapon == CSW_AWP) entity_set_string(id, EV_SZ_viewmodel, "models/player/vip/v_awp.mdl"); if(weapon == CSW_KNIFE) entity_set_string(id, EV_SZ_viewmodel, "models/player/vip/v_knife.mdl"); return PLUGIN_CONTINUE; }
Nie, potrzebuję GHW.
d0naciak
09.06.2017
Potrzebujesz pluginu który przy okazji wczytuje modele z pliku ini, rozwiązanie Dirr'a jest dobre, postaraj się z niego skorzystać.
viper367
09.06.2017
Kolego wszystko już było na forum
https://amxx.pl/topi...inu-ghw-weapon/
Sam korzystam z tego GHW2 i spisuje sie wysmienicie
viper367
09.06.2017
d0naciak
10.06.2017
Cooo ? Jak nie działało sam używam tego ghw2 aby zmienić skin vipowi i nie mam do niego żadnych zastrzeżeń
Autor tematu twierdził że nie działało, coś czuje że pewnie zrobił coś nie tak.
Jaszczurek
11.06.2017
Autor tematu twierdził że nie działało, coś czuje że pewnie zrobił coś nie tak.
W tym od Ciebie było okej poza jednym. Gracz również posiadał te skiny, a to nie było dopuszczalne.
Kolego wszystko już było na forum
https://amxx.pl/topi...inu-ghw-weapon/
Sam korzystam z tego GHW2 i spisuje sie wysmienicie
Tutaj wszystko działa tak jak powinno. Jest jednak małe "ale". Ten plugin nie posiada opcji wyłączenia/włączenia modeli poprzez komendę /modele. A do to dość ważne gdyż wielu graczy ma spadki fps przez skiny. Gdyby ktoś z Was był tak miły i dodał to do pluginu, byłoby świetnie.
Jaszczurek
11.06.2017
Przerobiłem zobacz czy działa
Niestety, ale nie działa. Wszystko inne jest okej, ale po wpisaniu /modele nic się nie zmienia.
Edited by Jaszczurek, 11.06.2017 18:38.