Jump to content

[HELP] Ciro Aritmetich


Recommended Posts

[2018-07-25 00:24:28] ERROR: [gameplay]/-Kumarhane/server.lua:120: attempt to perform arithmetic on local 'ciro' (a boolean value)

 

addEventHandler("onPickupHit", kumarhanepickup, function(player)
    if getElementType ( player ) ~= "player" then return end
	cancelEvent()
    local zaman = getAccountData(KumarhaneTable.hesap,"Zaman")
    local sahip = getAccountData(KumarhaneTable.hesap,"Sahip")	
    local ciro = getAccountData(KumarhaneTable.hesap,"Ciro") or 0
    local sahipmi = getAccountName(getPlayerAccount(player))
	if zaman ~= "Bilinmiyor" then
        zaman = secoundsToDays(tonumber(zaman)-getRealTime().timestamp)
    end
    if ciro == "Bilinmiyor" then
        ciro = 0
    end		
	if sahip == sahipmi then
	    triggerClientEvent(player, "KumarhanePanel", getRootElement(getThisResource()),sahip,zaman,ciro,true)
	else
	    triggerClientEvent(player, "KumarhanePanel", getRootElement(getThisResource()),sahip,zaman,ciro,false)	
	end
end)

What should I do please show

Link to comment
local KumarhaneTable = {
    markerPos = {
	    {2241.845,1618.0186,1005.3,"cylinder", 1, 0, 0, 255, 255},
	    {2241.0264,1615.9229,1005.3,"cylinder", 1, 0, 0, 255, 255},		
	    {2231.0354,1618.2883,1005.3,"cylinder", 1, 0, 0, 255, 255},	
	    {2230.1758,1615.9615,1005.3,"cylinder", 1, 0, 0, 255, 255},	
	    {2230.1707,1596.1257,1005.3,"cylinder", 1, 0, 0, 255, 255},	
	    {2230.1282,1590.5557,1005.3,"cylinder", 1, 0, 0, 255, 255},	
	    {2241.9907,1590.5559,1005.3,"cylinder", 1, 0, 0, 255, 255},	
	    {2241.9663,1596.1257,1005.3,"cylinder", 1, 0, 0, 255, 255},			
    },
    deger = 10000000,
	hesap = getAccount("paradox")
}

--[[local kumarhanecubo = createColCuboid(2179.8726,1659.6299,11.046875,17,38,5)

function kumarhanecubohit(hitElement, matchingDimension)
if (isElement(hitElement)) and (getElementType (hitElement) == "player") then
 setTimer(function()
 if getElementData(hitElement,"GuvenliBolge")~=true then
triggerClientEvent (hitElement, "enableGodMode", hitElement)
toggleControl (hitElement, "fire", false)
toggleControl (hitElement, "next_weapon", false)
toggleControl (hitElement, "previous_weapon", false)
toggleControl (hitElement, "aim_weapon", false)
toggleControl (hitElement, "vehicle_fire", false)
setElementData(hitElement, "GuvenliBolge", true)
end
end,500,1)
end
end
addEventHandler ("onColShapeHit", kumarhanecubo,kumarhanecubohit)

function kumarhanecuboleave(leaveElement, matchingDimension)
if (getElementType (leaveElement) == "player") then
triggerClientEvent (leaveElement, "disableGodMode", leaveElement)
toggleControl (leaveElement, "fire", true)
toggleControl (leaveElement, "next_weapon", true)
toggleControl (leaveElement, "previous_weapon", true)
toggleControl (leaveElement, "aim_weapon", true)
toggleControl (leaveElement, "vehicle_fire", true)
setElementData(leaveElement, "GuvenliBolge", false)
end
end
addEventHandler ("onColShapeLeave", kumarhanecubo,kumarhanecuboleave)--]]

addEventHandler("onResourceStart",resourceRoot,function()	
	for i, loc in ipairs(KumarhaneTable.markerPos) do
		local marker = createMarker(unpack(KumarhaneTable.markerPos[i]))	
        setElementDimension(marker,62000)
        setElementInterior(marker,1)		
		addEventHandler("onMarkerHit",marker,onMarkerHitForKumar)
	end	
createBlip(2192.1455,1677.2106,12.303028, 52, 1, 0, 0, 0,255,0,200 )	
end)

addCommandHandler("kumarhanetesting00",function()
	setAccountData(KumarhaneTable.hesap,"Sahip","Satılık")
	setAccountData(KumarhaneTable.hesap,"Zaman","Bilinmiyor")
	setAccountData(KumarhaneTable.hesap,"Ciro","Bilinmiyor")
end)

function onMarkerHitForKumar(player,md)
    if getElementType ( player ) == "player" and md then
	    triggerClientEvent(player, "RuletPanel", getRootElement(getThisResource()))	
	end
end

kumarhanepickup = createPickup (2194.8066,1668.5844,12.367188, 3, 1274)

