[Release] No-RP

Other players cant see…

fix !

Client:

-----------------------------
--- */* SCRIPT CONFIG */* ---
-----------------------------

-- */* DEBUG VAR */*
local debug_m = false
-- */* MESSAGE TO SHOW */*
local message = "Out Of Roleplay \n Do not roleplay with me"
-- */* METERS TO SHOW */*
local meters = 10
-- */* DISPLAY IMPORTANT VAR */*
local nbrDisplaying = 1

---------------------------
--- */* SCRIPT CMDS */* ---
---------------------------

-- */* COMMAND */*
RegisterCommand("togglerp", function(source, args, raw)
	-- DEBUG
	if debug_m == true then
		print("Debug: (AFK SCRIPT) - Command was toggled")
	end
    -- TRIGGER
    TriggerServerEvent("W00PI:DisplayShare", message)  
end) 

-----------------------------
--- */* SCRIPT EVENTS */* ---
-----------------------------

-- */* CLIENT EVENT FOR TRIGGER */*
RegisterNetEvent("W00PI:DisplayTrigger")
AddEventHandler("W00PI:DisplayTrigger", function(message, source)
	-- */* DEFAULT VAR FOR DISPLAY TOGGLE */*
    local displaying = true 
	
	if debug_m == true then
		print("Debug: (AFK SCRIPT) - Script was triggered from server")
	end
	-- */* DISPLAY FUNC TRIG */*
    DisplayFunc(GetPlayerFromServerId(source), 1 + (1*0.14), message)
end)

--------------------------------
--- */* SCRIPT FUNCTIONS */* ---
--------------------------------

-- */* DISPLAY FUNCTION */*
function DisplayFunc(mePlayer, offset, text)
	-- BASIC VAR TOGGLE FOR 1 COMMAND
	if displaying == true then
		displaying = false
		if debug_m == true then
			print("Debug: (AFK SCRIPT) - Displaying Var == false")
		end
	else
		displaying = true
		if debug_m == true then
			print("Debug: (AFK SCRIPT) - Displaying Var == true")
		end
	end
	--	LOOP
    Citizen.CreateThread(function()
        nbrDisplaying = nbrDisplaying + 1
        while displaying == true do
            Wait(0)
            local coordsMe = GetEntityCoords(GetPlayerPed(mePlayer), false)
            local coords = GetEntityCoords(PlayerPedId(), false)
            local dist = GetDistanceBetweenCoords(coordsMe['x'], coordsMe['y'], coordsMe['z'], coords['x'], coords['y'], coords['z'], true)
            if dist < meters then
                DrawText3D(coordsMe['x'], coordsMe['y'], coordsMe['z']+offset, text)
            end
        end
        nbrDisplaying = nbrDisplaying - 1
    end)
end

-- */* WRITE 3D TEXT OVERHEAD TEMPLATE FUNCTION */*
function DrawText3D(x, y, z, text)
    local onScreen, _x, _y = World3dToScreen2d(x, y, z)
    local p = GetGameplayCamCoords()
    local distance = GetDistanceBetweenCoords(p.x, p.y, p.z, x, y, z, 1)
    local scale = (1 / distance) * 2
    local fov = (1 / GetGameplayCamFov()) * 100
    local scale = scale * fov
    
    if onScreen then
        SetTextScale(0.0 * scale, 0.55 * scale)
        SetTextFont(2)
        SetTextProportional(1)
        SetTextColour(255, 0, 0, 255)
        SetTextDropshadow(0, 0, 0, 0, 255)
        SetTextEdge(2, 0, 0, 0,``` 150)
        SetTextDropShadow()
        SetTextOutline()
        SetTextEntry("STRING")
        SetTextCentre(1)
        AddTextComponentString(text)
        DrawText(_x,_y)
    end
end

Server:

-- */* SERVER EVENT TO SHOW ALL CLIENTS */*
RegisterServerEvent("W00PI:DisplayShare")
AddEventHandler("W00PI:DisplayShare", function(message)
	-- TRIGGER BACK TO CLIENT
    TriggerClientEvent("W00PI:DisplayTrigger", -1, message, source)
end)

This should work for all people in the server.

1 Like

the fix should be up now

this works BUT.

I use the command /toggleafk i got the text over my head.

Then my Friend does this too BUT my text is gone and he get the text. I think this is not wanted?

Try now

I am truly sorry for releasing such a broken resource, i am now getting help from @Clatanii to fix it.

I didnt have anyone to check the resource with, but he is truly helping me atm :smile:

hey, for some reason it just doesnt do anything. the resource is started but it doesnt show a text or a message in chat that it worked! Do you know why?

it works fine for me, what command are you putting in?

/norp and /yesrp is that the wrong one :smiley:

the command has changed to /togglerp right now

i will try that. THanks

If other player toggles no RP while another is in it, it removes it for that other player…

yeah, we are working our best right now to figure that out

Cant understand how people dosent use their eyes, We stated it that we are working on it still people dosent seem to understand it.

Still the same problem :frowning:

Would It be possible to make it where you can assign the text to a certain ped & when they change peds it goes away such as a spawn ped for public servers?

This script ruins RP sometimes. Someone can be abusing the Out of RP thing.

We are still having some issues with the code, but its getting closer

I can’t think of anything more immersion breaking than a person walking around with “DONT ROLEPLAY WITH ME” on his or her head. You don’t wanna roleplay? Go into your apartment or log off.