Jump to content

STINGX

Members
  • Posts

    12
  • Joined

  • Last visited

STINGX's Achievements

Square

Square (6/54)

0

Reputation

  1. my test code in panel dxGridListSetItemText(list2, 1, "1")
  2. I'm trying to make dxGridListSetItemText like guiGridListSetItemText to change text in my gridlist lib and this my code ...... function dxGridListSetItemText(element, columns, name) if self.items[columns] and self.items[columns][element] then self.items[columns][element].text = text end end
  3. function dxGridList( x, y, w, h, parent) local self, element = createElement( 'dxGridList', parent, sourceResource ) if self then self.x = math.round(x) self.y = math.round(y) self.w = math.round(w) self.h = math.round(h) self.parent = parent self.colorbackground = tocolor( 20, 20, 30, 255 ) self.colortext = tocolor(255, 255, 255, 255) self.colorselected = tocolor(120, 95, 205, 255) if self.parent then self.offsetX = self.x - Cache[self.parent].x self.offsetY = self.y - Cache[self.parent].y end self.font = Files['font']['Basic-Regular'][10] self.fontH = dxGetFontHeight( 1, self.font ) -- self.scrollV = dxScroll(self.x+self.w-math.round(17*sh), self.y, self.h, true, parent) self.scrollH = dxScroll(self.x, self.y+self.h-math.round(17*sh), self.w-math.round(17*sh), false, parent) Cache[self.scrollH].isVisible = false Cache[self.scrollV].isVisible = false Cache[self.scrollV].gridlist = element self.from = nil self.to = nil self.mul = 0 self.columns = {} self.items = {} self.scrollX = 0 self.scrollY = 0 -- self.selected = -1 self.update = true Timer(function() self.update = true end, 600, 1) Timer(function() self.update = true end, 1200, 1) return element end end function dxGridListAddItem(element, ...) local self = Cache[element] if self then table.insert(self.items, {...}) self.update2 = true return true end return false end function dxGridListRemoveItem(element, index) local self = Cache[element] if self then if self.items[index] then table.remove(self.items, index) self.update2 = true return true end end return false end function dxGridListAddColumn(element, name, size) local self = Cache[element] if self then table.insert(self.columns, {name, size}) self.update = true return name end return false end -------- My Code function dxGridListSetItemText(element, columns, name) if self.items[columns] and self.items[columns][element] then self.items[columns][element].text = text end end How can i make setItemText for this grid , i tryed but it's not work.
  4. I don't have error , I failed to create this part of code only cause I don't know how to check decimals decrease or increase to give or take money from player , I added this code in client and server function round(number, decimals, method) decimals = decimals or 0 local factor = 10 ^ decimals if (method == "ceil" or method == "floor") then return math[method](number * factor) / factor else return tonumber(("%."..decimals.."f"):format(number)) end end and this is trigger using this function in gridlist , triggerServerEvent("test",localPlayer,round(d.diff[2],2))
  5. This code by timer increase or decrease okay? I don't now how to give player money or take money by this value --- This is trigger Client triggerServerEvent( "onClientStockTransaction", localPlayer, n ) ------------------------------- addEvent( "onClientStockTransaction", true ) addEventHandler( "onClientStockTransaction", root, function( money,n ) local take = exports.global:getMoney(source, tonumber(money)-n) triggerClientEvent( source, "onConfirmPayment", source ) if decimals >= 0 then exports.global:takeMoney( source, tonumber(take)-n ) else -- decimals === exports.global:giveMoney( source, tonumber(take)+n ) end end) I tried to give money or lose money but failed
  6. I already tried but I failed , I need to take player money or give with value in gridlist
  7. I need if value in gridlist change to green give player money with this value or lose his money with this value if it red Like forex , I want to know check value with decimals
  8. Hello guys , I started working on the stocks system, but I have some problems. I want when the stock is positive ( green ), he gives him money, and when the stock is negative ( red ), he takes money from the player, that is, he buys a stock, and if he loses he loses money , like forex Thanks , --- Gridlist Value Test ---- for i,d in pairs(data) do local r = dgsGridListAddRow(GUIEditor.gridlist[1]) dgsGridListSetItemText(GUIEditor.gridlist[1], r, 1, d.name, false, false ) dgsGridListSetItemText(GUIEditor.gridlist[1], r, 2, "$ "..round(d.pps,2)*totalMidifier, false, false ) dgsGridListSetItemText(GUIEditor.gridlist[1], r, 3, (d.diff[1] and "▲ " or "▼ " )..round(d.diff[2],2).."%", false, false ) dgsGridListSetItemColor(GUIEditor.gridlist[1], r, 3, d.diff[1] and 0 or 255, d.diff[1] and 255 or 0, 0 ) triggerServerEvent("test",localPlayer,round(d.diff[2],2)) end for k,s in pairs(playerData) do local r = dgsGridListAddRow(GUIEditor.gridlist[2]) dgsGridListSetItemText( GUIEditor.gridlist[2],r, 1, k, false, false ) dgsGridListSetItemText( GUIEditor.gridlist[2],r, 2, s[1], false, false ) local old = s[2]*s[1] local new = getCompPPS( k )*s[1] local change = new-old >= 0 and true dgsGridListSetItemText(GUIEditor.gridlist[2], r, 3, "$"..round(new-old,2), false, false ) --dgsGridListSetItemText(GUIEditor.gridlist[2], r, 3, (d.diff[1] and "▲ " or "▼ " )..round(d.diff[2],2).."%", false, false ) dgsGridListSetItemColor( GUIEditor.gridlist[2],r, 3, change and 0 or 255, change and 255 or 0, 0 ) ----- client ----- local c = currentData[selectedBuyRow+1].name local n = currentData[selectedBuyRow+1].pps*totalMidifier if exports.global:getMoney(localPlayer ) - n >= 0 then triggerServerEvent( "onClientStockTransaction", localPlayer, n ) local temp = localPlayer:getData "Stocks" or {} for k,d in pairs(currentData) do if d.name == c then temp[d.name] = {temp[d.name] and temp[d.name][1]+totalMidifier or totalMidifier,currentData[selectedBuyRow+1].pps} end end localPlayer:setData("Stocks",temp,false) buyD = true saveStocks( ) -- triggerServerEvent( "onClientStockTransaction", localPlayer, -n ) else outputChatBox( "test") end ----- Server ----- function round(number, decimals, method) decimals = decimals or 0 local factor = 10 ^ decimals if (method == "ceil" or method == "floor") then return math[method](number * factor) / factor else return tonumber(("%."..decimals.."f"):format(number)) end end addEvent( "TriggerMoneyTest", true ) addEventHandler( "TriggerMoneyTest", root, function( money,n ) local take = exports.global:getMoney(source, tonumber(money)-n) triggerClientEvent( source, "onConfirmPayment", source ) if decimals >= 0 then exports.global:takeMoney( source, tonumber(take)-n ) else -- decimals === exports.global:giveMoney( source, tonumber(take)+n ) end end)
  9. STINGX

    Qustion

    How can I make mutli-faction in roleplay (Caharacter have more than 1 faction to 3)
×
×
  • Create New...