Hallo miteinander, ich hab mein erstes Script geschrieben, es ist noch nicht fertig aber funktionieren tut es nicht,
kann mir einer meinen Fehler sagen und den beheben ? :3
//EDIT: Im Debugscript sind keine Errors und die Scoreboardleiste ist Leer
Lua
exports.scoreboard:addScoreboardColumn('Level')
function killEXP (attacker)
setElementData(attacker,"EXP",(getElementData(attacker,"EXP") or 0) + 1 )
end
addEventHandler("onPlayerWasted",getRootElement(),killEXP)
function levelSet ()
local exp = getElementData(source,"EXP")
local account = getPlayerAccount(source)
if exp then
if (exp >= 0) and (exp <= 4) then
setAccountData (account, "Level", "Level 1")
elseif (exp >= 5) and (exp <= 9) then
setAccountData (account, "Level", "Level 2")
elseif (exp >= 10) and (exp <= 19) then
setAccountData (account, "Level", "Level 3")
elseif (exp >= 20) and (exp <= 49) then
setAccountData (account, "Level", "Level 4")
end
end
end
addEventHandler ("onPlayerSpawn", root, levelSet)
function levelUp (player)
local exp = getElementData(player,"EXP")
if (exp == 5) then
outputChatBox ("Neues Level! Du bist nun Level 2!")
elseif (exp == 10) then
outputChatBox ("Neues Level! Du bist nun Level 3!")
elseif (exp == 20) then
outputChatBox ("Neues Level! Du bist nun Level 4!")
end
end
function guest ()
local account2 = getPlayerAccount()
if isGuestAccount(account2) then
setAccountData(account2, "Level", "Guest")
end
end
Alles anzeigen
Bedanke mich jetzt schon mal für Antworten,
MFG DRdoode