Jump to content

ENVIAR DINHEIRO SUJO


Recommended Posts

Galera, to tentando editar um script de enviar dinheiro para que ao invés de enviar dinheiro normal, ele envie dinheiro sujo, porem quando eu tento enviar algo ele da erro no debug e não envia nada. Abaixo está os scripts.

Client Side

local screenW,screenH = guiGetScreenSize()
local px,py = 1366,768
local x,y = (screenW/px), (screenH/py)
local Jogador = getPlayerFromName(name)
local sujo = getElementData(source, "EmentDinheiroSujo")
function centerWindow ( center_window )                           
	local sx, sy = guiGetScreenSize ( )                           
	local windowW, windowH = guiGetSize ( center_window, false )  
	local z, t = ( sx - windowW ) /2, ( sy - windowH ) /2       
	guiSetPosition ( center_window, z, t, false )                 
end 

give = false
take = false
perevod = false

pricedit = false
priceedit = 0

spicok = false
name = ""
player = nil

fontname = dxCreateFont("dl/robotor.ttf", 17 )


local localPlayer = getLocalPlayer()

local function isCursorOverRectangle(x,y,w,h)
	if isCursorShowing() then
		local mx,my = getCursorPosition() -- relative
		local cursorx,cursory = mx*screenW,my*screenH
		if cursorx > x and cursorx < x + w and cursory > y and cursory < y + h then
			return true
		end
	end
return false
end

local open = false

function openWindow()
	if open == false then
		open = true
		showCursor(true)
        centerWindow(window)
        guiSetVisible(window, true)
		name = ""
		addEventHandler("onClientRender", getRootElement(),spicok ,pricedit)
	elseif open == true then 
		progress = 0
		removeEventHandler("onClientRender", getRootElement(), spicok)
		guiSetVisible(window, false)


		showCursor(false)
		open = false


	end
end

bindKey('f5', 'down', openWindow )




local iGridX, iGridY, iGridW, iGridH = 450*x,355*y,150*x,35*y
local iCurrentCell = 0


--function Draw()
local iCellHeight = 25*y
iVisibleRows = 6


window = guiCreateStaticImage(0*x,0*y,500*x,280*y,"dl/window.png", false)
guiSetVisible(window, false)





 

 
function spicok ()
--dxDrawText("Saldo: "..getPlayerMoney(localPlayer).." руб.", 1200*x, 650*y, 414*x, 38*y, tocolor(163,163,163), 5*x, "default", "center", "center",false,false,true,false)
dxDrawText('Transferência de dinheiro: '..name, 630*x, 600*y, 414*x, 38*y, tocolor(0,0,0), 0.8*x, fontname, "left", "center",false,false,true,false)
dxDrawText('Antes de transferir', 650*x, 785*y, 414*x, 38*y, tocolor(76,76,82), 0.8*x, fontname, "left", "center",false,false,true,false)
dxDrawText('verifique se você digitou', 630*x, 815*y, 414*x, 38*y, tocolor(76,76,82), 0.8*x, fontname, "left", "center",false,false,true,false)
dxDrawText('a quantidade certa! ', 670*x, 845*y, 414*x, 38*y, tocolor(76,76,82), 0.8*x, fontname, "left", "center",false,false,true,false)
dxDrawText('Transferência de dinheiro', 590*x, 500*y, 414*x, 38*y, tocolor(255,255,225), 1.2*x, fontname, "left", "center",false,false,true,false)
dxDrawText('Quantidade de dinheiro', 630*x, 660*y, 414*x, 38*y, tocolor(192,192,192), 0.55*x, fontname, "left", "center",false,false,true,false)
dxDrawText('Lista de jogadores', 455*x, 600*y, 414*x, 38*y, tocolor(112,112,118), 0.7*x, fontname, "left", "center",false,false,true,false)
dxDrawImage( 630*x,360*y,290*x,33*y,"dl/edit2.png", 0, 0, 0, tocolor(255, 255, 255, 255) ,true)

dxDrawImage( 645*x,465*y,250*x,38*y,"dl/btn4.png", 0, 0, 0, tocolor(255, 255, 255, 255),true)
dxDrawText("Transferir", 710*x, 930*y, 414*x, 38*y, tocolor(255,255,255), 1*x, fontname, "left", "center",false,false,true,false)

for i = iCurrentCell, iVisibleRows+iCurrentCell-1 do
			visibleI = i  - iCurrentCell
			if drawIn then
				if i == drawIn then
					dxDrawImage(iGridX, iGridY+iCellHeight*visibleI, iGridW, iCellHeight, "dl/btn_name.png", 0, 0, 0, tocolor(255, 255, 255, 255) ,true)
				end
			end
			
			if isCursorOverRectangle(645*x,465*y,250*x,38*y) then



if getKeyState("mouse1") then
				if bClicked == false then
					bClicked = true

	local input_money = tonumber(priceedit)
				if input_money then
					if not player then return false end
					if not isElement(player) then 
					outputChatBox("#ff0000Оerro:#ffffffEste jogador está offline!",255,255,255,true)
					return true 
					end
					if sujo > 0 then
					triggerServerEvent("moneytake", getRootElement(), localPlayer, input_money )
					triggerServerEvent("moneygive", getRootElement(), name, input_money )
					outputChatBox("Você enviou: #FFFF00"..input_money.." R$",0,255,0,true)
					
					
					
				else
					outputChatBox("Dinheiro insuficiente!",255,0,0,true)
					bClicked = false
					--triggerServerEvent( "moneygive1", getRootElement(), minmon )
					player = nil
					name = ""
					pricedit = false
					priceedit = "0"
					return true 
					end
					else
				bClicked = false
				end


end
end

end
	
 

	
			if isCursorOverRectangle(iGridX, iGridY+iCellHeight*visibleI, iGridW, iCellHeight) then
				dxDrawImage(iGridX, iGridY+iCellHeight*visibleI, iGridW, iCellHeight, "dl/btn_name.png", 0, 0, 0, tocolor(255, 255, 255, 255) ,true)
				--dxDrawText(name, iGridX + 10, iGridY+iCellHeight*visibleI + 2, iGridX+iGridW + 1, iGridY+iCellHeight*(visibleI+1) + 1, tocolor(2,25,255,255), 1.1*x, "default-bold", "left", "center",false,false,true,false)
		if getKeyState("mouse1") then
					if bClicked == false then
						for s, data in ipairs(getElementsByType( 'player' )) do
							if i == s - 1 then
								drawIn = i
								name = string.gsub(getPlayerName(data),"#%x%x%x%x%x%x","")
								player = data
							end
						end
					end
				else
					bClicked = false

				end
			end
		for s, data in ipairs(getElementsByType( 'player' )) do
			if i == s - 1 then
			--dxDrawImage(iGridX, iGridY+iCellHeight*visibleI, 300*x,35*y, "dl/edit1.png") -- Ректангл имени
		    	--dxDrawText(string.gsub(getPlayerName(data),"#%x%x%x%x%x%x",""), iGridX + 10, iGridY+iCellHeight*visibleI + 2, iGridX+iGridW + 1, iGridY+iCellHeight*(visibleI+1) + 1, tocolor(255,255,255,255), 1.1*x, "default-bold", "left", "center",false,false,true,false)
				--label_groupsite = guiCreateLabel(10*x,390*y,200*x,25*y,string.gsub(getPlayerName(data),"#%x%x%x%x%x%x",""), false)
				dxDrawText(string.gsub(getPlayerName(data),"#%x%x%x%x%x%x",""), iGridX + 10, iGridY+iCellHeight*visibleI - 1, iGridX+iGridW + 1, iGridY+iCellHeight*(visibleI+1) + 1, tocolor(36,36,41,255), 0.65*x, fontname, "left", "center",false,false,true,false)
		  end
	end
end




bindKey("mouse_wheel_up", "down", function()
	if spicok then
	if isCursorOverRectangle(iGridX, iGridY, iGridW, 335) then
		iCurrentCell = iCurrentCell - 1
		if iCurrentCell < 0 then iCurrentCell = 0 end
	end
	end
end)
bindKey("mouse_wheel_down", "down", function()
	if spicok then
	if isCursorOverRectangle(iGridX, iGridY, iGridW, 335) then
		iCurrentCell = iCurrentCell + 1
	end
	end
end)


