idarrr
Members-
Posts
133 -
Joined
-
Last visited
-
Days Won
1
Everything posted by idarrr
-
When player quit, save the timer details to database or XML or anywhere you want using getTimerDetails, this can be done on server side. Then when player join the game, create the timer with timer details you saved it before.
-
I don't think anyone can help you without debug or specific information. There is also exported function, and the problem may there. Please read this: And this: And try this to debug your code:
-
Np mate, good luck
-
-- render local nextOffset = 0 for i, v in pairs(menu) do local textwidth -- get your text width local textheight -- get your text height here local posX = nextOffset local posY -- your Y position local endX = posX + textwidth local endY = posY + textheight -- draw it dxDrawText(v.name, posX, posY, endX, endY, ...) -- your next argument bla, bla, bla -- set the next offset nextOffset = nextOffset + textwidth end Something like this may work. And also argument 5 and argument 6 should not be 0 value, because you also set the alignment for the text. See: dxDrawText
-
I'm not good at explaination. But, let's see.. If you make marker on client side, other player can't see your marker. But, they can see their own marker. Example: -- file name client.lua -- client side code createMarker( 0, 0, 0) -- this marker automatically created when client script started. -- marker position is on the center of gta world By doing that, you are the only one who can see that marker, other player can't see your marker, but they have their own marker. Your marker and other player's marker is a different element. But if you make it on server side. You and other players are seeing the same marker, because element that created on server side will sync to all clients. Let's make another example code using command -- client side code function giveMeMarker() local x, y, z = getElementPosition(localPlayer) createMarker(x, y, z) end addCommandHandler("givememarker", giveMeMarker) If you type "givememarker", it will create marker on your position, other players can't see it, but if they type that command, they have marker on their position, you cant see their marker. So, element created on server will sync to all players, but element created on client, it won't sync to other players.
-
Probably, they edited that building model, remove that door, replace that building model, and put the interior model inside that building using map file or createObject. I tried this long ago, it looks pretty good actually, as long as the interior model fits inside that empty space of building.
-
Did you place sha module there? https://github.com/mabako/mta-paradise/tree/master/modules
-
Create separated calculation for scroll bar. -- items scroll local visibleHeight = ((list['sizeY'] * 250) / 12) local overallHeight = (#guiSystem_element['list']['item'] * 20) local scrollPosition = 0 -- scroll position should be zero at the first time, the range is between 0 - 100 local itemCoorY = list['posY'] local currentCoorY = itemCoorY -- scroll bar local scrollX, scrollY -- x, y position local scrollIconWidth -- the width of the scroll bar icon (that circle image) local scrollIconHeight -- the height of the scroll bar icon (that circle image) local scrollBarHeight -- the height of the scroll bar -- find the exact Y so it doesn't move outside the scrollBarHeight local newScrollY = (scrollBarHeight-scrollIconHeight)*scrollPosition/100 -- value is positive currentScrollY = scrollY + newScrollY -- and render it > dxDrawImage(scrollX, currentScrollY, scrollIconWidth, scrollIconHeight, ...) -- event when player scroll mouse addEventHandler( "onClientKey", root, function (button, press) local offset = 1 -- move by 1 value when scrolled, higher value = scroll faster if button == "mouse_wheel_up" then scrollPosition = math.max(0, scrollPosition - offset) elseif button == "mouse_wheel_down" then scrollPosition = math.min(100, scrollPosition + offset) end end )
-
Using table and set the key based on it's id. entrance = {} -- then add to table so you can get it later entrance[interiorID] = createMarker() -- simply get marker using theMarker = entrance[id]
-
It's better if you set an Account ID on player register, and use primary key ID on database as account id. You can use. SELECT MAX(id)+1 AS lastid FROM `your_table` To get last highest ID for account ID when player register.
-
What's the error on Debug? That command take your own money.
-
Using Event Handler, something like this Client Side function onGUIStartOpen () triggerServerEvent("onGUIStartOpenServer", localPlayer) end addCommandHandler("opengui", onGUIStartOpen) function openGUIPanel () -- Your code end addEvent("openGUIPanel", true) addEventHandler("openGUIPanel", root, openGUIPanel) Server Side function onGUIStartOpenServer () local username = getAccountName(getPlayerAccount(client)) if isObjectInACLGroup ("user."..username, aclGetGroup ( "Admin" ) ) then triggerClientEvent(client, "openGUIPanel", client) end end addEvent("onGUIStartOpenServer", true) addEventHandler("onGUIStartOpenServer", root, onGUIStartOpenServer)
-
So, I was working on scrollbar stuff on DX function, took me a while to figure it out how to make calculation for it. So far, I have this: local visibleHeight -- the visible height (panel height) local overallHeight -- overall height for all items local scrollPosition -- I suggest you to make it 0 - 100 range local itemCoorY -- static coordinate Y for item (initial Y position when item created) local currentCoorY = itemCoorY -- current Y coordinate, when it started, default is itemCoorY (assuming scroll pos is zero) -- If there is no invisible item then we don't need to calculate this. if overallHeight <= visibleHeight then return end -- Formula = scroll bar percentage divided by the invisible height newY = scrollPosition/100*(overallHeight-visibleHeight) currentCoorY = itemCoorY - newY -- newY is negative value, because item goes up when it scrolled. Hope it help you.
-
Simply, theElement variable isn't element, the problem is from another script calling that function.
-
You need to inject mouse click on browser using these: injectBrowserMouseDown injectBrowserMouseUp injectBrowserMouseMove injectBrowserMouseWheel And also add an event onClientBrowserNavigate to detect if browser loads new url.
-
1. If image is GUI element, why not using onClientGUIClick event? Home = guiCreateStaticImage(0, y+25, 20, 25, "home.png", false, window) addEventHandler("onClientGUIClick", Home, clientClicking, false) 2. Im not sure what are you trying to do with this code if site:sub(0, 22) == "http://www.http://www." then guiSetText(edit_site, "http://www.http://www."..site:sub(0, 22)) --> this, you keep adding that spam return elseif site:sub(0, 18) == "http://www.http://" then guiSetText(edit_site, "http://www."..site:sub(0, 18)) --> also this return end That code, of course will spam that http. String will repeat because you keep adding it. You may use gsub, to remove that spam. site:gsub("http://www.http://www.", "") -- remove spam -- or site:gsub("http://www.http://www.", "http://www.") -- replace it with http://www.
-
mouseOverScrollbar = false addEventHandler("onClientClick", root, function (button, state, cx, cy) local x, y -- your scrollbar position local width, height -- your scrollbar with and height if button == "left" then if state == "down" then if ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) then mouseOverScrollbar = true else mouseOverScrollbar = false end elseif state == "up" then mouseOverScrollbar = false end end end ) addEventHandler( "onClientCursorMove", root, function () if mouseOverScrollbar then -- your calculation here end end )
-
Like IIYAMA said, mostly, because of element data. Avoid using element data unless you really need to.
-
function getPlayerJob(job) return exports.blabla:getPlayerJob(true) == job end Place it on your script, it will return a boolean value.
-
local scw,sch = guiGetScreenSize() local cursorX,cursorY = getCursorPosition() local absX,absY = cursorX*scw,cursorY*sch Code above will always return correct absolute coordinate. Maybe you have some problem on client click event, because it's dragging.
-
You could easily do query below to get top 10 points SELECT * FROM your_table SORT BY `points` DESC LIMIT 10 Or, you can fetch all data from SQL then store it to LUA table SELECT * FROM `your_table` Every time resource started, and store it to LUA table. addEventHandler("onResourceStart", resourceRoot, function () local Q = dbQuery = (connection, "SELECT * FROM `your_table_here`") local result = dbPoll(Q, -1) points = result end ) Then send it to client using triggerClientEvent And sort it on client side like below. And do iteration to output correct ranking position points = {} -- this table from mysql query table.sort(points, function (a, b) return a.points > b.points end) -- sort table based on their points descending for i, v in pairs(points) do -- Your dx output and coordinate calculation here end And do not forget to update the table for every point change and send it to client, so player get the realtime data.
-
I think you need setCameraMatrix. and also use onClientPreRender event so you can update camera position every frame.
- 1 reply
-
- setcameratarget
- flickering
-
(and 1 more)
Tagged with: