local shot_taken = {} local shot_delay = {} local is_hit = {} local plr_damage = {} local eye_pox = {} local entity_tracker = {} local sound_ricochet = {} local sound_fire = {} local hit_chance = {} function fake_news_init(e) shot_taken[e] = 0 shot_delay[e] = math.random(150, 450) is_hit[e] = 0 plr_damage[e] = 0 eye_pox[e] = 0 entity_tracker[e] = 0 hit_chance[e] = 0 sound_ricochet[e] = 0 sound_fire[e] = 1 math.randomseed( os.time() ) end -- init function fake_news_main(e) eye_pox[e] = math.floor( GetPlayerDistance(e) ) hit_chance[e] = 100 - (math.floor ( eye_pox[e] / 50 ) ) Text(11,14,1, "plrdist; "..eye_pox[e]) Text(11,17,1, "hit chance; "..hit_chance[e] ) Text(11,20,1, "is_hit; "..is_hit[e] ) if eye_pox[e] < 3872 then -- close enough to try... if shot_taken[e] == 0 then shot_delay[e] = shot_delay[e] - 1 Text(11,11,1, "delay; "..shot_delay[e] ) if shot_delay[e] < 150 then Text(50,50,3, "Yo someone just shot at us!!" ) if is_hit[e] <= hit_chance[e] then Text(50,53,3, "We where hit with "..plr_damage[e].." in damage! " ) end -- shot hits player if is_hit[e] > hit_chance[e] then Text(50,53,3, "Luckily they missed! " ) end -- shot misses player Text(50,56,3, "Where did it come from?!" ) end if shot_delay[e] < 1 then shot_taken[e] = 1 shot_delay[e] = math.random(250, 450) is_hit[e] = math.random(1, 100) plr_damage[e] = math.random(5, 12) * 5 -- (25-65) end end if shot_taken[e] == 1 then shot_taken[e] = 0 --------- You will injure player here if is_hit[e] <= hit_chance[e] then HurtPlayer(e, plr_damage[e]) end -- shot hits player --------- You will play a shot sound here (bang and / or ricochet ) --[[ SetGameSoundVolume(hit_chance[e]) Sound(sound_fire[e] ) if is_hit[e] > hit_chance[e] then SetGameSoundVolume(100) Sound(sound_ricochet[e] ) end --]] end -- shot taken = 1 end -- eye_pox = good distance end -- main