Jump to content

undefined

Members
  • Posts

    500
  • Joined

  • Last visited

Everything posted by undefined

  1. Hi guys. I need help. accName = "userdata: 02000085" if string.find(accName,"userdata: ", 1) then -- How i can remove "userdata: " on accName? end How i can make this? Thanks
  2. Hi guys. Im work on to clan system but i have problem. When the accountData changed, im try this. So setElementData. But it's not work and not give error or warning on debug. Where is the problem? addEventHandler("onAccountDataChange", root, function(account, key, value) if (key == "clan") then triggerClientEvent(root, "onAccountDataChange", root) setElementData(source, tostring(key), tostring(value)) end end)
  3. Woow! It's good, thanks. But it's have some problems. It's show object's inside. How to fix it? And Im use this for mouse. But when the rotation each max, it's not blocking to set rotation. What is the problem? (Im get this mouse code in the firstperson script.) local rotX, rotY, rotSpeed, rotRadius, smoothWave, lastKey, visible = 0, 0, 3, 5, 0, "l", false local function render3DCamera( ) local rotSpeed = rotSpeed / 10000 if ( getKeyState( "arrow_l" ) ) then rotX = ( rotX - rotSpeed < 0 and rotX - rotSpeed + 360 or rotX - rotSpeed ) smoothWave, lastKey = 3, "l" elseif ( getKeyState( "arrow_r" ) ) then rotX = ( rotX + rotSpeed > 360 and rotX + rotSpeed - 360 or rotX + rotSpeed ) smoothWave, lastKey = 3, "r" elseif ( not getKeyState( "arrow_l" ) ) and ( not getKeyState( "arrow_r" ) ) then if ( smoothWave > 0 ) then smoothWave = smoothWave - 0.07 local smoothWave = smoothWave / 10000 if ( lastKey == "l" ) then rotX = ( rotX - smoothWave < 0 and rotX - smoothWave + 360 or rotX - smoothWave ) elseif ( lastKey == "r" ) then rotX = ( rotX + smoothWave > 360 and rotX + smoothWave - 360 or rotX + smoothWave ) end elseif ( smoothWave < 0 ) then smoothWave = 0 end end local x, y, z = getElementPosition( localPlayer ) local cx, cy, cz = getCameraMatrix( ) local _cx, _cy, _cz = cx, cy, cz if ( getKeyState( "arrow_u" ) ) then _rotY = ( rotY - rotSpeed > 0 and rotY - rotSpeed or rotY ) if ( isLineOfSightClear( x, y, z, _cx, _cy, math.cos( math.deg( _rotY ) ) * rotRadius + z - 0.5 ) ) then rotY = ( rotY - rotSpeed > 0 and rotY - rotSpeed or rotY ) smoothWave, lastKey = 3, "u" end elseif ( getKeyState( "arrow_d" ) ) then _rotY = ( rotY + rotSpeed < 130 and rotY + rotSpeed or rotY ) if ( isLineOfSightClear( x, y, z, _cx, _cy, math.cos( math.deg( _rotY ) ) * rotRadius + z - 0.5 ) ) then rotY = ( rotY + rotSpeed < 130 and rotY + rotSpeed or rotY ) smoothWave, lastKey = 3, "d" end elseif ( not getKeyState( "arrow_u" ) ) and ( not getKeyState( "arrow_d" ) ) then if ( smoothWave > 0 ) then smoothWave = smoothWave - 0.07 local smoothWave = smoothWave / 20000 if ( lastKey == "u" ) then rotY = ( rotY - smoothWave > 0 and rotY - smoothWave or rotY ) elseif ( lastKey == "d" ) then rotY = ( rotY + smoothWave < 130 and rotY + smoothWave or rotY ) end elseif ( smoothWave < 0 ) then smoothWave = 0 end end _cx = math.cos( math.deg( rotX ) ) * rotRadius + x _cy = math.sin( math.deg( rotX ) ) * rotRadius + y _cz = math.cos( math.deg( rotY ) ) * rotRadius + z setCameraMatrix( _cx, _cy, _cz, x, y, z ) end function initialize3DCamera( ) visible = not visible local fn = visible and addEventHandler or removeEventHandler fn("onClientPreRender", root, render3DCamera) fn("onClientCursorMove", root, mouse) if not visible then setCameraTarget(localPlayer) end end addEventHandler("onClientPlayerSpawn", gMe, initialize3DCamera) addEventHandler("onClientPlayerWasted", gMe, initialize3DCamera) function mouse(cX,cY,aX,aY) if isCursorShowing() or isMTAWindowActive() then return end local sX, sY = guiGetScreenSize() aX = aX - sX/2 aY = aY - sY/2 rotX = rotX - aX * 0.005 * 0.01745 rotY = rotY + aY * 0.005 * 0.01745 local pRotX, pRotY, pRotZ = getElementRotation(localPlayer) pRotZ = math.rad(pRotZ) if rotX > 3.14 then rotX = rotX - 6.28 elseif rotX < -3.14 then rotX = rotX + 6.28 end if rotY > 3.14 then rotY = rotY - 6.28 elseif rotY < -3.14 then rotY = rotY + 6.28 end if isPedInVehicle(localPlayer) then if rotY < -3.14 / 4 then rotY = -3.14 / 4 elseif rotY > -3.14/15 then rotY = -3.14/15 end else if rotY < -3.14 / 4 then rotY = -3.14 / 4 elseif rotY > 3.14 / 2.1 then rotY = 3.14 / 2.1 end end end
  4. Is give error or warning on debugscript?
  5. Try it. function seatbeltWarning() if not getElementData(localPlayer, "seatbelt") then local sound = playSound3D("seatbeltwar.wav", x, y, z) -- Where is the x,y,z defined? setSoundVolume(sound, 1) end end addEventHandler("onClientPlayerSpawn", getLocalPlayer(), seatbeltWarning) addEventHandler("onClientResourceStart", resourceRoot, seatbeltWarning)
  6. Hi guys. Im try this to create new camera mode. But it's not good work. How to fix it? My simple code: local sX, sY = guiGetScreenSize() local dxOp = 40 local boneX, boneY, boneZ, rot, rotat, mathSin, mathCos, vx, vy, vz function setCameraMode() boneX, boneY, boneZ = getPedBonePosition(localPlayer, 6) rot = getPedRotation(localPlayer) rotat = math.rad(rot) mathSin = math.sin(rotat) mathCos = math.cos(rotat) vx = boneX + mathSin * mathCos * 8 vy = boneY + mathSin * mathCos * 8 vz = boneZ - mathSin * 2 setCameraMatrix(vx, vy, vz, boneX, boneY, boneZ, 0) end local state = false function text() if state then if dxOp > 0 then dxOp = dxOp - 2 else dxOp = 0 end else if dxOp < 40 then dxOp = dxOp + 2 else dxOp = 40 end end dxDrawText("Position X: "..tostring(vx).."\nPosition Y: "..tostring(vy).."\nPosition Z: "..tostring(vz).."\nlookAtX: "..tostring(boneX).."\nlookAtY: "..tostring(boneY).."\nlookAtZ: "..tostring(boneZ).."\nmath.sin: "..tostring(mathSin).."\nmath.cos: "..tostring(mathCos), 41, sY/2-55, nil, nil, tocolor(0, 0, 0, 255), 1, "default-bold", "left", "top", false, false, false, true, false, dxOp, dxOp, 0) dxDrawText("#e4e4e4Position X: #00BFFF"..tostring(vx).."\n#e4e4e4Position Y: #00BFFF"..tostring(vy).."\n#e4e4e4Position Z: #00BFFF"..tostring(vz).."\n#e4e4e4lookAtX: #00BFFF"..tostring(boneX).."\n#e4e4e4lookAtY: #00BFFF"..tostring(boneY).."\n#e4e4e4lookAtZ: #00BFFF"..tostring(boneZ).."\n#e4e4e4math.sin: #00BFFF"..tostring(mathSin).."\n#e4e4e4math.cos: #00BFFF"..tostring(mathCos), 40, sY/2-56, nil, nil, tocolor(255, 255, 255, 255), 1, "default-bold", "left", "top", false, false, false, true, false, dxOp, dxOp, 0) end addEventHandler("onClientPreRender", root, text) bindKey("b", "down", function() if state then setCameraTarget(localPlayer) removeEventHandler("onClientPreRender", root, setCameraMode) else addEventHandler("onClientPreRender", root, setCameraMode) end state = ( not state ) end) And how i can set camera position with move mouse? Note: Im new on math.rad/cos/sin code Thanks
  7. First replace the new tank model on greenwood. You can use Handling.cfg for vehicle handling. Then createExplosion for tank shoot. You can't change turret rotation for fake tanks. But you can use other method. For example: Find a turret object and attach object to on tank. And set rotation with camera rotation. Maybe it's not easy. Good luck!
  8. You can use this. But it's only change the variable. It's not change vehicle type. function changeType ( theVehicle, typ, id ) local typ = getVehicleType ( theVehicle ) local id = getElementModel ( theVehicle ) if id == 492 then typ = "tank" end end As far as I know, not possible change element type. If you want to change model 492 to rhino model, use this: function changeType ( theVehicle, typ, id ) local typ = getVehicleType ( theVehicle ) local id = getElementModel ( theVehicle ) if id == 492 then setElementModel(theVehicle, 432) -- Change element model to 432(Rhino). end end Other vehicles: Here
  9. Use /open or /close. Good Luck! local gate = createObject(2893, -2055.69, 169.19, 27.89, 343, 0, 90) local marker = createMarker(-2056.60, 171, 27.89, "cylinder", 1, 255, 255, 255, 0) function isAclGroup(p,group) if p and getElementType(p) == "player" and type(group) == "string" then local Deadusergroup = getAccountName(getPlayerAccount(p)) if isObjectInACLGroup("user."..Deadusergroup, aclGetGroup(group)) then return true else return false end else return false end end function moveGate(playerSource, cmd) if cmd == "open" then if isAclGroup(playerSource,"SamCarTow") then moveObject(gate, 4000, -2055.69, 169.19, 29.89) end elseif cmd == "close" then moveObject(gate, 4000, -2055.69, 169.19, 27.89) end end addCommandHandler("open", moveGate) addCommandHandler("close", moveGate)
  10. What is the math.rad, math.cos and math.sin?
  11. Im try it but i cant make this. Can you give me example on the table?
  12. But i need remove the string. So what is the loadstring?
  13. addEvent("testTrigger", true) addEventHandler("testTrigger", getRootElement(), function(test) end) So test arguement is string. How to remove string?
  14. Oh, no! e.g --Client function testFunc() triggerServerEvent("testTrigger", localPlayer, "pers") end --Server local testTable = { pers = {"test1","test2"} } addEvent("testTrigger", true) addEventHandler("testTrigger", getRootElement(), function(test) outputChatBox("The table say: "..(testTable.test[#testTable.test])..".") -- I want to get testTable.pers but it's get testTable."pers" end How to change "pers" to pers...
  15. I think you dont understand me. For example: Change "pers" to pers
  16. Use addEventHandler -- With onClientRender Edit: Try this. function DaFvck() if not status then status = 1 end if status == 1 then dxDrawImage(posx,posy*0.97,height,height, "img/lala.png",0,0,0,tocolor(255,255,255,255)) elseif status == 2 then dxDrawImage(posx,posy*0.97,height,height, "img/lala2.png",0,0,0,tocolor(255,255,255,255)) else dxDrawImage(posx,posy*0.97,height,height, "img/lala3.png",0,0,0,tocolor(255,255,255,255)) end end addEventHandler("onClientRender", root, DaFvck) addCommandHandler("logo", function(cmd, amount) if not amount then outputChatBox("Use /logo ", 255, 20, 0) return end amount = tonumber(amount) if type(amount) ~= "number" then outputChatBox("Amount type must be number!", 255, 20, 0) return end if amount < 1 or amount > 3 then outputChatBox("Amount must be between 1 and 3!", 255, 20, 0) return end if status == amount then outputChatBox("Your status is already "..amount.."!", 255, 20, 0) return end status = amount outputChatBox("Your new status is "..amount..".", 255, 168, 0) end)
  17. Hey guys. İ have a question. How to change string to variable? What is the this method? Thanks to all...
  18. Im removed the image arguement on triggerServerEvent and Im add onClientElementDataChange on my client side for change the image.
  19. Im solved it myself. Thank you IIYAMA and Saml1er.
  20. Not give error or warning on debug...
×
×
  • Create New...