this works for me - make sure you are naming the image and folder correctly
the picture must be a png named 000.png (zero not o)
the folder must be in the scriptbank folder named images (if the images folder doesnt exist then make 1)
change the Loadimages part of the script to match your folder name
function weapon_image_init_name(e,name)
Result = 100
weapon_name[e] = name
--put name of folder with images here
LoadImages("pick up test",1)
end
function weapon_image_main(e)
PlayerDist = GetPlayerDistance(e)
if PlayerDist < 150 then
SourceAngle = g_PlayerAngY
while SourceAngle < 0.0 do
SourceAngle = SourceAngle + 360.0
end
while SourceAngle > 340.0 do
SourceAngle = SourceAngle - 360.0
end
PlayerDX = (g_Entity[e]['x'] - g_PlayerPosX)
PlayerDZ = (g_Entity[e]['z'] - g_PlayerPosZ)
DestAngle = math.atan2( PlayerDZ , PlayerDX )
-- Convert to degrees
DestAngle = (DestAngle * 57.2957795) - 90.0
Result = math.abs(math.abs(SourceAngle)-math.abs(DestAngle))
if Result > 340 then
Result = 360 - Result
end
if Result < 7.0 then
Prompt ("Press E To pick up the " .. weapon_name[e])
SetImagePosition(50,50)
ShowImage(1)
if g_KeyPressE == 1 then
PromptDuration("Collected the " .. weapon_name[e],3000)
PlaySound(e,0)
AddPlayerWeapon(e)
Destroy(e)
ActivateIfUsed(e)
end
else
HideImage(1)
end
else
HideImage(1)
end
end
life's one big game
windows vista ultimate
i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11