for now i think the best way to do it is to set is so the player needs to move away from the ammo and then back again - as like u said there is no standard 'wait' command
although u could use my breath system to make a timer too it is easier and quicker to just move away and back.
i havent tested these but here's an example
(i may have got the end statements in the wrong place there but basically u need a variable that changes based on distance)
for this one i think you will need to set puchased = 1 as a global
-- LUA Script - precede every function and global member with lower case name of script + '_main'
-- Player Purchase Ammo based on level without destroying ammo
function purchaseammo_main(e)
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 < 60 then
if purchased == 1 then
if charlvl == 1 then
Prompt("Press E to buy this ammo for $500");
if g_KeyPressE == 1 then
if currentcash > 499 then
currentcash = currentcash - 500
PlaySound0(e);
AddPlayerAmmo(e);
purchased = 2
else
Prompt("You only have $" .. currentcash);
end
end
else
end
if charlvl == 2 then
Prompt("Press E to purchase handgun ammo for $450");
if g_KeyPressE == 1 then
if currentcash > 449 then
currentcash = currentcash - 450
PlaySound0(e);
AddPlayerAmmo(e);
purchased = 2
else
Prompt("You only have $" .. currentcash);
end
end
else
end
if charlvl == 3 then
Prompt("Press E to purchase handgun ammo for $375");
if g_KeyPressE == 1 then
if currentcash > 374 then
currentcash = currentcash - 375
PlaySound0(e);
AddPlayerAmmo(e);
purchased = 2
else
Prompt("You only have $" .. currentcash);
end
end
else
end
if charlvl == 4 then
Prompt("Press E to purchase handgun ammo for $250");
if g_KeyPressE == 1 then
if currentcash > 249 then
currentcash = currentcash - 250
PlaySound0(e);
AddPlayerAmmo(e);
purchased = 2
else
Prompt("You only have $" .. currentcash);
end
end
else
end
if charlvl >= 5 then
Prompt("Press E to purchase handgun ammo for $100");
if g_KeyPressE == 1 then
if currentcash > 99 then
currentcash = currentcash - 100
PlaySound0(e);
AddPlayerAmmo(e);
purchased = 2
else
Prompt("You only have $" .. currentcash);
end
end
end
end --end purchased
else --else distance
purchased = 1
end --end dis
end --end func
or timerbased
for this one i think you will need to set timer = 1 as a global
-- LUA Script - precede every function and global member with lower case name of script + '_main'
-- Player Purchase Ammo based on level without destroying ammo
function purchaseammo_main(e)
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 < 60 then
if timer == 1 then
if charlvl == 1 then
Prompt("Press E to buy this ammo for $500");
if g_KeyPressE == 1 then
if currentcash > 499 then
currentcash = currentcash - 500
PlaySound0(e);
AddPlayerAmmo(e);
timer = 5
else
Prompt("You only have $" .. currentcash);
end
end
else
end
if charlvl == 2 then
Prompt("Press E to purchase handgun ammo for $450");
if g_KeyPressE == 1 then
if currentcash > 449 then
currentcash = currentcash - 450
PlaySound0(e);
AddPlayerAmmo(e);
timer = 5
else
Prompt("You only have $" .. currentcash);
end
end
else
end
if charlvl == 3 then
Prompt("Press E to purchase handgun ammo for $375");
if g_KeyPressE == 1 then
if currentcash > 374 then
currentcash = currentcash - 375
PlaySound0(e);
AddPlayerAmmo(e);
timer = 5
else
Prompt("You only have $" .. currentcash);
end
end
else
end
if charlvl == 4 then
Prompt("Press E to purchase handgun ammo for $250");
if g_KeyPressE == 1 then
if currentcash > 249 then
currentcash = currentcash - 250
PlaySound0(e);
AddPlayerAmmo(e);
timer = 5
else
Prompt("You only have $" .. currentcash);
end
end
else
end
if charlvl >= 5 then
Prompt("Press E to purchase handgun ammo for $100");
if g_KeyPressE == 1 then
if currentcash > 99 then
currentcash = currentcash - 100
PlaySound0(e);
AddPlayerAmmo(e);
timer = 5
else
Prompt("You only have $" .. currentcash);
end
end
end
else --else timer
if timer > 2 then
timer = timer - 1
end --end timer2
end -- end timer
end -- end dis
end -- end func
hope they work for u
life's one big game
windows vista ultimate
i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11