ich hab das Sharemoney Script gefunden
Spoiler anzeigen
Lua
local gui = {}
gui._placeHolders = {}
local screenWidth, screenHeight = guiGetScreenSize()
local windowWidth, windowHeight = 314, 196
local left = screenWidth/2 - windowWidth/2
local top = screenHeight/2 - windowHeight/2
gui["_root"] = guiCreateWindow(left, top, windowWidth, windowHeight, "Share Money", false)
guiWindowSetSizable(gui["_root"], false)
guiSetVisible(gui["_root"], false)
showCursor(false)
gui["comboBox"] = guiCreateComboBox(70, 85, 191, 54,"Select a player", false, gui["_root"])
for id, player in ipairs(getElementsByType("player")) do
guiComboBoxAddItem(gui["comboBox"], getPlayerName(player))
end
gui["label_2"] = guiCreateLabel(16, 89, 50, 13, "Receiver:", false, gui["_root"])
guiLabelSetHorizontalAlign(gui["label_2"], "left", false)
guiLabelSetVerticalAlign(gui["label_2"], "center")
gui["label_3"] = guiCreateLabel(20, 118, 50, 15, "Money:", false, gui["_root"])
guiLabelSetHorizontalAlign(gui["label_3"], "left", false)
guiLabelSetVerticalAlign(gui["label_3"], "center")
gui["lineEdit"] = guiCreateEdit(70, 115, 101, 20, "", false, gui["_root"])
guiEditSetMaxLength(gui["lineEdit"],8)
gui["label_4"] = guiCreateLabel(178, 115, 120, 16, "f", false, gui["_root"])
guiLabelSetHorizontalAlign(gui["label_4"], "left", false)
guiLabelSetVerticalAlign(gui["label_4"], "center")
guiSetFont(gui["label_4"],"default-smalls")
guiCreateStaticImage(9,20,296,64,"title.png",false,gui["_root"])
gui["pushButton"] = guiCreateButton(-6, 147, 331, 51, "Send", false, gui["_root"])
addEventHandler("onClientRender",getRootElement(),
function()
guiSetText(gui["label_4"],"You have $"..getPlayerMoney())
end )
bindKey("F4","down",
function()
if guiGetVisible(gui["_root"]) == true then
guiSetVisible(gui["_root"], false)
showCursor(false)
elseif guiGetVisible(gui["_root"]) == false then
guiSetVisible(gui["_root"], true)
showCursor(true)
end
end )
addEventHandler("onClientGUIClick", getRootElement(),
function(a,b,c,d)
if source == gui["pushButton"] and guiComboBoxGetItemText(gui["comboBox"],guiComboBoxGetSelected(gui["comboBox"])) ~= "Select a player" then
local getComboPlayer = guiComboBoxGetItemText(gui["comboBox"],guiComboBoxGetSelected(gui["comboBox"]))
local getMoneyToSend = guiGetText(gui["lineEdit"])
if getComboPlayer and getMoneyToSend then
triggerServerEvent("onPlayerReceiveMoney",localPlayer,getComboPlayer,getMoneyToSend)
end
end
end )
Alles anzeigen
Lua
addEvent("onPlayerReceiveMoney",true)
addEventHandler("onPlayerReceiveMoney", getRootElement(),
function(comboPlayer,sentMoney)
local name = getPlayerName(source)
local comboPlayerName = getPlayerFromName(comboPlayer)
local getmoney = tonumber(getPlayerMoney(source))
if tonumber(sentMoney) <= getmoney and tonumber(sentMoney) >= 0 and tonumber(sentMoney) ~= 0 then
local give = givePlayerMoney (comboPlayerName,tonumber(sentMoney))
local take = takePlayerMoney (source,tonumber(sentMoney))
if give and take then
outputChatBox("You have sent $"..sentMoney.." to "..comboPlayer.."#00ff00!",source,0,255,0,true)
outputChatBox("You have received $"..sentMoney.." from "..getPlayerName(source).."#00ff00!",comboPlayerName,0,255,0,true)
end
elseif getmoney <= tonumber(sentMoney) or 0 >= tonumber(sentMoney) then
outputChatBox("You do not have enough money to send $"..sentMoney.." to "..comboPlayer.."#ff0000!",source,255,0,0,true)
elseif not tonumber(sentMoney) == 0 then
outputChatBox("Please enter a valid amount of money to send!",source,255,0,0,true)
end
end )
Alles anzeigen
1.Das Fenster für die Spieler Auswahl is nur so groß das 1 Spieler angezeigt wird
2.wenn nach dem starten des Scripts neue Spieler connecten werden die nich angezeit.
Wäre echt cool wenn mir jemand helfen könnte