--if pricedit then
--dxDrawImage( 600*x,445*y,400*x,48*y,"dl/edit2.png", 0, 0, 0, tocolor(255, 255, 255, 255) ,false,false,true,false)
--dxDrawText(priceedit, 610*x, 905*y, 414*x, 38*y, tocolor(163,163,163), 3*x, "default-bold", "left", "center",false,false,true,false)
dxDrawText(priceedit, 640*x,725*y,290*x,33*y, tocolor(38,37,47), 1*x, fontname, "left", "center",false,false,true,false)
if cursorPosition(630*x,360*y,290*x,33*y) then

dxDrawImage( 630*x,360*y,290*x,33*y,"dl/edit2.png")
--dxDrawText(priceedit, 610*x, 905*y, 414*x, 38*y, tocolor(163,163,163), 3*x, "default-bold", "left", "center",false,false,true,false)
if getKeyState("mouse1") then

if click then
	if pricedit == false then
	pricedit = true
	else
	pricedit = false
	end
	click = false
else
	click = true
end

end
end
end


addEventHandler("onClientKey",root,
function(button,press)
if pricedit then
	if button == "backspace" and press then
			if string.len(priceedit) > 0 then
				priceedit = string.sub(priceedit,1,string.len(priceedit) - 1)
			end
			if string.len(priceedit) == 0 then
				priceedit = "0"
			end
			return true
		end
		for i = 0, 9 do
			if button == tostring(i) and press then
				if string.len(priceedit) < 18 and string.len(priceedit) > 0 then
				if string.len(priceedit) == 1 and priceedit == "0" and button ~= 0 then
					priceedit = tostring(i)
					return false
				end
				priceedit = priceedit..tostring(i)
				break
			end
			end
		end
		if button == "." and press then
				priceedit = priceedit.."."
		end
end
end)

function cursorPosition(x, y, w, h)
	if (not isCursorShowing()) then
		return false
	end
	local mx, my = getCursorPosition()
	local fullx, fully = guiGetScreenSize()
	cursorx, cursory = mx*fullx, my*fully
	if cursorx > x and cursorx < x + w and cursory > y and cursory < y + h then
		return true
	else
		return false
	end
end



Server Side

--local DinheiroBanco = getElementData(source, "EmentDinheiroSujo")
--local DinheiroBanco2 = getElementData(Jogador, "EmentDinheiroSujo")
--------------
function moneys (player, input_money)
--local take = takePlayerMoney(player, input_money)
local take = setElementData(source, "EmentDinheiroSujo", getElementData(source, "EmentDinheiroSujo") - input_money)
end
addEvent( "moneytake", true )
addEventHandler( "moneytake", getRootElement(), moneys )


function moneysdive (name, input_money)
local Jogador = getPlayerFromName(name)	
--local give = givePlayerMoney( getPlayerFromName(name), input_money)
local give = setElementData(Jogador, "EmentDinheiroSujo", getElementData(Jogador, "EmentDinheiroSujo") + input_money)
end

addEvent( "moneygive", true )
addEventHandler( "moneygive", getRootElement(), moneysdive )


--[[function playerPerevods41eta(input_money,player,name)
	if not tonumber(priceedit) or tonumber(priceedit) < 0 then
		if  (tonumber(priceedit) or 0 ) > getPlayerMoney(source) then
                
			outputChatBox('Message[35][31]22',source,255,255,255,true)
			    givePlayerMoney( getPlayerFromName(name), priceedit)
		        takePlayerMoney(player, priceedit)
			return true
			end
			
		

		

end
end

addEvent("playerPerevods41eta",true)
addEventHandler("playerPerevods41eta",getRootElement(),playerPerevods41eta)]]

--[[function minmon()
local getmoney = getPlayerMoney(localPlayer)
--if tonumber(priceedit) <= getmoney and tonumber(priceedit) >= 1  then
local give = givePlayerMoney( getPlayerFromName(name), input_money)
local take = takePlayerMoney(player, input_money)
if not tonumber(priceedit) or tonumber(priceedit) > 0 then
		if (getElementData(source,tonumber(priceedit)) or 0) < getPlayerMoney(localPlayer) then
			outputChatBox('Message[5][1]',source,255,255,255,true)
			return true
		end

end
end
addEvent( "moneygive1", true )
addEventHandler( "moneygive1", getRootElement(), minmon )]]


 

 

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