Jump to content

property System


OrbTanT

Recommended Posts

Good I am creating a system of properties, I left to receive the profit every 5 minutes, I would like to change that, As leave accumulated profit after passing 5 minutes, For example I get 25000 every 5 minute, and when pass 20 minutes, The profit will arrive in 100000, After using a command /profit I can pick up the accumulated profit, for this I have created a xDrawRectangle to show the profit that the property already has.

client:

  
infoz = createPickup(2181.8864746094,1115.2287597656,12.34375,3,1273,0) 
  
local x,y = guiGetScreenSize() 
local Text = "Name: Come a lot" 
local Text2 = "Lucro:" 
  
--local Text4 = "" 
--local Text5 = "" 
  
local lastInfoPickupHit = 0 
local pickupInfoHandler = false 
function drawStuff() 
    if lastInfoPickupHit < getTickCount() then 
        if pickupInfoHandler then 
            pickupInfoHandler = false 
            removeEventHandler("onClientRender", root, drawStuff) 
        end 
    end 
    dxDrawRectangle ( 60, 320, 250, 175, tocolor(0, 0, 0, 175), false) 
    dxDrawText ( "INFORMAÇÃO", 145, 340, 319, 426, tocolor(255, 255, 255, 255), 1.0, "default-bold" ) 
    dxDrawText ( Text, 80, 380, 319, 426, tocolor(255, 255, 255, 255), 1.3, "default" ) 
    dxDrawText ( Text2, 80, 430, 319, 426, tocolor(255, 255, 255, 255), 1.3, "default" ) 
    ---dxDrawText ( Text4, x/12, y/1.6, x, y, tocolor ( 255, 255, 255, 255 ), 0.9, "clear" ) 
    ---dxDrawText ( Text5, x/12, y/2, x, y, tocolor ( 255, 0, 0, 255 ), 0.9, "clear" ) 
end 
  
  
addEventHandler("onClientPickupHit", infoz, 
function (player,matchingDimension) 
    if player == localPlayer and matchingDimension then 
        lastInfoPickupHit = getTickCount()+5000 
        if not pickupInfoHandler then 
            pickupInfoHandler = true 
            addEventHandler("onClientRender", root, drawStuff) 
        end 
    end 
end) 

server:

local prop = createBlip(2181.8864746094,1115.2287597656,12.34375,31) 
timers = {} 
function Hit ( player ) 
    outputChatBox ( "Propriedades: Digite /comprar", player ) 
    takePlayerMoney ( player, 200000 ) 
    timers [player] = setTimer ( function ( ) givePlayerMoney ( player, 25000 ) end, 300*1000, 0 ) 
end 
 addCommandHandler( "comprar" , Hit ) 

DxRectangle:

ff85ea442a5e7e81a4bf25b1a2d7481e.png

Link to comment

I put in the dxdraw "moneyCasa", more in DxDraw appears the value NIL, how can I make to the Dx only appears the result, type is set to win 25000 every 5 minutes, and when you pass 15 minutes in DX will show the profit of 75000 that is accumulated.

client-

  
infoz = createPickup(2181.8864746094,1115.2287597656,12.34375,3,1273,0) 
  
local x,y = guiGetScreenSize() 
local Text = "Name: Come a lot" 
local Text2 = "Lucro:" 
  
--local Text4 = "" 
--local Text5 = "" 
  
local lastInfoPickupHit = 0 
local pickupInfoHandler = false 
function drawStuff() 
    if lastInfoPickupHit < getTickCount() then 
        if pickupInfoHandler then 
            pickupInfoHandler = false 
            removeEventHandler("onClientRender", root, drawStuff) 
        end 
    end 
    dxDrawRectangle ( 60, 320, 250, 175, tocolor(0, 0, 0, 175), false) 
    dxDrawText ( "INFORMAÇÃO", 145, 340, 319, 426, tocolor(255, 255, 255, 255), 1.0, "default-bold" ) 
    dxDrawText ( Text, 80, 380, 319, 426, tocolor(255, 255, 255, 255), 1.3, "default" ) 
    dxDrawText ( Text2, 80, 430, 319, 426, tocolor(255, 255, 255, 255), 1.3, "default" ) 
    dxDrawText ( tostring(moneyCasa), 135, 430, 319, 426, tocolor(255, 255, 255, 255), 1.3, "default" ) 
    ---dxDrawText ( Text4, x/12, y/1.6, x, y, tocolor ( 255, 255, 255, 255 ), 0.9, "clear" ) 
    ---dxDrawText ( Text5, x/12, y/2, x, y, tocolor ( 255, 0, 0, 255 ), 0.9, "clear" ) 
