Jump to content

spaghetti1337

Members
  • Posts

    23
  • Joined

  • Last visited

Everything posted by spaghetti1337

  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:
  16. Okay I think this is hard for me with my current lua "skill" so I decided to use an external dxlib, I'll try DGS but then I can't combine the default gui with this dxlib? function showDashBoard () if showdashboard == true then dxDrawRectangle(screenW * 0.2130, screenH * 0.1676, screenW * 0.5745, screenH * 0.6648, tocolor(47, 45, 47, 255), false) loadstring(exports.dgs:dgsImportFunction())() local gridlist = dgsCreateGridList(screenW * 0.2443, screenH * 0.2241, screenW * 0.1313, screenH * 0.2148,false) dgsGridListAddColumn(gridlist,"test1",0.4) dgsGridListAddColumn(gridlist,"test2",0.4) for i=1,20 do local row = dgsGridListAddRow(gridlist) dgsGridListSetItemText(gridlist,row,1,i) dgsGridListSetItemText(gridlist,row,2,i-1) end end end addEventHandler ( "onClientRender", root, showDashBoard ) Because if I combine them in this way I can't scroll the gridlist and so laggy... (and the gridlist doesn't disappear when I close the dashboard)
  17. Hello, I did some research and if I'm get it right then I can "reproduce" the gridlist's scrollbar (I just needed the gridlist because of the scrollbar) So basically, if I draw a 200x200 rectangle for example with DxDrawRectangle and add text from a table for example with GuiSetText inside the rectangle and I determine the mouse x,y position when scroll_up, scroll_down then I can create my own "gridlist" with scrollbar? or it's a "bit" harder? I found NeXuS's code which is a dx scroll... but erm I want to add a table in the DxDrawRectangle which you can scroll down and up until the last "item" in the table. Also I know that I need the onClientKey function for the move up and down like this: addEventHandler( "onClientKey", root, function (button, press) if button == "mouse_wheel_up" then --- scroll up elseif button == "mouse_wheel_down" then --- scroll down end end )
  18. I want to delete the "pier3_sfe", "pier1_sfe" model which are located in SF (Esplanade East). You can see here addEventHandler ("onResourceStart",resourceRoot, function() removeWorldModel(9951, 10000, -1535.4219, 1168.6641, 18.20313) -- pier3_sfe model removeWorldModel(9965, 10000, -1535.4219, 1168.6641, 18.20313) -- pier3_sfe lod removeWorldModel(9949, 10000, -1535.4219, 1054.5234, 18.20313) -- pier1_sfe model removeWorldModel(9964, 10000, -1535.4219, 1054.5234, 18.20313) -- pier1_sfe lod end) This is delete both of them, but then if I go "behind" the two buildings everything will be invisible/bug which is in front of the removed buildings, you can see the picture below. How can I fix this?
  19. Oh, well it's difficult to understand at first reading but I'll try to get the best out of myself. Thanks
  20. I don't want to edit someone's resource, I want to do it for myself. So I must use some layout engine for this? I know how to make this gui with the simple gui which is in the MTA. I just have problem with the gridlist/scrollbar/dropdown. The other parts are fine
  21. I know there is so many topic with titles like "how to create custom gui" etc but never found how these guys are doing these good looking dashboard for example. So I know that I can create with built-in functions like guiCreateWindow etc. Or dxgui/thisdp's gui but then I can't make look like this (below the picture) I want to know more about how I can create gridlist, dropdown (not with the in-built functions) and if I hover to the button then change to other image (or just add a little more light)
  22. Thanks but I don't see that I can set dimension for the light in the sample: It is possible? local lightSpotTable = { {position = {-711, 957, 12.4}, interior = 0, radius = 80}, --ranch {position = {2005, 1543, 13.5}, interior = 0, radius = 80}, --pirate {position = {2485, -1667, 13.3}, interior = 0, radius = 80}, --grove {position = {-2405, -598, 132.6}, interior = 0, radius = 100}, --hill {position = {214, 1861, 18}, interior = 0, radius = 130}, -- army }
  23. It is possible to make darkness inside the interior? If so, which functions I need for that?
×
×
  • Create New...