jesse50671 Posted July 9, 2019 Posted July 9, 2019 addCommandHandler("giveitem", function(playerSource, cmd, id, item, value, count) if getElementData( playerSource, "adminlevel" ) >= 6 then if (getElementData (playerSource, "adminduty") or 0) == 1 then if id and item and value and count then local targetPlayer, targetPlayerName = exports.global:findPlayerByPartialNick(playerSource, id) if targetPlayer then if giveItem(targetPlayer, tonumber(item), tonumber(value), tonumber(count), 0, true) then -- 0 -> dutyitem local comy = getElementData(playerSource, "anick") outputChatBox("#7cc576[Információ]: #ffffffKaptál #00AEFF".. comy .."#FFFFFF-tól/től egy #D75555" ..getItemName(tonumber(item)).." #ffffffitemet.", targetPlayer,255,255,255,true) outputChatBox("#7CC576[#7CC576wls#ffffffMTA #ffffff- #53bfdcAdmin információ#7CC576]: #00AEFF".. targetPlayerName:gsub("_", " ") .."#FFFFFF-nak/nek adtál egy #D75555" ..getItemName(tonumber(item)).." #ffffffitemet.", playerSource,255,255,255,true) exports.global:sendMessageToAdmins("#7CC576[#7CC576wls#ffffffMTA #ffffff- #53bfdcAdminnapló#7CC576]#ffffff: #00AEFF" .. comy .. " #FFFFFFadott #00AEFF".. targetPlayerName:gsub("_", " ") .."#ffffff-nak/nek egy #D75555" ..getItemName(tonumber(item)).."#ffffff nevezetű itemet.", 255, 0, 0,true) exports.logs:logMessage("[addolás] ".. comy .. " adott ".. targetPlayerName:gsub("_", " ") .."-nak/nek egy " ..getItemName(tonumber(item)).." nevezetű itemet.", 34) else outputChatBox("#7CC576[#7CC576wls#ffffffMTA #ffffff- #53bfdcAdmin információ#7CC576]: #ffffffNem fér el több tárgy az adott játékosnál!", playerSource, 255 ,255, 255, true) end end else outputChatBox("#7cc576[Használat]: #ffffff/"..cmd.." [Név / ID] [ItemId] [Érték] [Db]", playerSource, 255, 255, 255, true) end else outputChatBox("#d24d57[WLS - Defend]: #FFFFFFNem vagy adminszolgálatba!", playerSource,255,255,255,true) end end end ) ERROR: [james]\wls_items\sourceS.Lua:299: attempt to compare number with boolean
jesse50671 Posted July 9, 2019 Author Posted July 9, 2019 if getElementData( playerSource, "adminlevel" ) >= 6 then
HassoN Posted July 9, 2019 Posted July 9, 2019 Try this addCommandHandler("giveitem", function(playerSource, cmd, id, item, value, count) local level = getElementData( playerSource, "adminlevel" ) or 0 if level >= 6 then if (getElementData (playerSource, "adminduty") or 0) == 1 then if id and item and value and count then local targetPlayer, targetPlayerName = exports.global:findPlayerByPartialNick(playerSource, id) if targetPlayer then if giveItem(targetPlayer, tonumber(item), tonumber(value), tonumber(count), 0, true) then -- 0 -> dutyitem local comy = getElementData(playerSource, "anick") outputChatBox("#7cc576[Információ]: #ffffffKaptál #00AEFF".. comy .."#FFFFFF-tól/től egy #D75555" ..getItemName(tonumber(item)).." #ffffffitemet.", targetPlayer,255,255,255,true) outputChatBox("#7CC576[#7CC576wls#ffffffMTA #ffffff- #53bfdcAdmin információ#7CC576]: #00AEFF".. targetPlayerName:gsub("_", " ") .."#FFFFFF-nak/nek adtál egy #D75555" ..getItemName(tonumber(item)).." #ffffffitemet.", playerSource,255,255,255,true) exports.global:sendMessageToAdmins("#7CC576[#7CC576wls#ffffffMTA #ffffff- #53bfdcAdminnapló#7CC576]#ffffff: #00AEFF" .. comy .. " #FFFFFFadott #00AEFF".. targetPlayerName:gsub("_", " ") .."#ffffff-nak/nek egy #D75555" ..getItemName(tonumber(item)).."#ffffff nevezetű itemet.", 255, 0, 0,true) exports.logs:logMessage("[addolás] ".. comy .. " adott ".. targetPlayerName:gsub("_", " ") .."-nak/nek egy " ..getItemName(tonumber(item)).." nevezetű itemet.", 34) else outputChatBox("#7CC576[#7CC576wls#ffffffMTA #ffffff- #53bfdcAdmin információ#7CC576]: #ffffffNem fér el több tárgy az adott játékosnál!", playerSource, 255 ,255, 255, true) end end else outputChatBox("#7cc576[Használat]: #ffffff/"..cmd.." [Név / ID] [ItemId] [Érték] [Db]", playerSource, 255, 255, 255, true) end else outputChatBox("#d24d57[WLS - Defend]: #FFFFFFNem vagy adminszolgálatba!", playerSource,255,255,255,true) end end end )
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now