forward fm_cmdstart i warunek if(get_uc( uc_handle, UC_Impulse ) == 100 albo 101) return FMRES_SUPERCEDE;
nie mam czasu klepać całego kodu bo biegam 24/7 z łopatą i odśnieżam bo mnie zasypie.
Witamy w Nieoficjalnym polskim support'cie AMX Mod X
Witamy w Nieoficjalnym polskim support'cie AMX Mod X, jak w większości społeczności internetowych musisz się zarejestrować aby móc odpowiadać lub zakładać nowe tematy, ale nie bój się to jest prosty proces w którym wymagamy minimalnych informacji.
|
Guest Message by DevFuse
GasNades + maska gazowa - problem z kompilacją
Temat rozp.
PEREF
, 14.08.2008 15:05
29 odpowiedzi w tym temacie
#21
Napisano 14.02.2009 13:27
#22
Napisano 14.02.2009 13:40
Moj problem polega na tym ze wklepuje /maska pisze mi "Zalozyles maske" a jak chce ja zdiac czyli znow wpisze /maska to mam "
-Zdjales maske ///edited -Zalozyles maske- na raz
register_clcmd("say /maska", "mask") public mask(id) { if(!is_user_alive(id) && get_pcvar_num(amx_gas_maskon)) { client_print(id, print_chat, "Nie zyjesz") } if(has_mask[id]) { client_print(id, print_chat, "Zdjales maske") has_mask[id] = false } if(cs_get_user_money(id) < get_pcvar_num(amx_gas_maskcost) && get_pcvar_num(amx_gas_maskon) && !has_mask[id]) { client_print(id, print_chat, "Nie masz kasy") } if(is_user_alive(id) && get_pcvar_num(amx_gas_maskon) && cs_get_user_money(id) >= get_pcvar_num(amx_gas_maskcost) && !has_mask[id]) { cs_set_user_money(id, cs_get_user_money(id) - get_pcvar_num(amx_gas_maskcost)) client_print(id, print_chat, "Zalozyles maske") has_mask[id] = true if(get_pcvar_num(amx_gas_mask_sap)) { new args[1] args[0]=id set_task(1.0,"sap_sound",args[0]+TASK_SAP,args,1) } } } public sap_sound(args[1]) { new id = args[0] if(is_user_alive(id)) emit_sound(id,CHAN_VOICE,SAP_SOUND1,1.0,ATTN_NORM,0,PITCH_NORM) if(has_mask[id]) set_task(3.0,"sap_sound",args[0]+TASK_SAP,args,1) }
#23
Napisano 14.02.2009 13:49
-Zdioles maske
Płakać się chce.....
Nie ma czegoś takiego jak "zdiołeś"....
ZDJĄŁEŚ
#24
Napisano 16.02.2009 20:30
Ok może to napisze to tak:
Powyższy kod ma za zadanie robić takie cos ze jak mam np zbindowane f to włącza się maska jest git zrobione.
Ale teraz gdy znów nacisnę f to maska ma być off i nie słyszę głosu sapania.
Bo jeśli daję"
To maska się włącza a potem jak jeszcze raz nacisnę to mam (Zdjąłeś maskę i włożyłeś maskę) na raz oraz nie umiem wyłączyć sapania
Jakaś pomoc ew wskazówki... (jestem zielony w scriptingu)
Powyższy kod ma za zadanie robić takie cos ze jak mam np zbindowane f to włącza się maska jest git zrobione.
Ale teraz gdy znów nacisnę f to maska ma być off i nie słyszę głosu sapania.
Bo jeśli daję"
if(has_mask[id]) { client_print(id, print_chat, "Zdjales maske") has_mask[id] = false }
To maska się włącza a potem jak jeszcze raz nacisnę to mam (Zdjąłeś maskę i włożyłeś maskę) na raz oraz nie umiem wyłączyć sapania
Jakaś pomoc ew wskazówki... (jestem zielony w scriptingu)
#25
Napisano 16.02.2009 20:33
Jesli uzywasz mojego scryptu, to dajac has_mask = false to zabierasz mu maske
U mnie czy ma sie ja na sobie odpowiada has_on[id] - tym operuj a jak dobrze pamietam to krypt bedzie sam pilnowal kiedy wydac dzwiek (task pracuje dopuki ma sie ja kupiona (has_mask)
U mnie czy ma sie ja na sobie odpowiada has_on[id] - tym operuj a jak dobrze pamietam to krypt bedzie sam pilnowal kiedy wydac dzwiek (task pracuje dopuki ma sie ja kupiona (has_mask)
#26
Napisano 16.02.2009 20:38
Tylko jest sprawa taka ze jest mp_flashlight 0 i latarki nie ma. Po za tym has_mask[id] = false daje i robi sie to co powyzej zabieram maske. może dam cały kodzik. kodzik jest bez tego efektu fade i bez latarki bo jest mp_flashlight 0.
/* AMX Mod X Plugin * * (c) Copyright 2007, ConnorMcLeod * This file is provided as is (no warranties). * */ /* http://forums.alliedmods.net/showthread.php?t=60947 * * Changelog * v1.6 * now when a player dies, nade's owner gets a frag * don't make death msgs if another plugin block those messages * v1.5b * -little optimization ( get_gametime was used more than 1 time in few functions ) * -error fix in entity think forward, now check first if entity is valid * -added a public cvar * -little changes/cleanup * v1.5a * -amx_gas_restore now works according to cvars amx_gascheck and amx_gasdmg * v1.5 * -added cvar amx_gas_restore that allow to restore players HP * v1.4b * -fixed plugin didn't work correctly with mp_friendlyfire * -little optimization * v1.4 * -Almost completly rewrote the plugin */ #include <amxmodx> #include <cstrike> #include <fakemeta> #include <amxmisc> #define VERSION "1.6" #if AMXX_VERSION_NUM < 180 #define charsmax(%1) sizeof(%1) - 1 #endif #define OFFSET_CSDEATHS 444 #define OFFSET_TEAM 114 #define TASK_SAP 2948 #define GASP_SOUND1 "player/gasp1.wav" #define GASP_SOUND2 "player/gasp2.wav" #define SAP_SOUND1 "player/breathe1.wav" #define SMOKEGRENADE_SOUND "weapons/sg_explode.wav" #define GAS_CLASSNAME "gasgrenade" #define GASNADE_LIFE 25.0 new amx_gasnades, amx_gasdmg, amx_gascheck, amx_gasradius, amx_smokegasp, amx_gasobeyFF, amx_gas_restore, amx_gas_maskcost, amx_gas_maskon, amx_gas_mask_sap new mp_friendlyfire new gmsgDamage, gmsgDeathMsg, gmsgScoreInfo new Float:player_affected_time[33] new Float:player_restored_time[33] new Float:damage_took[33] new bool:has_mask[33] new bool:maskoff[33] public plugin_precache() { engfunc(EngFunc_PrecacheSound, GASP_SOUND1) engfunc(EngFunc_PrecacheSound, GASP_SOUND2) engfunc(EngFunc_PrecacheSound, SAP_SOUND1) } public plugin_init() { register_plugin("Gas Grenades", VERSION, "ConnorMcLeod") // RichoDemus/AssKicR/T(+)rget for previous versions register_event("HLTV", "eNewRound", "a", "1=0", "2=0") register_forward(FM_EmitSound, "fwdEmitSound") register_forward(FM_Touch, "fwdTouch") register_forward(FM_Think, "fwdThink") register_forward(FM_PlayerPreThink, "fwdPlayerPreThink") register_event("DeathMsg", "player_death", "a") register_clcmd("maska", "mask") register_cvar("gasnade", VERSION, FCVAR_SERVER) amx_gasnades = register_cvar("amx_gasnades", "1") // 0/1 Disable/Enable the whole plugin amx_gasdmg = register_cvar("amx_gasdmg", "2") // How much damage the player takes every check cycle, 0 to disable damage (see amx_gascheck) amx_gascheck = register_cvar("amx_gascheck", "2") // Check period in seconds amx_gasradius = register_cvar("amx_gasradius", "180") // Smoke Radius (best is 170 - 230) amx_smokegasp = register_cvar("amx_smokegasp", "1") // 0/1 Makes players gasp/cough in smoke amx_gasobeyFF = register_cvar("amx_gasobeyFF", "0") // 0/1 Makes plugin act or not as cvar mp_friendlyfire amx_gas_restore = register_cvar("amx_gas_restore", "1") // 0/1 Restore or not HP (if amx_gasdmg > 0) amx_gas_maskon = register_cvar("amx_gas_maskon", "1") amx_gas_mask_sap = register_cvar("amx_gas_maskon_sap", "1") amx_gas_maskcost = register_cvar("amx_gas_maskcost", "0") } public plugin_cfg() { mp_friendlyfire = get_cvar_pointer("mp_friendlyfire") gmsgDamage = get_user_msgid("Damage") gmsgDeathMsg = get_user_msgid("DeathMsg") gmsgScoreInfo = get_user_msgid("ScoreInfo") } public mask(id) { if(has_mask[id]) { client_print(id, print_chat, "Mask OFF") has_mask[id] = false } if(!is_user_alive(id) && get_pcvar_num(amx_gas_maskon)) { client_print(id, print_chat, "Nie zyjesz") } if(is_user_alive(id) && get_pcvar_num(amx_gas_maskon) && cs_get_user_money(id) >= get_pcvar_num(amx_gas_maskcost) && !has_mask[id]) { cs_set_user_money(id, cs_get_user_money(id) - get_pcvar_num(amx_gas_maskcost)) client_print(id, print_chat, "Mask ON") has_mask[id] = true if(get_pcvar_num(amx_gas_mask_sap)) { new args[1] args[0]=id set_task(1.0,"sap_sound",args[0]+TASK_SAP,args,1) } } } public sap_sound(args[1]) { new id = args[0] if(is_user_alive(id) && has_mask[id]) emit_sound(id,CHAN_VOICE,SAP_SOUND1,1.0,ATTN_NORM,0,PITCH_NORM) set_task(3.0,"sap_sound",args[0]+TASK_SAP,args,1) } public player_death() { new id = read_data(2) has_mask[id] = false } public client_connect(id) { new Float:global_Time global_get(glb_time, global_Time) player_affected_time[id] = global_Time player_restored_time[id] = global_Time damage_took[id] = 0.0 } public eNewRound() { new ent = -1 while((ent = engfunc(EngFunc_FindEntityByString, ent, "classname", GAS_CLASSNAME)) > 0) { engfunc(EngFunc_RemoveEntity, ent) } new Float:global_Time global_get(glb_time, global_Time) new players[32], inum, player get_players(players, inum) for(new i; i<inum; i++) { player = players[i] player_affected_time[player] = global_Time player_restored_time[player] = global_Time damage_took[player] = 0.0 } } public fwdPlayerPreThink(id) { if(!get_pcvar_num(amx_gasnades)) return FMRES_IGNORED static Float:gasdmg gasdmg = get_pcvar_float(amx_gasdmg) if( !gasdmg && !get_pcvar_num(amx_gas_restore) ) return FMRES_IGNORED if( !is_user_alive(id) || !is_user_connected(id)) return FMRES_IGNORED // check if player has HPs to be set back static Float:damage_to_restore damage_to_restore = damage_took[id] if( damage_to_restore < 1.0 ) return FMRES_IGNORED static Float:global_Time global_get(glb_time, global_Time) static Float:cycle cycle = get_pcvar_float(amx_gascheck) // should tell if player is still in smoke if( global_Time - player_affected_time[id] < cycle + 0.1 ) return FMRES_IGNORED if( global_Time - player_restored_time[id] < cycle ) return FMRES_IGNORED static Float:userHealth pev(id, pev_health, userHealth) if( damage_to_restore >= gasdmg) { set_pev(id, pev_health, userHealth + gasdmg) damage_took[id] -= gasdmg } else if( damage_to_restore > 0.0 ) { //shouldn't happen unless an admin change some cvars during a round set_pev(id, pev_health, userHealth + damage_to_restore) damage_took[id] -= damage_to_restore } player_restored_time[id] = global_Time return FMRES_HANDLED } public fwdEmitSound(entity,channel,const sample[],Float:volume,Float:attenuation,fFlags,pitch) { if(!get_pcvar_num(amx_gasnades)) return FMRES_IGNORED if(!equali(sample, SMOKEGRENADE_SOUND)) return FMRES_IGNORED static owner owner = pev(entity, pev_owner) static Float:origin[3] pev(entity, pev_origin, origin) static ent ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target")) set_pev(ent, pev_classname, GAS_CLASSNAME) set_pev(ent,pev_solid,SOLID_TRIGGER) static Float:radius, Float:min_rad[3], Float:max_rad[3] radius = get_pcvar_float(amx_gasradius) min_rad[0] = -radius min_rad[1] = -radius min_rad[2] = -radius max_rad[0] = radius max_rad[1] = radius max_rad[2] = radius engfunc(EngFunc_SetSize, ent, min_rad, max_rad) set_pev(ent, pev_owner, owner) // cvar amx_gasobeyFF engfunc(EngFunc_SetOrigin,ent,origin) new Float:global_Time global_get(glb_time, global_Time) set_pev(ent, pev_nextthink, global_Time + GASNADE_LIFE) return FMRES_HANDLED } public fwdThink(ent) { if(!pev_valid(ent)) return FMRES_IGNORED static classname[33] pev(ent, pev_classname, classname, charsmax(classname)) if(!equal(classname,GAS_CLASSNAME)) return FMRES_IGNORED engfunc(EngFunc_RemoveEntity, ent) return FMRES_HANDLED } public fwdTouch(ent, id) { if(!is_user_alive(id) || !is_user_connected(id)) return FMRES_IGNORED if(!pev_valid(ent)) { return FMRES_IGNORED } static classname[33] pev(ent, pev_classname, classname, charsmax(classname)) if(!equal(classname, GAS_CLASSNAME)) return FMRES_IGNORED new Float:global_Time global_get(glb_time, global_Time) if( global_Time - player_affected_time[id] < get_pcvar_float(amx_gascheck) ) return FMRES_IGNORED static owner owner = pev(ent, pev_owner) if( !get_pcvar_num(mp_friendlyfire) && get_pcvar_num(amx_gasobeyFF) && get_pdata_int(id, OFFSET_TEAM) == get_pdata_int(owner, OFFSET_TEAM) ) return FMRES_IGNORED player_affected_time[id] = global_Time msg_damage(id, ent) if(get_pcvar_num(amx_smokegasp) && !has_mask[id]) { switch (random_num(1, 2)) { case 1: emit_sound(id, CHAN_VOICE, GASP_SOUND1, 1.0, ATTN_NORM, 0, PITCH_NORM) case 2: emit_sound(id, CHAN_VOICE, GASP_SOUND2, 1.0, ATTN_NORM, 0, PITCH_NORM) } } static Float:damage damage = get_pcvar_float(amx_gasdmg) if(damage > 0.0) { ExtraDamage(id, owner, damage, GAS_CLASSNAME) if(get_pcvar_num(amx_gas_restore) && !has_mask[id]) { damage_took[id] += damage } } return FMRES_HANDLED } ExtraDamage(id, attacker, Float:damage, weaponDescription[]) { if(is_user_alive(id)) { static Float:userHealth pev(id, pev_health, userHealth) if(userHealth - damage < 1.0 && !has_mask[id]) { if(!is_user_connected(attacker)) attacker = 0 add_frags(id, 1.0) new msgblock = get_msg_block(gmsgDeathMsg) if(msgblock != BLOCK_SET) { set_msg_block(gmsgDeathMsg, BLOCK_ONCE) make_deathmsg ( attacker, id, 0, weaponDescription ) dllfunc(DLLFunc_ClientKill, id) set_msg_block(gmsgDeathMsg, msgblock) } else dllfunc(DLLFunc_ClientKill, id) if(attacker && attacker != id) { if( get_pdata_int(id, OFFSET_TEAM) != get_pdata_int(attacker, OFFSET_TEAM) ) add_frags(attacker, 1.0) else if( get_pcvar_num(mp_friendlyfire) ) add_frags(attacker, -1.0) } } else { if(!has_mask[id]) set_pev(id, pev_health, userHealth - damage) } } } add_frags(id, Float:amount) { static Float:frags, Float:newfrags pev(id, pev_frags, frags) newfrags = amount + frags set_pev(id, pev_frags, newfrags) message_begin( MSG_ALL , gmsgScoreInfo ) write_byte( id ) write_short( floatround( newfrags ) ) write_short( get_pdata_int(id, OFFSET_CSDEATHS) ) write_short( 0 ) write_short( get_pdata_int(id, OFFSET_TEAM) ) message_end() } msg_damage(id, entity) { static Float:origin[3] pev(entity, pev_origin, origin) if(!has_mask[id]) { message_begin(MSG_ONE, gmsgDamage, _, id) write_byte(30) // dmg_save write_byte(30) // dmg_take write_long(DMG_SLOWFREEZE) // visibleDamageBits //DMG_ACID , // engfunc(EngFunc_WriteCoord, origin[0]) //arkshine engfunc(EngFunc_WriteCoord, origin[1]) engfunc(EngFunc_WriteCoord, origin[2]) message_end() } }
#27
Napisano 18.02.2009 02:11
Widzę ktoś ładnie kopiuje mi serwer
#28
Napisano 18.02.2009 09:20
Wskakiwać do CT i grać SAS'em wtedy żaden smoke nie rusza
#29
Napisano 18.02.2009 11:37
Widzę ktoś ładnie kopiuje mi serwer
nasz klient, nasz pan
#30
Napisano 18.02.2009 15:29
No to Seba podziel się posi... yyy kodem
Użytkownicy przeglądający ten temat: 0
0 użytkowników, 0 gości, 0 anonimowych