This should work.
ammo_name = {} - was not declared
function ammo_init_name(e,name) - was wrong _name missing
added double dots into the string field around the variable - ..ammo_name[e]..
added PromptDuration(text,v) so you get a chance to read the text after it is picked up. 2000 = 2 seconds, edit this to suit
ammo_name = {}
function ammo_init_name(e,name)
ammo_name[e] = name
end
function ammo_main(e)
PlayerDist = GetPlayerDistance(e)
if PlayerDist < 40 and g_PlayerHealth > 0 and g_PlayerThirdPerson == 0 then
PromptDuration("Collected "..ammo_name[e].." ammo", 2000)
PlaySound(e,0)
AddPlayerAmmo(e)
Destroy(e)
ActivateIfUsed(e)
end
end
Desktop: Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz, Windows 10 Pro, 64-bit, 16 GB Ram, ASASUS Geforce TURBO GTX1080 8GB, 34" 21:9 2560x1080 Full HD UltraWide IPS Monitor
[RIP] Laptop: Pavilion dv6 Notebook, Intel(R) Core(TM) i5-2410M CPU @ 2.30 GHz, Win 7 64 bit, 16 GB Ram, Radeon (TM) HD 6490M, 2336 MB Memory. Resolution 1366x768, Intel(R) HD Graphics 3000. (WEI 5.8)
PT V9.0 3DMark=377, Passmark=1222.