Oussema Posted March 13, 2017 Share Posted March 13, 2017 local screenW, screenH = guiGetScreenSize() local x, y = (screenW/1366), (screenH/768) addEvent("showDestination",true) addEventHandler("showDestination",client,function() jobMapWin = guiCreateWindow(x*402, y*120, x*620, y*569, "SAEG Map", false) guiWindowSetSizable(jobMapWin, false) jobMapIm = guiCreateStaticImage(x*10, y*7, x*600, y*551, "images/map.png", false, jobMapWin) addEventHandler("onClientGUIDoubleClick", jobMapIm, onMapImageDoubleClick) showCursor(true) end) function onMapImageDoubleClick(button, state, absX, absY) if (not absX or not absY) then return end local mapX, mapY, mapWidth, mapHeight = x + 10, y* 7, 600, 551 local relX, relY = (absX - mapX) / mapWidth, (absY - mapY) / mapHeight local x = relX*6000 - 3000 local y = 3000 - relY*6000 local hit, hitX, hitY, hitZ hit, hitX, hitY, hitZ = processLineOfSight(x, y, 3000, x, y, -3000) --guiSetVisible(jobMapIm, false) --showCursor(false) end what's worng ?? 0 errors guys Link to comment
NeXuS™ Posted March 13, 2017 Share Posted March 13, 2017 Whats not working with it? Do you get the panel? No TP to there? Thats alright, 0 errors, but whats wrong with the script?... Link to comment
Oussema Posted March 13, 2017 Author Share Posted March 13, 2017 when i click on the map i'm not geting the poss ( hit, hitX, hitY, hitZ ) Link to comment
NeXuS™ Posted March 13, 2017 Share Posted March 13, 2017 Did you try sending it out in the chatBox? (outputChatBox) Link to comment
Moderators Citizen Posted March 13, 2017 Moderators Share Posted March 13, 2017 15 hours ago, Oussema said: "SAEG Map" Is this your script ? Link to comment
Oussema Posted March 14, 2017 Author Share Posted March 14, 2017 Yes , my server name SAEG:RPG And i can prove that to you if you want 7 hours ago, Patrik91 said: Did you try sending it out in the chatBox? (outputChatBox) Yes i did it giving nill Link to comment
Moderators Citizen Posted March 14, 2017 Moderators Share Posted March 14, 2017 41 minutes ago, Oussema said: Yes , my server name SAEG:RPG And i can prove that to you if you want I've used the contact form on your forum asking if you were part of the group, I don't know if it works. Anyway, processLineOfSight returns nil probably because your calculations are incorrect and you end up calling that function at a wrong x and y position. You probably wanted to do something like this at line 17: local mapX, mapY, mapWidth, mapHeight = x*10, y*7, x*600, y*551 If for some reason, it's still not working, try to print the x and y variables. Link to comment
Oussema Posted March 14, 2017 Author Share Posted March 14, 2017 i did the the variables shows fine bro Link to comment
Moderators Citizen Posted March 14, 2017 Moderators Share Posted March 14, 2017 Well, can you double click around the middle of the map.png and reply here with the value you get for mapX, mapY, mapWidth, mapHeight, absX, absY, relX, relY, x, y. I was not saying they are not defined, just that their values are wrong. So yeah, maybe show fine in chatbox but are they correct is what I'm wondering. Link to comment
NeXuS™ Posted March 14, 2017 Share Posted March 14, 2017 This one wont work with processLineOfSight because of this: Quote The two positions must be within the local player's draw distance as the collision data is not loaded outside this area, and the call will just fail as if the ray didn't hit. Did a bypass with a little trick. Tested and worked for me. function onMapImageDoubleClick(button, state, absX, absY) if (not absX or not absY) then return end local absX, absY = absX-x*402-x*10, absY-y*120-y*7 local mapWidth, mapHeight = x*600, y*551 local relX, relY = absX/mapWidth, absY/mapHeight local x = relX*6000 - 3000 local y = 3000 - relY*6000 local hit, hitX, hitY, hitZ setElementPosition(localPlayer, x, y, 0) setElementFrozen(localPlayer, true) setTimer(function() hit, hitX, hitY, hitZ = processLineOfSight(x, y, 200, x, y, -200) setElementPosition(localPlayer, x, y, hitZ+2) setElementFrozen(localPlayer, false) --guiSetVisible(jobMapIm, false) --showCursor(false) end, 300, 1) end If you need further help, feel free to ask here. 1 Link to comment
Oussema Posted March 16, 2017 Author Share Posted March 16, 2017 On 14/03/2017 at 22:33, Patrik91 said: This one wont work with processLineOfSight because of this: Did a bypass with a little trick. Tested and worked for me. function onMapImageDoubleClick(button, state, absX, absY) if (not absX or not absY) then return end local absX, absY = absX-x*402-x*10, absY-y*120-y*7 local mapWidth, mapHeight = x*600, y*551 local relX, relY = absX/mapWidth, absY/mapHeight local x = relX*6000 - 3000 local y = 3000 - relY*6000 local hit, hitX, hitY, hitZ setElementPosition(localPlayer, x, y, 0) setElementFrozen(localPlayer, true) setTimer(function() hit, hitX, hitY, hitZ = processLineOfSight(x, y, 200, x, y, -200) setElementPosition(localPlayer, x, y, hitZ+2) setElementFrozen(localPlayer, false) --guiSetVisible(jobMapIm, false) --showCursor(false) end, 300, 1) end If you need further help, feel free to ask here. Thx worked 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