Fory Posted March 18, 2021 Share Posted March 18, 2021 local adminrang = exports.sas_global:getPlayerAdminTitle(thePlayer) if getElementData(thePlayer,"adminduty") >= 1 then outputChatBox("#32b3ef[ADMIN] " .. adminrang .. " " .. playerName .. " "..kieg.." mondja: " .. message, source, 255, 255, 255, true) exports['sas_freecamtv']:add(shownto, playerName .. " mondja: " .. message, source) elseif outputChatBox(playerName .. " "..kieg.." mondja: " .. message, source, 255, 255, 255, true) end Sziasztok, a gond a outPutChatBox ba a hiba, ugye ott van hogy " .. adminrang .. " és legfelül az exports. de valamiért nem írja hogy pl SzuperAdmin csak azt hogy Player Link to comment
Moderators Patrick Posted March 18, 2021 Moderators Share Posted March 18, 2021 Tippelgethetünk, hogy mi a gond, de milyen hibát ír a debugscript? Mert írnia kell, már csak a helytelenül használt elseif miatt is. Link to comment
Fory Posted March 18, 2021 Author Share Posted March 18, 2021 az elseif-et kiszedtem, az nem kell oda, de viszont már csak ez a baj [Error]: sas_chat/sourceS.lua:202: attempt to concatenate global 'adminrang' (a nil value) Link to comment
Moderators Patrick Posted March 18, 2021 Moderators Share Posted March 18, 2021 'adminrang' értéke nil (és a nil-t nem tudod belefűzni a stringbe az outputChatBoxnál), tehát valószínűleg nem létezik a 'exports.sas_global:getPlayerAdminTitle' függvény (bár erről is kéne lennie egy errornak) Link to comment
Fory Posted March 18, 2021 Author Share Posted March 18, 2021 De létezik, mivel máshol is az van meghívva és ott jó. Link to comment
Moderators Patrick Posted March 18, 2021 Moderators Share Posted March 18, 2021 Akkor a thePlayer nem a megfelelő játékos / olyan rangod van amihez nincs adminTitle beállítva / akármi. Több többet nem tudok mondani ennyiből. Link to comment
Fory Posted March 18, 2021 Author Share Posted March 18, 2021 Akkor a sas_global-t és a telljes ic chat-et bemásolom ide, -- Main chat: Local IC, Me Actions & Faction IC Radio function localIC(source, message, language) if exports['sas_freecamtv']:isPlayerFreecamEnabled(source) then return end local x, y, z = getElementPosition(source) local playerName = getPlayerName(source) message = string.gsub(message, "#%x%x%x%x%x%x", "") local dimension = getElementDimension(source) local interior = getElementInterior(source) local shownto = 1 -- Chat Commands tooltip local kieg = "" for key, nearbyPlayer in ipairs(getElementsByType( "player" )) do local dist = getElementDistance( source, nearbyPlayer ) if dist < 20 then local nearbyPlayerDimension = getElementDimension(nearbyPlayer) local nearbyPlayerInterior = getElementInterior(nearbyPlayer) if (nearbyPlayerDimension==dimension) and (nearbyPlayerInterior==interior) then if not (isPedDead(nearbyPlayer)) and getElementData(nearbyPlayer, "loggedin") and (nearbyPlayer~=source) then local message2 = message local pveh = getPedOccupiedVehicle(source) local jatekos = nearbyPlayer --[[ if pveh then if (exports['sas_vehicle']:isVehicleWindowUp(pveh)) then kieg = "((Kocsiban)) " for i = 0, getVehicleMaxPassengers(pveh) do local lp = getVehicleOccupant(pveh, i) if (lp) and (lp~=source) then jatekos = lp end end end end]]-- --outputChatBox( getChatSzin(dist).." " .. playerName .. " "..kieg.."mondja: " .. message2, jatekos, 255, 255, 255, true) shownto = shownto + 1 end end end end local admintitle = exports.sas_global:getPlayerAdminTitle(thePlayer) outputChatBox("#32b3ef[ADMIN] " .. admintitle .. " " .. playerName .. " "..kieg.." mondja: " .. message, source, 255, 255, 255, true ) exports['sas_freecamtv']:add(shownto, playerName .. " mondja: " .. message, source) end IC CHAT function getAdmins() local players = getElementsByType("player") local admins = { } local count = 1 for key, value in ipairs(players) do if isPlayerSeged(value) and getPlayerAdminLevel(value) <= 6 then admins[count] = value count = count + 1 end end return admins end function isPlayerSeged(thePlayer) return getPlayerAdminLevel(thePlayer) >= 1 end function isPlayerAdmin(thePlayer) return getPlayerAdminLevel(thePlayer) >= 2 end function isPlayerFullAdmin(thePlayer) return getPlayerAdminLevel(thePlayer) >= 3 end function isPlayerSuperAdmin(thePlayer) return getPlayerAdminLevel(thePlayer) >= 4 end function isPlayerLeadAdmin(thePlayer) return getPlayerAdminLevel(thePlayer) >= 5 end function isPlayerHeadAdmin(thePlayer) return getPlayerAdminLevel(thePlayer) >= 6 end function getPlayerAdminLevel(thePlayer) return isElement( thePlayer ) and tonumber(getElementData(thePlayer, "adminlevel")) or 0 end local titles = {"AdminSegéd", "Admin[1]", "Admin[2]", "Admin[3]", "Admin[4]", "Admin[5]", "Főadmin", "SuperAdmin", "Tulajdonos", "Rendszergazda", "Fejlesztő"} function getPlayerAdminTitle(thePlayer) local text = titles[getPlayerAdminLevel(thePlayer)] or "Player" local hiddenAdmin = getElementData(thePlayer, "hiddenadmin") or 0 if (hiddenAdmin==1) then text = text .. " (Rejtett)" end return text end function getAccurateAdminTitle(thePlayer) return titles[getPlayerAdminLevel(thePlayer)] or " " end ADMIN GLOBAL Link to comment
Moderators Patrick Posted March 18, 2021 Moderators Share Posted March 18, 2021 source a player elementje, nem a thePlayer Link to comment
Fory Posted March 18, 2021 Author Share Posted March 18, 2021 oda írtam a sourcePlaye-t de utána ezt dobta ki::: sas_global/admin_globals.lua:49 Bad argument @ 'getElementData' [Expected element at argument 1, got nil] Link to comment
Moderators Patrick Posted March 18, 2021 Moderators Share Posted March 18, 2021 Nem sourcePlayer, hanem csak source Link to comment
Fory Posted March 18, 2021 Author Share Posted March 18, 2021 Jó lett! Köszönöm Szépen! és még azt hogy tudnám beírni hogy adminduty: 0/, 0 akkor fehérrel írja és ne írja a rangot, és ha 1 akkor írja a rangot. Link to comment
Moderators Patrick Posted March 18, 2021 Moderators Share Posted March 18, 2021 Gondolom ahol megvannak adva az admin tag-ek. Ahol nem kell tag oda csak egy üres stringet hagysz (hogy ne írja, hogy "Player"), meg oda írod bele a színkódot is. Gondolom. Link to comment
Fory Posted March 18, 2021 Author Share Posted March 18, 2021 igen ez: if getElementData(thePlayer,"adminduty") then csak nem tudom hogy mit kell odaírni hogy elseif, vagy else, vagy valami mást-e? Link to comment
Moderators Patrick Posted March 18, 2021 Moderators Share Posted March 18, 2021 1 hour ago, Fory said: igen ez: if getElementData(thePlayer,"adminduty") then csak nem tudom hogy mit kell odaírni hogy elseif, vagy else, vagy valami mást-e? if getElementData(source,"adminduty") >= 1 then outputChatBox("#32b3ef[ADMIN] " .. adminrang .. " " .. playerName .. " "..kieg.." mondja: " .. message, source, 255, 255, 255, true) exports['sas_freecamtv']:add(shownto, playerName .. " mondja: " .. message, source) else outputChatBox(playerName .. " "..kieg.." mondja: " .. message, source, 255, 255, 255, true) end Link to comment
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