Flower ☠ Power Posted June 25, 2018 Posted June 25, 2018 (edited) Which is the screen X and the Y when I aim, of my weapon sight? is it the center of the screen? or how do I get it Edited June 25, 2018 by Flower ☠ Power
Moderators Patrick Posted June 25, 2018 Moderators Posted June 25, 2018 -- only on client side local screenWidth, screenHeight = guiGetScreenSize() local centerX, centerY = screenWidth/2, screenHeight/2
Flower ☠ Power Posted June 25, 2018 Author Posted June 25, 2018 (edited) 24 minutes ago, Patrick2562 said: -- only on client side local screenWidth, screenHeight = guiGetScreenSize() local centerX, centerY = screenWidth/2, screenHeight/2 That's the center of the screen this doesn't mean it's where your aim sight it is, I have tested using GetScreenFromWorldPosition and it seems it's not the same, I shoot at the center of the enemy ped and return it's position with getElementPosition(source) and in hypothetical case that if screen center would be the center of your aim sight wouldn't be the same or very similiar? addEventHandler("onClientRender", root, function() for _, v in pairs(getElementsByType("player")) do local x, y, z = getElementPosition(v) local okX, okY = getScreenFromWorldPosition(x, y, z) if (okX ~= false) and (okY ~= false) then dxDrawRectangle(okX - 4, okY - 4, 4, 4) end end end) I have drawn a little rectangle in the center of every player to see where is the exact center and I can conclude that the aim sight position IS NOT the center of the screen. Edited June 25, 2018 by Flower ☠ Power
Moderators IIYAMA Posted June 25, 2018 Moderators Posted June 25, 2018 https://wiki.multitheftauto.com/wiki/GetPedTargetStart It starts here.
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