Jump to content

Xwad

Members
  • Posts

    1,089
  • Joined

  • Last visited

Everything posted by Xwad

  1. Is it possible to set the players position inside a vehicle? I tried it bit nothing happened
  2. Xwad

    setCameraMatrix

    I have a big problem with this code. When i enter a vehicle then the camera is attaching, and the free cam is also working. But when i rotate the vehicles x position 180 degree then the camera is at the same position. I want to attach the camera to a fix point on the vehicle. So my problem is that its not attaching the camera to that point 100 %. its a really strange bug. I could not explain it correctly, maybe you can test it, and then you will see the bug. So i want to attach it like in the bone attach resource. local vvx, vvy, vvz = 0,0,0 function vehicle_cam(screenX, screenY, absoluteX, absoluteY, vx,vy,vz) local x,y,z = getElementPosition(getPedOccupiedVehicle(getLocalPlayer())) if ( vx and vy and vz ) then vvx, vvy, vvz = vx, vy, vz end setCameraMatrix ( x+4.7, y-0.66, z+3.2, vvx, vvy, vvz ); end addEventHandler("onClientRender", root, vehicle_cam) addEventHandler("onClientCursorMove", getRootElement(), vehicle_cam)
  3. Xwad

    freeze camera

    How can i freeze the camera? i tryied this but it does not work function fc() local cam = getElementsByType ( "camera" ) setElementFrozen ( localPlayer, cam ) end addCommandHandler("fd",fc)
  4. ohhokay thanks. I am just a littlebit confused with the new forum. The oldone was with [ ]
  5. No, my problem is not with the simple disappear. My problem is that i cant make it disappear with the alpha effect. like this, but its not workin local x,y = guiGetScreenSize() local duration = 1500 function fadeDX() startTick = getTickCount() addEventHandler("onClientRender",root,text) setTimer (function() removeEventHandler("onClientRender",root,text) addEventHandler("onClientRender",root,text2) end,3000,1) end function text() local currentTick = getTickCount() local progress = (currentTick-startTick)/duration local alpha = interpolateBetween(0,0,0,255,0,0,progress,"InOutQuad") dxDrawText ("D-Day", x/2.05, y/3, x, y, tocolor(255, 255, 255, alpha), 3) end function text2() alpha = 255 dxDrawText ("D-Day", x/2.05, y/3, x, y, tocolor(255, 255, 255, alpha-5), 3) end
  6. The text appears succesfully but i cant make it disappear:/ Pls help! [lua] function fadeDX() startTick = getTickCount() addEventHandler("onClientRender",root,text) end function text() local currentTick = getTickCount() local progress = (currentTick-startTick)/duration local alpha = interpolateBetween(0,0,0,255,0,0,progress,"InOutQuad") dxDrawText ( "D-Day", x/2.05, y/3, x, y, tocolor(255, 255, 255, alpha), 3) setTimer ( function() startTick = nil,nil removeEventHandler("onClientRender",root,text) local currentTick = getTickCount() local progress = (currentTick+startTick)/duration local alpha = interpolateBetween(0,0,0,255,0,0,progress,"InOutQuad") dxDrawText ( "D-Day", x/2.05, y/3, x, y, tocolor(255, 255, 255, alpha), 3) end, 8000, 1 ) end [/lua]
  7. Xwad

    getCursorMoveOn

    i dont really understansd this now:/ so what do i have to do to fix that?
  8. but in my script there are already a createTEam function
  9. Xwad

    destroyElement

    When i exit the vehicle then the weapons are not destroyed:/ I got no debug:/ cient function onEnter() local veh = getPedOccupiedVehicle(localPlayer) if getElementModel(veh) == 593 then toggleControl ( "brake_reverse", true ) triggerServerEvent ( "createMG_s", localPlayer, veh ) end end addEventHandler("onClientVehicleEnter", getRootElement(), onEnter) function createMG(veh) if not isElement(mg) then local x,y,z = getElementPosition(veh) local mg = createWeapon("m4", x,y,z+3) local mg2 = createWeapon("m4", x,y,z+3) outputChatBox("createMG",255,255,215) setWeaponFiringRate(mg, 20) setWeaponFiringRate(mg2, 20) setWeaponClipAmmo(mg, 99999) setWeaponClipAmmo(mg2, 99999) setWeaponState(mg, "ready") setWeaponState(mg2, "ready") attachElements(mg, veh, 2,0.7,-0.5,0,2,90) --right side & - = right direction attachElements(mg2, veh, -1.9,0.7,-0.5,0,2,90) setElementData(localPlayer,"mg",mg) end end addEvent( "createMG_c", true ) addEventHandler( "createMG_c", localPlayer, createMG ) function onExit() local veh = getPedOccupiedVehicle(localPlayer) if getElementModel(veh) == 593 then local mg = getElementData(localPlayer,"mg",mg) local mg2 = getElementData(localPlayer,"mg2",mg2) triggerServerEvent ( "destroyMG_s", resourceRoot, mg,mg2 ) end end addEventHandler("onClientVehicleStartExit", getRootElement(), onExit) function destroyMG(mg,mg2) destroyElement(mg) destroyElement(mg2) end addEvent( "destroyMG_c", true ) addEventHandler( "destroyMG_c", localPlayer, destroyMG ) server function createMG_server(veh) triggerClientEvent ("createMG_c", getRootElement(), veh) end addEvent( "createMG_s", true ) addEventHandler( "createMG_s", getRootElement(), createMG_server ) function destroyMG_server(mg,mg2) triggerClientEvent ("destroyMG_c", getRootElement(), mg,mg2) end addEvent( "destroyMG_s", true ) addEventHandler( "destroyMG_s", getRootElement(), destroyMG_server )
  10. now my problem is that no one can see the blips:/ function blip() if getElementType(source) == "player" then if getElementModel(source) == 20 or getElementModel(source) == 21 or getElementModel(source) == 22 or getElementModel(source) == 23 or getElementModel(source) == 24 then local players = getPlayersInTeam(getTeamFromName("Axis")) for i,v in pairs (players) do createBlipAttachedTo(v,58,2,255,0,0,255,0,99999.0,v) end end end end addEventHandler("onPlayerSpawn",root,blip) addEventHandler("onElementModelChange",root,blip)
  11. ohh really lol. Well i created the script with onCLientPlayerJoin, but it has the same bug: outputchatbox is not synced, but i added root:/ other problem is that its out putting a chatbox for every player, and i want only to out put the chat box for the player who joined function outputScreenSize() local x,y = guiGetScreenSize(source) outputChatBox ( x.. "x" ..y, 255,255,255 ) end addEventHandler("onClientPlayerJoin", getRootElement(), outputScreenSize)
  12. But if its not possible to do then i will do jt in another way. I will make add command handler
  13. On login event is also not good for me. It is more complicated
  14. Xwad

    getCursorMoveOn

    Why is ths code not working? i got it from the wiki: https://wiki.multitheftauto.com/wiki/GetCursorMoveOn debugscript: ERROR: attempt to concatenate global 'moveOn (a nil value) bad Argumentum outpuChatBox expected number at argument 2, got player code client side function getCursorMoveOn() if ( isCursorShowing() ) then left = "left" right = "right" up = "up" down = "down" zero = "nil" if getElementData(localPlayer,"movew") == right then return right elseif getElementData(localPlayer,"movew") == left then return left elseif getElementData(localPlayer,"movew") == up then return up elseif getElementData(localPlayer,"movew") == down then return down elseif getElementData(localPlayer,"movew") == zero then return false end end end function executeMoveOn(cursorX,cursorY) if ( isCursorShowing() ) then setElementData(localPlayer,"moveX",cursorX) setElementData(localPlayer,"moveY",cursorY) if cursorX > cX then setElementData(localPlayer,"movew",right) elseif cursorX < cX then setElementData(localPlayer,"movew",left) elseif cursorY > cY then setElementData(localPlayer,"movew",down) elseif cursorY < cY then setElementData(localPlayer,"movew",up) end end end addEventHandler("onClientCursorMove",root,executeMoveOn) setTimer( function() if ( isCursorShowing() ) then local curX = getElementData(localPlayer,"moveX") local curY = getElementData(localPlayer,"moveY") if cursorX == cX then setElementData(localPlayer,"movew",zero) elseif cursorY == cY then setElementData(localPlayer,"movew",zero) end end end ,50,0) function previousM() if ( isCursorShowing() ) then cX = getElementData(localPlayer,"moveX") cY = getElementData(localPlayer,"moveY") end end setTimer(previousM,50,0) bindKey ("m", "down", function() showCursor( not isCursorShowing() ) end ) addEventHandler("onClientCursorMove",root, function() if ( isCursorShowing() ) then moveOn = getCursorMoveOn() outputChatBox("cursor is moving on : " .. moveOn, localPlayer) end end )
  15. And will it work with set timer?
  16. yes, i really need it for onPlayerConnect event:/
  17. HI! I am trying to output the player screen size who connected. I have 2 problems: my first problem is that it's also out putting a chatbox for other players (players who not connected), and the second problem is that it's local, so other players cant see the outputchatbox of the connected player:/ server function outPutScreenResolution() triggerClientEvent("outPutScreen", source) end addEventHandler ("onPlayerConnect", getRootElement(), outPutScreenResolution) client function outPutScreen_client() local x,y = guiGetScreenSize() outputChatBox(""..x.."x"..y.."") end addEvent("outPutScreen", true) addEventHandler("outPutScreen", getRootElement(), outPutScreen_client)
  18. ok, i gonna try it thanks.
  19. Now it has only one bug: players from other teams can see the blip. I want to make that only teammates can see each other blips
  20. still has the same bugs:/
  21. ohh i did not see your post G-Stefan. I gonna test it
  22. now its working but it has 2 bugs: The blip is visible to all teams. The blips icon is not 22:/ but i wrote 22
  23. but its still not working
×
×
  • Create New...