hi, i am a script someone gived me but the problem its when i create 2 projectiles this make 2 text : scirpt:
function onClientProjectileCreationFunc()
--thisProjectile = source
addEventHandler( "onClientRender", getRootElement(), aoa)
setTimer( function()
removeEventHandler( "onClientRender", getRootElement(), aoa)
addEventHandler( "onClientRender", getRootElement(), boa)
end, 666, 1)
setTimer( function()
removeEventHandler( "onClientRender", getRootElement(), boa)
addEventHandler( "onClientRender", getRootElement(), coa)
end, 666+666, 1)
setTimer( function()
removeEventHandler( "onClientRender", getRootElement(), coa)
end, 666+666+666+10, 1)
end
addEventHandler( "onClientProjectileCreation", getRootElement(), onClientProjectileCreationFunc )
function aoa()
for index,thisProjectile in ipairs(getElementsByType("projectile")) do
local zeType = getProjectileType( thisProjectile )
if zeType == 16 then
local pX, pY, pZ = getElementPosition( thisProjectile )
local a, b, c = getElementPosition ( thisProjectile )
--local x, y, z = getScreenFromWorldPosition( tX, tY, tZ )
local maxDistance = 12
local x, y, z = getScreenFromWorldPosition( a, b, c )
local zz, ze, za = getElementPosition ( localPlayer)
if zz and ze and za and x and y and z <= 18 then
if x and y then
local a = dxDrawText( "3", x, y, _, _, tocolor( 255, 0, 0, 255 ), 2, "default", "center", "center" )
end
end
end
end
end
function boa()
for index,thisProjectile in ipairs(getElementsByType("projectile")) do
local zeType = getProjectileType( thisProjectile )
if zeType == 16 then
local pX, pY, pZ = getElementPosition( thisProjectile )
local a, b, c = getElementPosition ( thisProjectile )
--local x, y, z = getScreenFromWorldPosition( tX, tY, tZ )
local maxDistance = 12
local x, y, z = getScreenFromWorldPosition( a, b, c )
local zz, ze, za = getElementPosition ( localPlayer)
if zz and ze and za and x and y and z <= 18 then
if x and y then
local b = dxDrawText( "2", x, y, _, _, tocolor( 255, 0, 0, 255 ), 2, "default", "center", "center" )
end
end
end
end
end
function coa()
for index,thisProjectile in ipairs(getElementsByType("projectile")) do
local zeType = getProjectileType( thisProjectile )
if zeType == 16 then
local pX, pY, pZ = getElementPosition( thisProjectile )
local a, b, c = getElementPosition ( thisProjectile )
--local x, y, z = getScreenFromWorldPosition( tX, tY, tZ )
local maxDistance = 12
local x, y, z = getScreenFromWorldPosition( a, b, c )
local zz, ze, za = getElementPosition ( localPlayer)
if zz and ze and za and x and y and z <= 18 then
if x and y then
local c = dxDrawText( "1", x, y, _, _, tocolor( 255, 0, 0, 255 ), 2, "default", "center", "center" )
end
end
end
end
end