Jump to content

Ic Chat, meghívok a rangot és nem jó


Recommended Posts

	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

'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

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

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