Best-Killer Posted January 18, 2016 Share Posted January 18, 2016 why only who in car can see nyan !! -- Save the points linePointX = {} linePointY = {} linePointZ = {} addCommandHandler ( "nyan", function (source) playSound("http://3a.media.v4.skyrock.net/music/3af/0b2/3af0b22c9b39c5a660fca11e00908225.mp3", false) setTimer( function() if isPedInVehicle(getLocalPlayer()) then local vehicle = getPedOccupiedVehicle(getLocalPlayer()) local velX, velY, velZ = getElementVelocity(vehicle) local theSpeed = (velX^2 + velY^2 + velZ^2)^(0.5) * 180 if not (theSpeed == 0)then if vehicle then local lX, lY, lZ = getElementPosition(vehicle) if lX and lY and lZ then table.insert(linePointX, lX) table.insert(linePointY, lY) table.insert(linePointZ, lZ-0.5) if(#linePointX > 20)then table.remove(linePointX, 1) table.remove(linePointY, 1) table.remove(linePointZ, 1) end end end end end end, 80, 0) end ) -- Draw addEventHandler("onClientRender", getRootElement(), function () for i,d in ipairs(linePointX)do if i then if linePointX[i] and linePointX[i-1] and linePointX[i-2] and linePointX[i-3] and linePointX[i-4] then dxDrawLine3D(linePointX[i], linePointY[i], linePointZ[i], linePointX[i-1], linePointY[i-1], linePointZ[i-1], tocolor(255, 0,0, 255), 9) dxDrawLine3D(linePointX[i-1], linePointY[i-1], linePointZ[i-1], linePointX[i-2], linePointY[i-2], linePointZ[i-2], tocolor(255, 0,0, 255), 9) dxDrawLine3D(linePointX[i-3], linePointY[i-3], linePointZ[i-3], linePointX[i-4], linePointY[i-4], linePointZ[i-4], tocolor(255, 0,0, 255), 9) dxDrawLine3D(linePointX[i], linePointY[i], linePointZ[i]+0.2, linePointX[i-1], linePointY[i-1], linePointZ[i-1]+0.2, tocolor(255, 174,0, 255), 9) dxDrawLine3D(linePointX[i-1], linePointY[i-1], linePointZ[i-1]+0.2, linePointX[i-2], linePointY[i-2], linePointZ[i-2]+0.2, tocolor(255, 174,0, 255), 9) dxDrawLine3D(linePointX[i-3], linePointY[i-3], linePointZ[i-3]+0.2, linePointX[i-4], linePointY[i-4], linePointZ[i-4]+0.2, tocolor(255, 174,0, 255), 9) dxDrawLine3D(linePointX[i], linePointY[i], linePointZ[i]+0.4, linePointX[i-1], linePointY[i-1], linePointZ[i-1]+0.4, tocolor(255, 246,0, 255), 9) dxDrawLine3D(linePointX[i-1], linePointY[i-1], linePointZ[i-1]+0.4, linePointX[i-2], linePointY[i-2], linePointZ[i-2]+0.4, tocolor(255, 246,0, 255), 9) dxDrawLine3D(linePointX[i-3], linePointY[i-3], linePointZ[i-3]+0.4, linePointX[i-4], linePointY[i-4], linePointZ[i-4]+0.4, tocolor(255, 246,0, 255), 9) dxDrawLine3D(linePointX[i], linePointY[i], linePointZ[i]+0.6, linePointX[i-1], linePointY[i-1], linePointZ[i-1]+0.6, tocolor(138, 255,0, 255), 9) dxDrawLine3D(linePointX[i-1], linePointY[i-1], linePointZ[i-1]+0.6, linePointX[i-2], linePointY[i-2], linePointZ[i-2]+0.6, tocolor(138, 255,0, 255), 9) dxDrawLine3D(linePointX[i-3], linePointY[i-3], linePointZ[i-3]+0.6, linePointX[i-4], linePointY[i-4], linePointZ[i-4]+0.6, tocolor(138, 255,0, 255), 9) dxDrawLine3D(linePointX[i], linePointY[i], linePointZ[i]+0.8, linePointX[i-1], linePointY[i-1], linePointZ[i-1]+0.8, tocolor(0, 144,255, 255), 9) dxDrawLine3D(linePointX[i-1], linePointY[i-1], linePointZ[i-1]+0.8, linePointX[i-2], linePointY[i-2], linePointZ[i-2]+0.8, tocolor(0, 144,255, 255), 9) dxDrawLine3D(linePointX[i-3], linePointY[i-3], linePointZ[i-3]+0.8, linePointX[i-4], linePointY[i-4], linePointZ[i-4]+0.8, tocolor(0, 144,255, 255), 9) dxDrawLine3D(linePointX[i], linePointY[i], linePointZ[i]+1, linePointX[i-1], linePointY[i-1], linePointZ[i-1]+1, tocolor(180, 0,255, 255), 9) dxDrawLine3D(linePointX[i-1], linePointY[i-1], linePointZ[i-1]+1, linePointX[i-2], linePointY[i-2], linePointZ[i-2]+1, tocolor(180, 0,255, 255), 9) dxDrawLine3D(linePointX[i-3], linePointY[i-3], linePointZ[i-3]+1, linePointX[i-4], linePointY[i-4], linePointZ[i-4]+1, tocolor(180, 0,255, 255), 9) end end end end) i want other players can see it too pls help Link to comment
Mr.Loki Posted January 18, 2016 Share Posted January 18, 2016 because this is clientsided it needs to be triggered from the server for all players to see it Link to comment
Moderators IIYAMA Posted January 19, 2016 Moderators Share Posted January 19, 2016 There is no server communication needed, since the position of the players is already synced. You need to check it per player. And use another table structure. Something like this would do: local linePoint = { [player thePlayer] = { {float x, float y, float z}, {float x, float y, float z}, {float x, float y, float z}, {float x, float y, float z} } } 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