Greenie0101 Posted September 24, 2012 Share Posted September 24, 2012 Sorry that i haven't really looked into this myself. Just wondering what a good way to detect a player jumping into a wall is. Link to comment
MR.S3D Posted September 24, 2012 Share Posted September 24, 2012 Sorry that i haven't really looked into this myself. Just wondering what a good way to detect a player jumping into a wall is. you can use thes in your script if you need commandhandler like this example server side : toggle = false function jump(player) if (player) then if toggle == false then toggleControl ( player, "jump", false ) -- disable outputChatBox("Jump is now diable", player, 255, 0, 0, true) toggle = true elseif toggle == true then toggleControl ( player, "jump", true ) -- enable outputChatBox("Jump is now enable", player, 255, 0, 0, true) toggle = false end end end addCommandHandler ( "Jump", jump ) to enable or disable ---------------------------- you can see here in wiki control name https://wiki.multitheftauto.com/wiki/Control_names if you need use in player join tell me Link to comment
TAPL Posted September 24, 2012 Share Posted September 24, 2012 @LI7IL, Not this what he is looking for, he wants to know if the player is into wall (wall bug). Link to comment
MR.S3D Posted September 24, 2012 Share Posted September 24, 2012 @LI7IL, Not this what he is looking for, he wants to know if the player is into wall (wall bug). ok I understood wrong Thank you Link to comment
Greenie0101 Posted September 24, 2012 Author Share Posted September 24, 2012 @LI7IL, Not this what he is looking for, he wants to know if the player is into wall (wall bug). sorry if i wasn't clear, i mean if a player is hitting a wall while running. I want to do a parkour script where when you run into a wall you run up it for a bit but i need to detect if the player is in contact with a wall Link to comment
DiSaMe Posted September 24, 2012 Share Posted September 24, 2012 processLineOfSight isLineOfSightClear Link to comment
Greenie0101 Posted September 24, 2012 Author Share Posted September 24, 2012 processLineOfSight isLineOfSightClear awesome so if i used float, float, float getWorldFromScreenPosition ( float x, float y, float depth ) and set the x and y to center screen and the depth to 10 it would get the point in the world 10 units away which if i was facing a wall would be on the other side? then i could use processLineOfSight to check if there was a wall there? or is there a better way? Link to comment
DiSaMe Posted September 24, 2012 Share Posted September 24, 2012 I don't think it's a good idea to rely on camera to do something like this. Better use: getElementPosition to get player's position and then: getPedRotation math.sin math.cos to get position in front. Then check collision between player and front position. Link to comment
Greenie0101 Posted September 24, 2012 Author Share Posted September 24, 2012 Haha sin and cos.... Now i wish id payed attention in maths class How do i use triganomerty in this? Link to comment
DiSaMe Posted September 24, 2012 Share Posted September 24, 2012 local x1, y1, z = getElementPosition(localPlayer) local r = math.rad(getPedRotation(localPlayer)) local x2, y2 = x1+math.sin(r)*2, y1+math.cos(r)*2 Now x1, y1, z will be player's position and x2, y2, z will be position in front by 2 distance units. You can change the distance by multiplying sin and cos by something else than 2 in line 3. Also, you may need to make r negative (use -r instead of r) to get the correct position. Link to comment
Greenie0101 Posted September 24, 2012 Author Share Posted September 24, 2012 Ok thanks alot, its midnight but ill test it in the morning. You've been a great help Edit: i used this and it seems to work fine (just used output chatbox to test the detection function wallrun() local x1, y1, z = getElementPosition(localPlayer) local r = math.rad(getPedRotation(localPlayer)) local x2, y2 = x1+math.sin(-r)*2, y1+math.cos(-r)*2 if isLineOfSightClear(x1,y1,z,x2,y2,z) then outputChatBox("clear") else outputChatBox("not clear") end end setTimer(wallrun,1000,0) I had to make it -r as just using r made it only work when facing at some angles. thanks for you're help 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