Jump to content

spaghetti1337

Members
  • Posts

    23
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

spaghetti1337's Achievements

Civilian

Civilian (7/54)

2

Reputation

  1. Hello, Thank you. But what about string.len? I mean I use string.len for get the character count and then how can I get letter by letter? I need to set a timer for every character or what? Sorry but I don't understand this logic well
  2. I want to make signature more realistic, I'm using a signature font with dxDrawText it's looks like a real signature but I want to make that looks like when you are signature some document in real life. I getting the character name with getElementData: local name = getElementData(localPlayer, "char:name") Suppose that the localPlayer's name is "John Cena" how can I do that "John Cena" is displaying on the screen slowly (but smoothly) letter by letter with dxDrawText? What is the logic behind it? May I need timers and?
  3. Sorry for not respoding long time ago, I was a bit busy. I think I figured out the problem. I set a timer when I set the element's position and now works fine.
  4. Thanks both of you for help but still doing the same... it's random if the player is teleported back or no. Well, this is a server side event so I trigger from client side - thePlayer is the localPlayer from client side.
  5. Hello, What do you mean? I set the player's dimension to 0 and player's position while the timer is ticking - because before the timer is ticking I set the player's dimension to a random number. This is the full code while is the timer is ticking: setTimer (function() --- while the timer is ticking destroyElement(cloneveh) setElementDimension(thePlayer, 0) setElementPosition(thePlayer, x,y,z) end, 120000, 1)
  6. I want to store the player's position and teleport them back after 2 mins. The code above is sometimes working well sometimes just don't teleport back the player. local x,y,z = getElementPosition(thePlayer) --- I define the player's position here (this is before he is warping to the vehicle) local cloneveh = cloneElement ( vehicle, 2066.6848144531, -2496.1398925781, 13.546875 ) setElementRotation(cloneveh, 0,0, 89.148399353027) warpPedIntoVehicle ( thePlayer, cloneveh ) setTimer (function() --- after 2 minutes I destroy the vehicle and trying to teleport back the player for his previous position destroyElement(cloneveh) setElementPosition(thePlayer, x,y,z) end, 120000, 1) I also tried to save the x,y,z variables with setElementData and retrieve with getElementData but I got the same result.
  7. I re-created the resource and now works fine but I still don't know what was the problem... but at least it works now, lol - but thanks your replies and time again
  8. 1, no errors 2, <script src="server.lua" type="server" cache="false"></script>
  9. I'm trying to trigger server event: ---server side --- function removePlayerVehicle(player, vehicle) local playerID if isElement(player) then playerID = getElementData(player, "acc:id") elseif tonumber(player) then playerID = tonumber(player) end local vehicleID if isElement(vehicle) then vehicleID = getElementData(vehicle, "veh:id") elseif tonumber(vehicle) then vehicleID = tonumber(vehicle) end if playerID >= 1 then if ownerCache[playerID] then local data = ownerCache[playerID] for k,v in pairs(data) do if v == vehicleID then table.remove(ownerCache[playerID], k) return true end end end end return false end addEvent("removePlayerVehicle", true) addEventHandler("removePlayerVehicle", root, removePlayerVehicle) --- client side --- triggerServerEvent("removePlayerVehicle", localPlayer, vehicle) Error: Client (player) triggered serverside event removePlayerVehicle, but event is not added serverside Also I tried to replace triggerServerEvent with exports: exports['vehicle']:removePlayerVehicle(localPlayer, vehicle) --- meta.xml --- <export function="removePlayerVehicle" type="shared"></export> Error: call: failed to call 'vehicle:removePlayerVehicle' [string "?"]
  10. No, I have a function which named dxDrawRectangleBox and draws a custom box. Well, I stored the positions with setElementData I know that is not the best way and I don't know it will cause some lags for the players or no because it's update the elementdata everytime when he is inside the distance and looking around, currently works fine and doesn't laggy
  11. Storing the variables to global is okay? Like this: vehscreenX = screenX - x/2 vehscreenY = screenY - y / 2 vehx = x vehy = y And then call these global variables inside the isMouseInPosition() ?
  12. I want to get the dxDrawRectangleBox's position from Panel function inside the onClick function, how can I do that? function Panel() local cameraX, cameraY, cameraZ = getCameraMatrix(); for element, value in pairs(renderCache) do local distance = value["distance"] if distance <= maxDistance then local boneX, boneY, boneZ = getElementPosition(element); local size = 1 - (distance / maxDistance); local screenX, screenY = getScreenFromWorldPosition(boneX, boneY, boneZ + (1.1)); if screenX and screenY then local alpha = interpolateBetween(0,0,0,255, 0, 0, size, "Linear") local text = "Text" local length = dxGetTextWidth(text, size, font) + 15 * size local x = length local y = 25 * size; dxDrawRectangleBox(screenX - x/2, screenY - y / 2, x, y, tocolor(20,20,20,alpha * 0.7)); --- I want to put these positions inside the isMouseInPosition function dxDrawText(text, screenX, screenY, screenX, screenY, tocolor(255,255,255,alpha), size, font, "center", "center"); end end end end function isMouseInPosition ( x, y, width, height ) if ( not isCursorShowing( ) ) then return false end local sx, sy = guiGetScreenSize ( ) local cx, cy = getCursorPosition ( ) local cx, cy = ( cx * sx ), ( cy * sy ) if ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) then return true else return false end end function onClick(button, state) if (button == "left") and (state == "up") then if isMouseInPosition() then --- I want to put the position here which is in the "Panel" function outputChatBox ("click") end end end addEventHandler( "onClientClick", root, onClick )
  13. Fixed it by adding tostring(getElementData(value, "veh >> id")) weird thing that the debugscript didn't show that before, just after a lot of try...
  14. Why I can't add items from "myVehicles" table? If I do outputChatBox then works like a charm, but the gridlist shows nothing. myVehicles = {} for key, value in ipairs(getElementsByType("vehicle")) do if getElementData(value, "veh >> owner") == getElementData(localPlayer, "acc >> id") then table.insert(myVehicles, value) end end for key, value in ipairs(myVehicles) do outputChatBox(getElementData(value, "veh >> id")) --- I have 6 vehicles and displays all of them in the chat gridlist:AddItem(1, getElementData(value, "veh >> id")) --- shows nothing in the gridlist I also tried with tonumber(getElementData(value, "veh >> id")) end if I just change the gridlist:AddItem(1, getElementData(value, "veh >> id")) to gridlist:AddItem(1, "test") then displays 6 "test" in the gridlist so the table works fine but can't get the veh id inside the gridlist
  15. Okay, I chosen this one https://github.com/t3wz/dxGridlists , this is works. I can scroll inside the gridlist but doesn't have a scrollbar can you take a look inside that code and help me out please? and I want to display the items like every second item color is light gray and other ones is a bit darker you can see what I mean below:
×
×
  • Create New...