Jump to content

start resource erro


Recommended Posts

image.png

local myBlip = createBlip( 1226.1005859375, 398.4169921875, 21.106098175049, 42, 0, 0, 0, 255, myPlayer )
setBlipVisibleDistance(myBlip, 300) --distancia que é visto o blip no radar, pode alterar

markerlaranja = createMarker( 1226.1005859375, 398.4169921875, 21.106098175049 -1, "cylinder", 1.1, 0, 255, 0, 255)
markerlaranja2 = createMarker( 1234.0703125, 414.9501953125, 20.760526657104 -1, "cylinder", 1.1, 0, 255, 0, 255)
markerlaranja3 = createMarker( 1240.6142578125, 429.1787109375, 19.204351425171 -1, "cylinder", 1.1, 0, 255, 0, 255)
markerlaranja4 = createMarker( 1247.7998046875, 445.1884765625, 18.851581573486 -1, "cylinder", 1.1, 0, 255, 0, 255)
markerlaranja5 = createMarker( 1261.6875, 436.865234375, 18.878652572632 -1, "cylinder", 1.1, 0, 255, 0, 255)
markerlaranja6 = createMarker( 1254.720703125, 420.564453125, 19.131044387817 -1, "cylinder", 1.1, 0, 255, 0, 255)
markerlaranja7 = createMarker( 1248.970703125, 406.7763671875, 18.996059417725 -1, "cylinder", 1.1, 0, 255, 0, 255)
markerlaranja8 = createMarker( 1242.2373046875, 392.5908203125, 19.099172592163 -1, "cylinder", 1.1, 0, 255, 0, 255)
markerlaranja9 = createMarker( 1258.947265625, 387.2275390625, 19.473236083984 -1, "cylinder", 1.1, 0, 255, 0, 255)
markerlaranja10 = createMarker( 1263.2685546875, 399.974609375, 19.328210830688 -1, "cylinder", 1.1, 0, 255, 0, 255)
markerlaranja11 = createMarker( 1268.9052734375, 413.3408203125, 19.240316390991 -1, "cylinder", 1.1, 0, 255, 0, 255)
markerlaranja12 = createMarker( 1275.1494140625, 429.0166015625, 18.900918960571 -1, "cylinder", 1.1, 0, 255, 0, 255)


LetraParaMarkers = "k"

function message(player, message, type)
	triggerClientEvent(player, "N3xT.dxNotification", resourceRoot, message, type)
end

timerEntregar = {}


local next = exports.n3xt_inventario


function colher (source)
unbindKey (source, "K", "down", colher )
setElementFrozen (source, true ) 
setPedAnimation(source, "GHANDS", "gsign1", 0, true, true, true)
setTimer(function()
setElementFrozen (source, false ) 
setPedAnimation(source, "GHANDS", "gsign1", 0, false, false, false)
bindKey (source, "K", "down", colher )
unbindKey ( source, LetraParaMarkers, "down", colher )
next:giveItem(source, "Laranja", 1)
end, 11300, 1)
end

function emarker(marker,md) 
	if (md) then
	  if isPedInVehicle ( source ) then return end
		if marker == markerlaranja or marker == markerlaranja2 or marker == markerlaranja3 or marker == markerlaranja4 or marker == markerlaranja5 or marker == markerlaranja6 or marker == markerlaranja7 or marker == markerlaranja8 or marker == markerlaranja9 or marker == markerlaranja10 or marker == markerlaranja11 or marker == markerlaranja12 then
			message(source, "Precione K para Colher Laranjas.", "info")
			bindKey ( source, LetraParaMarkers, "down", colher )
		end
	 end
  end	
addEventHandler("onPlayerMarkerHit",getRootElement(),emarker)


function lmarker(marker,md)
	if (md) then
		if marker == markerlaranja then		
			unbindKey ( source, LetraParaMarkers, "down", colher )
		end
end
end
addEventHandler("onPlayerMarkerLeave",getRootElement(),lmarker)

--server_S

 

Link to comment
54 minutes ago, djtopoofc said:

image.png

local myBlip = createBlip( 1226.1005859375, 398.4169921875, 21.106098175049, 42, 0, 0, 0, 255, myPlayer )
setBlipVisibleDistance(myBlip, 300) --distancia que é visto o blip no radar, pode alterar

markerlaranja = createMarker( 1226.1005859375, 398.4169921875, 21.106098175049 -1, "cylinder", 1.1, 0, 255, 0, 255)
markerlaranja2 = createMarker( 1234.0703125, 414.9501953125, 20.760526657104 -1, "cylinder", 1.1, 0, 255, 0, 255)
markerlaranja3 = createMarker( 1240.6142578125, 429.1787109375, 19.204351425171 -1, "cylinder", 1.1, 0, 255, 0, 255)
markerlaranja4 = createMarker( 1247.7998046875, 445.1884765625, 18.851581573486 -1, "cylinder", 1.1, 0, 255, 0, 255)
markerlaranja5 = createMarker( 1261.6875, 436.865234375, 18.878652572632 -1, "cylinder", 1.1, 0, 255, 0, 255)
markerlaranja6 = createMarker( 1254.720703125, 420.564453125, 19.131044387817 -1, "cylinder", 1.1, 0, 255, 0, 255)
markerlaranja7 = createMarker( 1248.970703125, 406.7763671875, 18.996059417725 -1, "cylinder", 1.1, 0, 255, 0, 255)
markerlaranja8 = createMarker( 1242.2373046875, 392.5908203125, 19.099172592163 -1, "cylinder", 1.1, 0, 255, 0, 255)
markerlaranja9 = createMarker( 1258.947265625, 387.2275390625, 19.473236083984 -1, "cylinder", 1.1, 0, 255, 0, 255)
markerlaranja10 = createMarker( 1263.2685546875, 399.974609375, 19.328210830688 -1, "cylinder", 1.1, 0, 255, 0, 255)
markerlaranja11 = createMarker( 1268.9052734375, 413.3408203125, 19.240316390991 -1, "cylinder", 1.1, 0, 255, 0, 255)
markerlaranja12 = createMarker( 1275.1494140625, 429.0166015625, 18.900918960571 -1, "cylinder", 1.1, 0, 255, 0, 255)


