cybernescence is right.
This the complete script + few modifications
key_pressed = 0
local i,n
function randomweapon_init(e)
Score = 1000
Random = 0
end
function randomweapon_main(e)
PlayerDist = GetPlayerDistance(e)
if PlayerDist < 80 and g_PlayerHealth > 0 and g_PlayerThirdPerson==0 and key_pressed == 0 then
Prompt("Press E To Collect A Random Weapon")
if Score >= 100 then
if g_KeyPressE == 1 then
Score = Score - 100
Random = math.random(1,6)
key_pressed = 1
if Random == 1 then
RemovePlayerWeapons(e)
AddPlayerWeapon(2)
end
for i = 2,6 do
if Random == i then
n=i+3
RemovePlayerWeapons(e)
AddPlayerWeapon(n)
end
end
end -- g_KeyPressE
end -- Score
end -- PlayerDist
Panel(1,1,20,30)
Text(2,8,4,"Score: "..Score.." ")
if g_KeyPressE == 0 then
key_pressed = 0
end
end-- main
In action
hth
3com
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz
OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics