Jump to content

What is wrong here ?


|H|TiTanium

Recommended Posts

Basically this thing doesn't work :

Probably I'm forgetting something, so this is what I got, and stil the same, Nothing works, no rectangle, and not even ped's health.

Client:

local x, y = guiGetScreenSize() 
local tigre1 = nil 
  
addEventHandler("onClientRender",getRootElement(), 
function () 
if ( isElement ( tigre1 ) ) then 
local mx, my, mz = getElementPosition(tigre1) 
local mcx, mcy, mcz = getCameraMatrix() 
if isLineOfSightClear ( mcx , mcy, mcz, mx, my, mz, true, false, false, true, false, true, false, getLocalPlayer ( )) then 
local x1,y1,z1 = getElementPosition (getLocalPlayer()) 
local x2,y2,z2 = getElementPosition (tigre1) 
local visibleto = getDistanceBetweenPoints3D(x1,y1,z1,x2,y2,z2) 
if visibleto < 75 then 
local sx,sy = getScreenFromWorldPosition ( x2,y2,z2+1.45 ) 
if sx and sy then 
if y/102-visibleto/5 > 0 then 
dxDrawRectangle ( sx-x/14/2+visibleto/2, sy+y/25-visibleto/3, x/14-visibleto,y/146.3-visibleto/10, tocolor(0,0,0,245) ) 
if getElementHealth(tigre1) > 1 then 
dxDrawRectangle ( sx-x/14/2+visibleto/2, sy+y/25-visibleto/3, x/14*getElementHealth(tigre1)/100-visibleto,y/146.3-visibleto/10, tocolor(190,0,0,245) ) 
end 
end 
end 
end 
end 
end 
end) 
  
  
  
addEvent ("get:element",true) 
addEventHandler ( "get:element", root, 
function (element) 
tigre1 = element 
outputChatBox ( "element" ) 
end) 
  
  
addEventHandler ( "onClientResourceStart", resourceRoot, function() 
triggerServerEvent ( "ped:clientready", getLocalPlayer(), getLocalPlayer() ) 
end) 

Server side:

function sendServer(playerToSendTo) 
triggerClientEvent (playerToSendTo, "get:element", root, tigre1 ) 
end 
addEvent ( "ped:clientready", true ) 
addEventHandler ( "ped:clientready", root, sendServer ) 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...