LetraParaMarkers = "k"

function message(player, message, type)
	triggerClientEvent(player, "N3xT.dxNotification", resourceRoot, message, type)
end

timerEntregar = {}


local next = exports.n3xt_inventario


function colher (source)
unbindKey (source, "K", "down", colher )
setElementFrozen (source, true ) 
setPedAnimation(source, "GHANDS", "gsign1", 0, true, true, true)
setTimer(function()
setElementFrozen (source, false ) 
setPedAnimation(source, "GHANDS", "gsign1", 0, false, false, false)
bindKey (source, "K", "down", colher )
unbindKey ( source, LetraParaMarkers, "down", colher )
next:giveItem(source, "Laranja", 1)
end, 11300, 1)
end

function emarker(marker,md) 
	if (md) then
	  if isPedInVehicle ( source ) then return end
		if marker == markerlaranja or marker == markerlaranja2 or marker == markerlaranja3 or marker == markerlaranja4 or marker == markerlaranja5 or marker == markerlaranja6 or marker == markerlaranja7 or marker == markerlaranja8 or marker == markerlaranja9 or marker == markerlaranja10 or marker == markerlaranja11 or marker == markerlaranja12 then
			message(source, "Precione K para Colher Laranjas.", "info")
			bindKey ( source, LetraParaMarkers, "down", colher )
		end
	 end
  end	
addEventHandler("onPlayerMarkerHit",getRootElement(),emarker)


function lmarker(marker,md)
	if (md) then
		if marker == markerlaranja then		
			unbindKey ( source, LetraParaMarkers, "down", colher )
		end
end
end
addEventHandler("onPlayerMarkerLeave",getRootElement(),lmarker)

--server_S

 

tente algumas alternativas...

1 - Para o erro de UTF-8 use: 

2 - Sobre o codigo tente desse modelo ( Não testei )
 

local LetraParaMarkers = "k"
local next = exports.n3xt_inventario -- Vinculado ao invetario n3xt
local timerEntregar = {}
local MarkerColheita = {}
local BlipColheita = {}

local MarkerLocaisColheita = {
  
    --{x, y, z, true para blip ou false para não},
    {1226.1005859375, 398.4169921875, 21.106098175049, true},
    {1234.0703125, 414.9501953125, 20.760526657104, false},
    {1240.6142578125, 429.1787109375, 19.204351425171, false},
    {1247.7998046875, 445.1884765625, 18.851581573486, false},
    {1261.6875, 436.865234375, 18.878652572632, false},
    {1254.720703125, 420.564453125, 19.131044387817, false},
    {1248.970703125, 406.7763671875, 18.996059417725, false},
    {1242.2373046875, 392.5908203125, 19.099172592163, false},
    {1258.947265625, 387.2275390625, 19.473236083984, false},
    {1263.2685546875, 399.974609375, 19.328210830688, false},
    {1268.9052734375, 413.3408203125, 19.240316390991, false},
    {1275.1494140625, 429.0166015625, 18.900918960571, false},
}


addEventHandler("onResourceStart", resourceRoot, function()
	if getThisResource() == resource then
		for _,Pos in ipairs(MarkerLocaisColheita) do
			MarkerColheita[Pos] = createMarker(Pos[1], Pos[2], Pos[3] -1, "cylinder", 1.2, 0, 255, 0, 255) -- Tamanho do marker min para um player poder usar (1.2)
            if Pos[4] == true then
            	BlipColheita[pos] = createBlip(Pos[1], Pos[2], Pos[3], 42) -- Cria o blip
                setBlipVisibleDistance(BlipColheita[Pos], 150) -- Mostra quando estiver perto
            else 
            end
		end
	end
end)

addEventHandler("onMarkerHit", getRootElement(), function(executor)
	if executor and isElement(executor) and getElementType(executor) == "player" then
		for _,V in ipairs(MarkerLocaisColheita) do
			if MarkerColheita[V] == source then
				if not isGuestAccount(getPlayerAccount(executor)) then
					message(executor, "Precione K para Colher Laranjas.", "info")
			        bindKey (executor, LetraParaMarkers, "down", colher )
					break
				end
			end
		end
	end
end)

addEventHandler("onPlayerMarkerLeave", getRootElement(), function(executor)
	if executor and isElement(executor) and getElementType(executor) == "player" then
		for _,V in ipairs(MarkerLocaisColheita) do
			if MarkerColheita[V] == source then
				if not isGuestAccount(getPlayerAccount(executor)) then
			        unbindKey ( source, LetraParaMarkers, "down", colher )
					break
				end
			end
		end
	end
end)

function colher (source)
    unbindKey (source, "K", "down", colher )
    setElementFrozen (source, true ) 
    setPedAnimation(source, "GHANDS", "gsign1", 0, true, true, true)
    setTimer(function()
        setElementFrozen (source, false ) 
        setPedAnimation(source, "GHANDS", "gsign1", 0, false, false, false)
        bindKey (source, "K", "down", colher )
        unbindKey ( source, LetraParaMarkers, "down", colher )
        next:giveItem(source, "Laranja", 1)
    end, 11300, 1)
end

function message(player, message, type)
    triggerClientEvent(player, "N3xT.dxNotification", resourceRoot, message, type)
 end

 se deu bom deixa o trofeuzinho<3

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