addEventHandler("onPickupHit", kumarhanepickup, function(player)
    if getElementType ( player ) ~= "player" then return end
	cancelEvent()
    local zaman = getAccountData(KumarhaneTable.hesap,"Zaman")
    local sahip = getAccountData(KumarhaneTable.hesap,"Sahip")	
    local ciro = getAccountData(KumarhaneTable.hesap,"Ciro") or 0
    local sahipmi = getAccountName(getPlayerAccount(player))
	if zaman ~= "Bilinmiyor" then
        zaman = secoundsToDays(tonumber(zaman)-getRealTime().timestamp)
    end
    if ciro == "Bilinmiyor" then
        ciro = 0
    end		
	if sahip == sahipmi then
	    triggerClientEvent(player, "KumarhanePanel", getRootElement(getThisResource()),sahip,zaman,ciro,true)
	else
	    triggerClientEvent(player, "KumarhanePanel", getRootElement(getThisResource()),sahip,zaman,ciro,false)	
	end
end)

function KumarhaneSatinAl()
    local sahip = getAccountData(KumarhaneTable.hesap,"Sahip")
	if sahip == "Satılık" then
	    local para = getPlayerMoney(source)
		if para >= KumarhaneTable.deger then
		    takePlayerMoney(source,KumarhaneTable.deger)
			setAccountData(KumarhaneTable.hesap,"Zaman",getRealTime().timestamp+86400*7)
			setAccountData(KumarhaneTable.hesap,"Sahip",getAccountName(getPlayerAccount(source)))
		    setAccountData(KumarhaneTable.hesap,"Ciro",0)			
			outputChatBox("#ffff00"..getPlayerName(source).." #ff7f00Adlı Oyuncu Kumarhaneyi 1 Haftalığına Kiraladı",root,255,0,255,true)
		end
	else
	    outputChatBox("Kumarhane Daha Önceden Kiralandı",source,255,0,0,true)	
	end
end
addEvent("KumarhaneSatinAl", true)
addEventHandler("KumarhaneSatinAl", getRootElement(getThisResource()),KumarhaneSatinAl)

function KumarhaneCiro(miktar,type)
    local ciro = getAccountData(KumarhaneTable.hesap,"Ciro")
    if ciro=="Bilinmiyor" then
	    if type==true then
		    setAccountData(KumarhaneTable.hesap,"Ciro",miktar)
		else
		    setAccountData(KumarhaneTable.hesap,"Ciro",0-miktar)
		end
	else
	    if type==true then
		    setAccountData(KumarhaneTable.hesap,"Ciro",ciro+miktar)
		else
		    setAccountData(KumarhaneTable.hesap,"Ciro",ciro-miktar)
		end	 
	end
end
addEvent("KumarhaneCiro", true)
addEventHandler("KumarhaneCiro", getRootElement(getThisResource()),KumarhaneCiro)

function KumarhaneGiveMoney(money)
givePlayerMoney(source,money)
end
addEvent("KumarhaneGiveMoney", true)
addEventHandler("KumarhaneGiveMoney", getRootElement(getThisResource()),KumarhaneGiveMoney)

function KumarhaneTakeMoney(money)
takePlayerMoney(source,money)
end
addEvent("KumarhaneTakeMoney", true)
addEventHandler("KumarhaneTakeMoney", getRootElement(getThisResource()),KumarhaneTakeMoney)

function KumarhaneCiroCek(miktar)
    local ciro = getAccountData(KumarhaneTable.hesap,"Ciro")
    local sahip = getAccountData(KumarhaneTable.hesap,"Sahip")	
	local accountname = getAccountName(getPlayerAccount(source))
    if ciro~="Bilinmiyor" then   
	    if accountname == sahip then
		    if miktar <= ciro then
			    setAccountData(KumarhaneTable.hesap,"Ciro",ciro-miktar)
				givePlayerMoney(source,miktar)
				triggerClientEvent(source, "KumarhanePanelGuncelle", getRootElement(getThisResource()),ciro-miktar)
			end
		end
	end
end
addEvent("KumarhaneCiroCek", true)
addEventHandler("KumarhaneCiroCek", getRootElement(getThisResource()),KumarhaneCiroCek)

setTimer(function()
local zaman = getAccountData(KumarhaneTable.hesap,"Zaman")
local sahip = getAccountData(KumarhaneTable.hesap,"Sahip")
if sahip ~= "Satılık" then
  if zaman then
    if zaman < getRealTime().timestamp then
	    setAccountData(KumarhaneTable.hesap,"Sahip","Satılık")
	    setAccountData(KumarhaneTable.hesap,"Zaman","Bilinmiyor")
	    setAccountData(KumarhaneTable.hesap,"Ciro","Bilinmiyor")			
		outputChatBox("#00ffffKumarhane Satışa Çıktı Gidip Kiralayabilirsin (F6 > Kumarhane)",root,255,255,0,true)
	end
  end
end
end,15*60000,0)

function secoundsToDays(secound)
	if secound then
		local value,state
		if secound >= 86400 then
			value = math.floor(secound/86400)
			if secound - (value*86400) > (60*60) then
				value = value.." gün "..math.floor((secound - (value*86400))/(60*60)).." saat"
			else
				value = value.." gün"
			end
			state = 1
		else
			value = math.floor(secound/(60*60)).." saat"
			state = 2
		end
		return value
	else
		return false
	end
end

 

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...