Jump to content

Recommended Posts

Currently, I'm trying to extract the D_Modu function from the client.lua file within the freeroam module and use it within the TurfSistem module. The purpose is as follows: when a player enters a turf area (onPlayerEnterTurf), their immortality should be disabled, and when they exit, it should remain disabled. That's all I'm asking for. I've been trying to fix this for about a week but haven't been able to find a solution.

The file path for the TurfSistem module is [umoKlan]/TurfSistem,

and for the freeroam module, it's [umoKlan]/freeroam.

Additionally, there's another script named exports.lua, which is likely left there for adding new exports. Just to be thorough, I'll include the code blocks for all of them.

 

My errors are as follows:

[02:56:06] ERROR: [umoKlan]\TurfSistem\exports.lua:2: call: failed to call 'freeroam:D_Modu' [string "?"]

[02:56:09] ERROR: [umoKlan]\TurfSistem\server.lua:146: attempt to call global 'D_Modu' (a nil value)

[02:56:09] ERROR: [umoKlan]\TurfSistem\server.lua:179: attempt to call global 'D_Modu' (a nil value)

 

My codes ; 

The server.lua file within the TurfSistem module

function onColShapeHit(hit,dim)
	if not isElement(hit) or not dim then return end
	if getElementType(hit) ~= "player" then return end
	triggerClientEvent(hit,"TurfSistem:onClientPlayerEnterTurf",hit,id)
	triggerEvent("TurfSistem:onPlayerEnterTurf",hit,id)
	D_Modu(hitElement, true)
	removePedJetPack(hit)
	if isPedInVehicle(hit) then return end
	local klan = getPlayerKlan(hit)
	if not klan then return end
	local data = getElementData(source,"TurfBilgi")
	if not data then return end
	local id = data.id
	local klanlar = turfs[id].klanlar
	if not klanlar[klan] then 
		klanlar[klan] = 1 
	else
		klanlar[klan] = klanlar[klan] +1
	end 
	if not data.saldiran then
		if klan ~= data.sahip then
			data.saldiran = klan
		end
	end	
	-- triggerClientEvent(hit,"TurfSistem:onClientPlayerEnterTurf",hit,id)
	-- triggerEvent("TurfSistem:onPlayerEnterTurf",hit,id)
	if not isTimer(turfs[id].timer) then
		timerOlustur(id,hit)
	end
end



function onColShapeLeave(hit,dim)
	if not isElement(hit) or not dim then return end
	if getElementType(hit) ~= "player" then return end
	triggerClientEvent(hit,"TurfSistem:onClientPlayerExitTurf",hit,id)
	triggerEvent("TurfSistem:onPlayerExitTurf",hit,id)
	D_Modu(hitElement, false)
	local klan = getPlayerKlan(hit)
	if not klan then return end
	local data = getElementData(source,"TurfBilgi")
	if not data then return end
	local id = data.id
	local klanlar = turfs[id].klanlar
	if klanlar[klan] then klanlar[klan] = klanlar[klan] -1 end	
end

 

The exports.lua file within the TurfSistem module

local D_Modu = exports["freeroam"]:D_Modu()
--local player = player-- oyuncu değişkenini belirtin
--call(getResourceFromName("[umoKlan]"), "freeroam", player, "02")

function D_Modu()
    return exports["freeroam"]:D_Modu(player)
end

 

The client.lua file within the freeroam module.

--------------------
-----Player Godmode-----
--------------------
ozellik1 = guiCreateCheckBox(5, 30, 130, 25, "Ölümsüzlük", false, false, panel)
guiSetFont(ozellik1, "default-bold-small")
--------------------------------------
-----Godmode Function-----
-------------------------------------

local D_Modu = {}

function D_Modu()
    if guiCheckBoxGetSelected(ozellik1) == true then
        triggerServerEvent("Alpha_Olma", getRootElement(), localPlayer)
        outputChatBox("#0066ffÖlümsüzlük Modu #FFFFFFAktif", 255, 255, 255, true)
        addEventHandler("onClientPlayerDamage", localPlayer, nodamage)
        addEventHandler("onClientRender", root, render)
        triggerServerEvent("Olumsuz_olma", getRootElement(), localPlayer)
    else
        outputChatBox("#0066ffÖlümsüzlük Modu #ffffffKapatıldı", 255, 255, 255, true)
        triggerServerEvent("Alpha_Olmama", getRootElement(), localPlayer)
        removeEventHandler("onClientPlayerDamage", localPlayer, nodamage)
        removeEventHandler("onClientRender", root, render)
        triggerServerEvent("Olumsuz_Olmama", getRootElement(), localPlayer)
    end
end

exports["freeroam"]:D_Modu()

addEventHandler("onClientGUIClick", ozellik1, D_Modu, false)

function nodamage()
    cancelEvent()
end

function render()
    if getPedWeaponSlot(localPlayer) ~= 0 then
        setPedWeaponSlot(localPlayer,0)
    end	
end

 

I'm awaiting your comments on the codes provided. Please assist me.

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