Castillo Posted October 12, 2013 Share Posted October 12, 2013 Try it and see if it works. Link to comment
-.Paradox.- Posted October 13, 2013 Author Share Posted October 13, 2013 I did but still nothing, nothing in debug Link to comment
Moderators Citizen Posted October 13, 2013 Moderators Share Posted October 13, 2013 First, why aren't you using local variables for drawY, nameWidth and teamWidth (95, 112 and 113) ? Also drawY is never used ... Second, why are you drawing 2 texts at line 116 and 117 ? Since only the color will change, only the second text (117) will be visible for the player. I'm guessing that it was for testing purposes. And I couldn't understand the y calculation of the texts It's looking like you tried random magic numbers untill you got the clan text at the position you wanted at. You should get the text height of the player name, adding it to the y player name text and add a margin to get a little space between the two lines/texts. Third, why are they two times the same if statements (121to123 and 124to126) ?? I'm guessing you want to draw the classicon on the left and on the right of the drawn texts. Well, you should put the two dxDrawImage in only one if statement. If you can't see the images, there is 2 possible issues: - the getElementData or the fileExists return false (or maybe both) so you never enter in that statement. You can easily check it by adding an outputChatBox before the 2 dxDrawImage like this: if getElementData(player, "Classicon") and fileExists ( ":Class/class/classicon_"..getElementData(player, "Classicon")..".png" ) then outputChatBox("I'm in !!") --It will flood your chatbox so remove it once you checked dxDrawImage ( sx - math.max(nameWidth/2, teamWidth/2) - imageSize - 1*scale, sy - imageSize, imageSize, imageSize, ":Class/class/classicon_"..getElementData(player, "Classicon")..".png" ) dxDrawImage ( sx + math.max(nameWidth/2, teamWidth/2) + 1*scale, sy - imageSize, imageSize, imageSize, ":Class/class/classicon_"..getElementData(player, "Classicon")..".png" ) end If it's flooding your chatbox with "I'm in !" then this wasn't the problem. - The second one is just that your images are drawn out of the screen. So try to output the calculated position (x and y) of the images. if it's under 0 or over your screen resolution, then that's the problem. Best regards, Citizen PS: Hey Solidsnake, it's been a long time I hope you still remember me (we were basically fighting to be the first to find the solutions ). And according to the number of messages, you stayed active all the time. I'm slowly coming back to MTA Cheers ! Link to comment
-.Paradox.- Posted October 14, 2013 Author Share Posted October 14, 2013 You mean if it work it will output in chat box ''I'm in''? Link to comment
Castillo Posted October 14, 2013 Share Posted October 14, 2013 If the player has element data and the file exists, then it'll spam the chat box with "I'm in". Link to comment
-.Paradox.- Posted October 14, 2013 Author Share Posted October 14, 2013 I tried and there is no spam in chatbox Link to comment
Castillo Posted October 14, 2013 Share Posted October 14, 2013 Try this: if getElementData(player, "Classicon") and fileExists ( getElementData(player, "Classicon") ) then outputChatBox("I'm in !!") --It will flood your chatbox so remove it once you checked dxDrawImage ( sx - math.max(nameWidth/2, teamWidth/2) - imageSize - 1*scale, sy - imageSize, imageSize, imageSize, getElementData(player, "Classicon") ) dxDrawImage ( sx + math.max(nameWidth/2, teamWidth/2) + 1*scale, sy - imageSize, imageSize, imageSize, getElementData(player, "Classicon") ) end If it doesn't work, then post the part where you set "Classicon" element data. Link to comment
-.Paradox.- Posted October 17, 2013 Author Share Posted October 17, 2013 addEventHandler( 'onClientRender', root, function ( ) for i,v in ipairs ( getElementsByType( "player" ) ) do local x, y, z = getElementPosition( v ); local cx, cy, cz = getCameraMatrix( ); if getDistanceBetween Points3D( cx, cy, cz, x, y, z ) <= 15 then local px,py = getScreenFromWorldPosition( x, y, z + 1.3, 0.06 ); if px and py then dxDrawImage( px, py, px, py, getElementData( v, "Classicon" ), 0, 0, 0, tocolor( 255, 255, 255, 255 ) ); end end end end ); Not working too but when I tried this it works but it show a big image and i want it to appear only in player head Link to comment
-.Paradox.- Posted October 20, 2013 Author Share Posted October 20, 2013 Help please the last code is working all what I want do is to draw the image in player head Link to comment
Castillo Posted October 20, 2013 Share Posted October 20, 2013 And where is it drawing it? Link to comment
-.Paradox.- Posted October 20, 2013 Author Share Posted October 20, 2013 Big image near his left hand Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now