Jump to content

Z4Zy

Members
  • Posts

    215
  • Joined

  • Last visited

  • Days Won

    3

Z4Zy last won the day on February 27 2019

Z4Zy had the most liked content!

Details

  • Interests
    Lua, SQL

Recent Profile Visitors

3,057 profile views

Z4Zy's Achievements

Trick

Trick (18/54)

49

Reputation

  1. Hello! I created a very basic script of vehicle door control with cursor. When press "1", driver's door open/close according to the cursor move. When press "2" that event will remove. Meta.xml <meta> <script src="client.lua" type="client" /> </meta> Client.lua local dState = false function moveDoor() local vehicle = getPedOccupiedVehicle(localPlayer) if (getVehicleDoorOpenRatio(vehicle, 2) >= 1) then dState = "close" elseif (getVehicleDoorOpenRatio(vehicle, 2) <= 0) then dState = "open" end if (dState == "open") then setVehicleDoorOpenRatio(vehicle, 2, getVehicleDoorOpenRatio(vehicle, 2) + 0.01 ) elseif (dState == "close") then setVehicleDoorOpenRatio(vehicle, 2, getVehicleDoorOpenRatio(vehicle, 2) - 0.01 ) end end bindKey("1", "up", function () addEventHandler("onClientCursorMove", root, moveDoor) end) bindKey("2", "up", function () removeEventHandler("onClientCursorMove", root, moveDoor) end) I need your help with two problems. Problem - 01 The door should move only if player move the cursor left and right on the screen. Not for moving up and down. Problem - 02 Door movement direction (open/close) need to be depend on players view position. Meaning, If player's camera at the front of the vehicle, then when player move the cursor to right, door will open. If player's camera at the back of the vehicle, then when player move the cursor to right, door will close. This will apply vice versa to left. Simple Image Demonstration Appreciate any help. Thank In Advance !!
  2. I noticed that in client code, you added the event "onClientElementDataChange" inside "onClientColShapeHit" event. so, each time when player enter the colshape new "onClientElementDataChange" event is created. This will cause the trigger server event each time +1.
  3. I can suggest you to create col shapes near markers with "createColCuboid" function and trigger your function when player hit that col shape with "onClientColShapeHit" event instead of triggering that function when player hit marker. Don't remove markers so that players will know where to go.
  4. Hello everyone ! When I use following piece of code to set the animation and get what animation the ped is doing, I've noticed that 'getPedAnimation' function doesn't return the correct animation when 'setPedAnimation' function's loop argument set to false. When loop argument set to true, 'getPedAnimation' function return the correct block and animation. I used IFP_Demo resource's parkour.ifp file. Client Side : local ifp = engineLoadIFP("parkour.ifp", "parkour") setPedAnimation(localPlayer, "parkour", "HandPlant", -1, false) -- set false argument to true when testing setTimer( function () local block, anim = getPedAnimation(localPlayer) outputDebugString("Block : "..block..", Anim : "..anim) end, 1000, 1 ) When 'setPedAnimation' function's loop argument set to false, When 'setPedAnimation' function's loop argument set to true,
  5. Z4Zy

    MTA Stuck On Start

    I've installed MTA:SA on a PC and it also had the suitable GTA:SA version installed and that GTA:SA is working fine without any problem. The problem is on MTA:SA which is, when double click on icon and run the game, screen goes usually. As soon as it comes to the main screen with quick connect, connect, .. etc menu, MTA will stuck with not responding status on task manager. Below is the text generated by 'MTADiag' in that PC. Please help to resolve this and to make MTA work fine. https://pastebin.mtasa.com/352889836
  6. Z4Zy

    bindkey. help

    Your problem may resolve with guiSetInputMode function. set bind mode to "allow_binds" when click on your edit box.
  7. Did you run that function on client side and command as for example /createEffect 3 ?? [ createEffect not createeffect , with capital E ? ]
  8. Hello dear ! I'm trying to play some musics with the function 'playSound3D'. The sound URLs are provided to the function [ not files ]. So, that this musics are started to play according to the internet speed of the client. Some will start earlier than others. My problem is in stopping the sound. When current music ends, the next one should play. For that I need to know how long that the current sound will play. Therefore, how to return the left playtime of the sound?
  9. Hello @Burak5312 ! First, I thing it should better if you add following ped into a table giving unique variable as that ped created on server side. if boomer = your following ped, then if I command to spawn a follower, then 'boomer' refers to my follower. Not yours from then. so, it may get confused to the follower !! So, I suggest you to create a table and get the nick name / account name of the command user and store it in a table. Then under that account name variable, create the follower. [ These are told according to my opinion. ]
  10. Z4Zy

    setvip warning

    function DeleteVIP (command, accountName) local result = dbQuery(database,"SELECT * FROM vip") local poll = dbPoll(result, -1) for i,v in ipairs(poll) do local time = getRealTime() if (tonumber(v["viptime"]) < tonumber(time.timestamp)) and (tonumber(v["viptime"]) > 0) then dbExec(database, "DELETE FROM vip WHERE id = ?", tonumber(v["id"])) local account = getAccount(accountName) if getAccountPlayer(account) == tostring(v["acc"]) then local player = getAccountPlayer(account) outputChatBox("VIP: " .. accountName .. " ", player, 255, 255, 255, true) end end end dbFree(result) end setTimer(DeleteVIP, 6000000, 0) In line 8 you had to define the 'accountName' variable. Got it ?
  11. Z4Zy

    setvip warning

    Can you please tell me, what happens every 1 minute when running this DeleteVIP function ?
  12. Z4Zy

    setvip warning

    If that peace of code run according to the timer, you can't add accountName as a handler function argument of DeleteVIP. You had to discover accountName variable before started running the line 8.
  13. can you test below peace of code separately from your resource ? and tell what you think about it related to your code ? after command as /walk function checkPlayerMovementStyle() setTimer( function () value = {} value[1] = true value[2] = false setTimer(setPedControlState,50,2,getLocalPlayer(), "walk", value[1]) toggleControl("walk", value[2]) toggleControl("sprint", value[2]) toggleControl("jump", value[2]) end,500,1) end addCommandHandler("walk",checkPlayerMovementStyle)
  14. Z4Zy

    setvip warning

    First, I think you have missed some details on 'addCommandHandler' page. Go and read that page completely one more time. https://wiki.multitheftauto.com/wiki/AddCommandHandler In server side, there are some parameters on handler function. 1. Player who command 2.The Command 3.Arguments [ from the command ] *Your handler function does not configured correctly.
  15. Seems this code is toggling player's sprint and jump every 300 miliseconds. But when you toggle the control one time... it will last longer until you enable it. Is't it ?
×
×
  • Create New...