-
Posts
1,273 -
Joined
-
Last visited
-
Days Won
1
Everything posted by GTX
-
Yes, but it doesn't create them, that's the problem
-
When I press the first button works fine, but when I press any other button the label destroys
-
This code doesn't work. I think guiCreateColorLabel doesn't return element. function guiCreateColorLabel(ax, ay, bx, by,str, parent, bool) local pat = "(.-)#(%x%x%x%x%x%x)" local s, e, cap, col = str:find(pat, 1) local last = 1 while s do if cap == "" and col then r,g,b = tonumber("0x"..col:sub(1, 2)), tonumber("0x"..col:sub(3, 4)), tonumber("0x"..col:sub(5, 6)) end if s ~= 1 or cap ~= "" then local w = dxGetTextWidth(cap) lbl = guiCreateLabel(ax, ay, ax + w, by,cap,parent, bool) if r == nil then r = 255 end if g == nil then g = 255 end if b == nil then b = 255 end guiLabelSetColor(lbl,r,g,b) ax = ax + w r,g,b = tonumber("0x"..col:sub(1, 2)), tonumber("0x"..col:sub(3, 4)), tonumber("0x"..col:sub(5, 6)) end last = e + 1 s, e, cap, col = str:find(pat, last) end if last <= #str then cap = str:sub(last) local w = dxGetTextWidth(cap) lbl2 = guiCreateLabel(ax, ay, ax + w, by,cap,parent, bool) guiLabelSetColor(lbl2,r,g,b) end end
-
Okay, now I got another problem. I created more buttons and I don't know how to change text... Maybe I need to destroy and create it again. Client: btn_show_points = guiCreateButton(349,47,114,36,"Points",false) btn_show_cash = guiCreateButton(474,47,114,36,"Cash",false) btn_show_wins = guiCreateButton(349,97,114,36,"Wins",false) btn_show_ttset = guiCreateButton(474,97,114,36,"Top times set",false) btn_show_played = guiCreateButton(349,47,114,36,"Maps played",false) btn_show_deaths = guiCreateButton(474,47,114,36,"Deaths",false) function theButtons () if source == btn_show_points then triggerServerEvent("recievePrefix", localPlayer, "points") end if source == btn_show_cash then triggerServerEvent("recievePrefix", localPlayer, "money_q") end if source == btn_show_ttset then triggerServerEvent("recievePrefix", localPlayer, "ttset") end if source == btn_show_played then triggerServerEvent("recievePrefix", localPlayer, "mapsplayed") end if source == btn_show_deaths then triggerServerEvent("recievePrefix", localPlayer, "deaths") end end addEventHandler ( "onClientGUIClick", btn_show_points, theButtons ) addEventHandler ( "onClientGUIClick", btn_show_cash, theButtons ) addEventHandler ( "onClientGUIClick", btn_show_ttset, theButtons ) addEventHandler ( "onClientGUIClick", btn_show_played, theButtons ) addEventHandler ( "onClientGUIClick", btn_show_deaths, theButtons ) addEvent( 'onAccountsSend',true ) local labels = { } addEventHandler( 'onAccountsSend',root, function( t ) if #labels == 0 then for index, data in ipairs( t ) do guiCreateColorLabel( 13,20 * index + 39,500,276,'#ffffff#'..tostring( index )..": "..tostring( data.account ),false ) if index == 10 then break end end labels[ 1 ] = true end end ) Server: function sortAccounts(prefix) local rowdata = { } for _, account in pairs( getAccounts( ) ) do rowdata[ #rowdata + 1 ] = { account = getAccountData( account, "playername" ), points = getAccountData( account, tostring(prefix) ) } end table.sort( rowdata, function ( a, b ) return ( tonumber( a.points ) or 0 ) > ( tonumber( b.points ) or 0 ) end ) return rowdata end function tables(prefix) for index, data in ipairs( sortAccounts( ) ) do if index == 3 then break end end triggerClientEvent( 'onAccountsSend',root,sortAccounts(prefix) ) end addEvent("recievePrefix", true) addEventHandler("recievePrefix", root, tables) Now I think this is already impossible lol...
-
You can't edit it. Also you can't read it (Can you?)
-
This is compiled file! Post uncompiled one.
-
Code is top secret I'll send you via PM
-
Still the same problem, when I click on the button twice it creates two labels
-
Hello, I got this addEvent( 'onAccountsSend',true ) local labels = { } addEventHandler( 'onAccountsSend',root, function( t ) for index, data in ipairs( t ) do if labels[ index ] == nil or labels[ index ] == false then labels[ index ] = guiCreateColorLabel(13,20 * index + 39,500,276,'#ffffff#'..tostring( index )..": "..tostring( data.account ),false,tab_leaderboard ) else guiSetText(labels[ index ], '#ffffff#'..tostring( index )..": "..tostring( data.account )) end if index == 10 then break end end end ) Everytime when I click on button, script creates new label.
-
Show us meta.xml (If you don't have it, create it)
-
pilotmark=createMarker(1953.82,-2177.61,12.65,"cylinder",1,148,0,211,70) addEventHandler( "onClientMarkerHit",pilotmark, function( hitElement, matchingDimension ) if hitElement == localPlayer then showCursor( true ) xWindow = guiCreateWindow(0.3184,0.2568,0.2500,0.356,"",true) buttonYes = guiCreateButton(0.03,0.86,0.45,0.10,"yes!",true,xWindow) buttonNo = guiCreateButton(0.505,0.86,0.45,0.10,"no",true,xWindow) --guiCreateStaticImage (0.05, 0.2, 0.9, 0.5,"/bankrob.png",true,xWindow) addEventHandler ( "onClientGUIClick", buttonYes, function( ) showCursor( false ) guiSetVisible( xWindow,false ) triggerServerEvent( "pilotJobx", localPlayer, localPlayer) --triggerServerEvent("ServerPlaySoundRobbery",localPlayer) ---outputChatBox( "`Вы захватили банк вы должны продержаться 5 минут.",255,0,0 ) end ,false ) addEventHandler ( "onClientGUIClick", buttonNo, function ( ) showCursor( false ) guiSetVisible( xWindow,false ) end ,false ) end end ) Try it
-
I think vehicle weapons are also possible. Check this out, toggleControl
-
You can use that tool to move DX texts: viewtopic.php?f=91&t=24262
-
addEventHandler("onResourceStart", resourceRoot, function() exports.scoreboard:scoreboardAddColumn("Rank") end) function tables( ) outputChatBox( "Top 3 points:", root, 255,255,255 ) for index, data in ipairs( sortAccounts( ) ) do outputChatBox("#"..tostring( index )..": ".. tostring( data.account ) .." - ".. tostring( data.points ), root, 255, 255, 255 ) setElementData(tostring(data.account), "Rank", index) if index == 3 then break end end triggerClientEvent( 'onAccountsSend',root,sortAccounts( ) ) end addCommandHandler( "top", tables ) Errors: [16:31:30] WARNING: [gtx]\upanel\stats_s.lua:182: Bad argument @ 'setElementData' [Expected element at argument 1, got string '-DTR-GTX#ff0000#'] [16:31:30] WARNING: [gtx]\upanel\stats_s.lua:182: Bad argument @ 'setElementData' [Expected element at argument 1, got boolean]
-
Hello, I have this: function click () emptytext = "" if source == grid_players then local selectedPlayer = guiGridListGetItemText ( grid_players, guiGridListGetSelectedItem ( grid_players ), 1 ) if not (selectedPlayer == emptytext) then outputChatBox ( selectedPlayer ) -- output it to chat box guiSetText(lbl_f_showstats, "Showing statistics of the player " ..tostring(selectedPlayer)) triggerServerEvent("gStats", root, selectedPlayer) end end end And this: function get(argument) local acc = getPlayerAccount(argument) if not isGuestAccount ( acc ) then local wins = getPlayerAccount(acc, "wins") or "NO" local deaths = getPlayerAccount(acc, "deaths") or " NO" local cash = getPlayerAccount(acc, "cash") or " NO$" local points = getPlayerAccount(acc, "points") or " NO" local ttset = getPlayerAccount(acc, "ttset") or " NO" --triggerServerEvent("rStats", root, wins, deaths, cash, points, ttset) outputChatBox("TRIGGERED: " .. wins .. deaths .. cash .. points .. ttset) else outputChatBox("GUEST") end end addEvent("gStats", true) addEventHandler("gStats", root, get) Returns: [14:55:43] WARNING: [gtx]\upanel\stats_s.lua:5: Bad argument @ 'getPlayerAccount' [Expected element at argument 1] Thanks in advance!
-
It still doesn't show, nothing in debug EDIT: It shows only "#1:" and not account name. No errors.
-
Hello, I have this: function tables() outputChatBox("Top 3 points:", getRootElement(), 255,255,255) for index, data in ipairs(sortAccounts()) do outputChatBox("#"..tostring(index)..": ".. tostring(data.account) .." - ".. tostring(data.points), getRootElement(), 255, 255, 255) if index == 3 then break end end end addCommandHandler("top", tables) function sortAccounts() local rowdata = {} for index, account in pairs(getAccounts()) do rowdata[index] = { account = getAccountName(account), points = getAccountData(account,"Points"), } end local comparator = function (a, b) return (tonumber(a.points) or 0) > (tonumber(b.points) or 0) end table.sort(rowdata, comparator) return rowdata end But now I need to get that into client-side like: for index, data in ipairs(getElementsByType("player")) do lbl_f_block10[i] = guiCreateLabel(13,53 * i,26,276,"#"..tostring(index)..": "..tostring(data.account).." - "..tostring(data.points),false,tab_leaderboard) guiSetFont(lbl_f_block10[i],"clear-normal") if index == 10 then break end end But I have no idea. Thanks in advance
-
Hello! I want to buy VPS, but first I need to know how to install the server on it. Is someone interested in explaining on how to install a server on VPS? I would be very very grateful to you. I haven't got much experience on Linux and PHP language. Thanks in advance!
-
Did you refresh and start the script?