I have been trying to code a script that can let the player pick up special items in the game and then drop the item anywhere else on the map.
For example, you come to a barrel that says Prompt("You have an Explosive Barrel, Press E to place the Barrel") or Prompt("You need to find an explosive barrel and place it here")
any possible solutions???
here is an example of code that I tried:
PlayerDX = g_Entity[e]['x'] - g_PlayerPosX;
PlayerDY = g_Entity[e]['y'] - g_PlayerPosY;
PlayerDZ = g_Entity[e]['z'] - g_PlayerPosZ;
PlayerDist = math.sqrt(math.abs(PlayerDX*PlayerDX)+math.abs(PlayerDY*PlayerDY)+math.abs(PlayerDZ*PlayerDZ));
if PlayerDist < 300 then
if g_Entity[e]['activated'] == 0 then
if g_Entity[e]['haskey'] == -1 then
g_Entity[e]['activated'] = 1
else
if g_Entity[e]['haskey'] == 1 then
Prompt("You have an Explosive Barrel, Press E to place the Barrel")
if g_KeyPressE == 1 then
Spawn(e)
else
Prompt("You need to find an explosive barrel and place it here")
end
end
-'haskey' is a barrel that you picked up
Flameinc