Jump to content

[HELP] Why not working this script?


Tokio

Recommended Posts

client side: 

Spoiler

local screenW, screenH = guiGetScreenSize()

function asdasd(amount)
        dxDrawRectangle(screenW * 0.8069, screenH * 0.5656, screenW * 0.1931, screenH * 0.0289, tocolor(0, 0, 0, 178), false)
        dxDrawText("Kaptál #01AC41"..amount.."Ft-ot.", screenW * 0.8063, screenH * 0.5656, screenW * 1.0000, screenH * 0.5944, tocolor(255, 255, 255, 255), 1.00, "sans", "center", "center", false, false, false, true, false)
end


addEvent ( "theclienteventname", true ) 
addEventHandler ( "theclienteventname", root, function ( amount ) 
addEventHandler("onClientRender", root, asdasd)
end
)

 

server side:

Spoiler

setTimer(function ()
local amount = math.random(2000,50000)
for id, player in ipairs(getElementsByType("player")) do
givePlayerMoney ( player, amount )
outputChatBox ( "* [Pénz] Kaptál #01AC41"..amount.." forintot.", player, 255, 255, 255, true )
triggerClientEvent ( player, "theclienteventname", player, amount)
end
end,5000,0)

 

c.lua:5: attempt to concatenate local amount

Link to comment
  • Moderators

That is not the error/warning.

But this:

c.lua:5: attempt to concatenate local 'amount' (a nil value)

Which makes the meaning of the issue very different.

 

local screenW, screenH = guiGetScreenSize()

local amount
function asdasd()
        dxDrawRectangle(screenW * 0.8069, screenH * 0.5656, screenW * 0.1931, screenH * 0.0289, tocolor(0, 0, 0, 178), false)
        dxDrawText("Kaptál #01AC41"..amount.."Ft-ot.", screenW * 0.8063, screenH * 0.5656, screenW * 1.0000, screenH * 0.5944, tocolor(255, 255, 255, 255), 1.00, "sans", "center", "center", false, false, false, true, false)
end


addEvent("theclienteventname", true ) 
addEventHandler("theclienteventname", root, function ( amount_ ) 
	amount = amount_
	addEventHandler("onClientRender", root, asdasd)
end)

 

  • Thanks 1
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...