end 
  
  
addEventHandler("onClientPickupHit", infoz, 
function (player,matchingDimension) 
    if player == localPlayer and matchingDimension then 
        lastInfoPickupHit = getTickCount()+5000 
        if not pickupInfoHandler then 
            pickupInfoHandler = true 
            addEventHandler("onClientRender", root, drawStuff) 
        end 
    end 
end) 

server-

local prop = createBlip(2181.8864746094,1115.2287597656,12.34375,31) 
timers = {} 
precos={} 
  
function Hit ( player ) 
  outputChatBox ( "Propriedades: Digite /comprar", player ) 
local money = getPlayerMoney(player) 
if(money>=200000)then 
    takePlayerMoney ( player, 200000 ) 
precos[player]=200000 
    timers [player] = setTimer ( function ( ) precos[player]=precos[player]+25000 setElementData(player,"moneyCasa",tonumber(precos[player])) end, 300000, 0 ) 
else 
outputChatBox("Você não tem dinheiro suficiente",player) 
end 
end 
 addCommandHandler( "comprar" , Hit ) 

DxDraw-

bdcf315ff42222bdfda4bc86d6d26e3c.png

Do I have to use setElementData to fetch the result of values and play in a "tostring" within the DxDrawRectangle, i not understand much of setElementData someone can help me

Link to comment

Good, tried to fix the DxDraw, to go adding every 5 minutes +25000 in profit, more is occurring the following error and does not add the profit in DxDraw, someone can help me?

client:

  
local lucro = getElementData("lucro") or 0 
  
infoz = createPickup(2181.8864746094,1115.2287597656,12.34375,3,1273,0) 
  
local x,y = guiGetScreenSize() 
local Text = "Name: Come a lot" 
local Text2 = "Lucro:" 
  
--local Text4 = "" 
--local Text5 = "" 
  
local lastInfoPickupHit = 0 
local pickupInfoHandler = false 
function drawStuff() 
    if lastInfoPickupHit < getTickCount() then 
        if pickupInfoHandler then 
            pickupInfoHandler = false 
            removeEventHandler("onClientRender", root, drawStuff) 
        end 
    end 
    dxDrawRectangle ( 60, 320, 250, 175, tocolor(0, 0, 0, 175), false) 
    dxDrawText ( "INFORMAÇÃO", 145, 340, 319, 426, tocolor(255, 255, 255, 255), 1.0, "default-bold" ) 
    dxDrawText ( Text, 80, 380, 319, 426, tocolor(255, 255, 255, 255), 1.3, "default" ) 
    dxDrawText ( Text2, 80, 430, 319, 426, tocolor(255, 255, 255, 255), 1.3, "default" ) 
    dxDrawText ( tostring(lucro), 135, 430, 319, 426, tocolor(255, 255, 255, 255), 1.3, "default" ) 
    ---dxDrawText ( Text4, x/12, y/1.6, x, y, tocolor ( 255, 255, 255, 255 ), 0.9, "clear" ) 
    ---dxDrawText ( Text5, x/12, y/2, x, y, tocolor ( 255, 0, 0, 255 ), 0.9, "clear" ) 
end 
  
  
addEventHandler("onClientPickupHit", infoz, 
function (player,matchingDimension) 
    if player == localPlayer and matchingDimension then 
        lastInfoPickupHit = getTickCount()+5000 
        if not pickupInfoHandler then 
            pickupInfoHandler = true 
            addEventHandler("onClientRender", root, drawStuff) 
        end 
    end 
end) 

server:

local prop = createBlip(2181.8864746094,1115.2287597656,12.34375,31) 
timers = {} 
precos={} 
  
function Hit ( player ) 
  outputChatBox ( "Propriedades: Digite /comprar", player ) 
local money = getPlayerMoney(player) 
if(money>=200000)then 
    takePlayerMoney ( player, 200000 ) 
precos[player]=200000 
    local currentlucro = getElementData("lucro") or 0 
    timers [player] = setTimer ( function ( ) setElementData("lucro", currentlucro +25000) end, 1000, 0 )    
else 
outputChatBox("Você não tem dinheiro suficiente",player) 
end 
end 
 addCommandHandler( "comprar" , Hit ) 

7d1b5bab9a54f8c3e01caef961ac0b49.png

I know that the script has errors well visible, more is what I managed to do base

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...