Jump to content

[HELP] Jobs system


xXGhostXx

Recommended Posts

CLIENT----
sx,sy = guiGetScreenSize()
lpclean1m = getLocalPlayer()
clean1mdelmissie1window = guiCreateWindow(0.3*sx,0.3*sy,0.3*sx,0.3*sy,"Streetcleaner",false)
clean1mdelmissie1memo = guiCreateMemo(0.01,0.1,0.7,0.8,"cleanermission, accept the job, take the streetcleaner, and go clean the street for money, follow the pink C icon",true,clean1mdelmissie1window)
guiMemoSetReadOnly(romemo, true)
clean1mdelmissie1takebutton = guiCreateButton(0.73,0.4,0.3,0.17,"Have Job",true,clean1mdelmissie1window)
clean1mdelmissie1declinebutton = guiCreateButton(0.73,0.2,0.3,0.17,"Close",true,clean1mdelmissie1window)
guiSetVisible(clean1mdelmissie1window,false)


clean1mdelmissie1marker = createMarker(2149, -2286, 13.77,"cylinder",2,0,255,0)
clean1mdelmissie1theMarker = createPickup(3725, -2079, 1370112.375, 3, 14863, 100 )   

addEventHandler('onClientRender', root,
	function()
		local px, py, pz = getElementPosition(getLocalPlayer())
		if getDistanceBetweenPoints2D(9999,-9999, px, py) <= 17 then
			local x, y = getScreenFromWorldPosition(9999,-9999,43.5)
			if x and y then
		end
		end
		end
)
addEventHandler("onClientMarkerHit",clean1mdelmissie1marker,function(p) if p == lpclean1m then guiSetVisible(clean1mdelmissie1window,true) showCursor(true) end end)


addEventHandler("onClientGUIClick",clean1mdelmissie1window,
function(b) 
	if b == "left" then
		if source == clean1mdelmissie1takebutton then 
			if not getElementData(lpclean1m, "clean1mdelmissie1") then
			triggerServerEvent("haveclean1mdelmissie1Job",lpclean1m)
			else
			guiSetVisible(clean1mdelmissie1window,false)
			showCursor(false)
			triggerServerEvent("clean1mdelmissie1Route",root,lpclean1m)
	       theclean1Blip = createBlipAttachedTo(clean1mdelmissie1theMarker,12)
			end
		elseif source == clean1mdelmissie1declinebutton then
		guiSetVisible(clean1mdelmissie1window,false)
		showCursor(false)
		end
	end
end)

addEvent("clean1mdelmissie1Route",true)
function clean1mdelmissie1Route(tab)
for k,pos in ipairs(tab) do
if k == 1 then x = pos
elseif k == 2 then y = pos
elseif k == 3 then setElementPosition(clean1mdelmissie1theMarker,x,y,pos) outputChatBox("follow the #FF0000PINK C ICON#FFFFFF"..getZoneName(x,y,pos,true)..", "..getZoneName(x,y,pos)..".",255,255,255,true) 
end
end
end
addEventHandler("clean1mdelmissie1Route",root,clean1mdelmissie1Route)

addEventHandler("onClientPickupHit",clean1mdelmissie1theMarker,
function(p) if p == lpclean1m then
	if getElementData(lpclean1m, "clean1mdelmissie1") then
	setElementPosition(clean1mdelmissie1theMarker,35, 68, 1370112.375)
	amount = math.random(1456,8999)
	triggerServerEvent ("giveclean1mdelmissie1PlayerSomeMoney", getLocalPlayer(), amount )
	playSound("geld.mp3")
	outputChatBox("You recieved #00FF00 $"..tostring(amount).."#FFFFFF for cleaning the street",255,255,255,true) 
	setTimer(triggerServerEvent,5000,1,"clean1mdelmissie1Route",root,lpclean1m)
else
	outputChatBox("Only clean1mdelmissie1s.",255,0,0,true) 
end
end
end
)

function che7896fck()
            if isElement (clean1mdelmissie1theMarker) then
                setElementPosition(clean1mdelmissie1theMarker,3725, -2079, 1370112.375)
            end
            if isElement (theclean1Blip) then
                destroyElement(theclean1Blip)
         end
        end
addEvent("che7896fck",true)
addEventHandler("che7896fck",root,che7896fck)


local blip = createBlip(2149, -2286, 13.77, 56, 0, 0, 0, 0, 0, 0, 250)
outputDebugString("Blip visible distance: "..getBlipVisibleDistance(blip)) --50
setBlipVisibleDistance(blip, 150)
outputDebugString("Blip visible distance: "..getBlipVisibleDistance(blip)) --60

SERVER
 

clean1mdelmissie1stations = {{2000, -2169, 13.40},{1731, -2108, 13.40},{1966, -1979, 13.55},{2210, -2004, 13.30},{2244, -2113, 13.30},{2258, -2219, 13.29},{2095, -2175, 13.39},{2293, -2300, 13.55},{2380, -2402, 13.39},{2426, -2229, 13.37}}
nclnns = table.maxn(clean1mdelmissie1stations)

addEvent("haveclean1mdelmissie1Job",true)
function haveclean1mdelmissie1Job()
setElementData(source,"clean1mdelmissie1",true)
end
addEventHandler("haveclean1mdelmissie1Job",root,haveclean1mdelmissie1Job)

addEvent("clean1mdelmissie1Route",true)
function clean1mdelmissie1Route(source)
neclnrwr = math.random(1,nclnns)
for cnti,pos in ipairs(clean1mdelmissie1stations) do
if cnti == neclnrwr then
triggerClientEvent(source,"clean1mdelmissie1Route",root,pos)
end
end
end
addEventHandler("clean1mdelmissie1Route",root,clean1mdelmissie1Route)

function want(source)
local want = math.random( 1,2 )
if want == 1 then 
local wlevel = getPlayerwanteddLevel( source )
if wlevel < 6 then
setPlayerwanteddLevel(source,wlevel+1 )
elseif want == 2 then
end
end
end
addEvent("wantedd",true)
addEventHandler("wantedd",root,want)

function wasted()
if getElementData(source, "clean1mdelmissie1") then
setElementData(source,"clean1mdelmissie1",false)
triggerClientEvent(source,"che7896fck",source)
else
end
end
addEventHandler ( "onPlayerWasted", getRootElement(), wasted )



addEvent( "giveclean1mdelmissie1PlayerSomeMoney", true )
addEventHandler( "giveclean1mdelmissie1PlayerSomeMoney", getRootElement(),
function ( amount )
    givePlayerMoney(source, tonumber(amount))
	x,y,z = getElementPosition( source )
	playSound("geld.mp3")
	clean1msfightbot = exports [ "slothBot" ]:spawnBot ( x,y+1,z, 90,  math.random ( 750, 751 ), 0, 0, teamenemy, 9,         "hunting", true )
	   	   	   setTimer ( destroyElement, 900000, 1, clean1msfightbot )
      setElementModel ( clean1msfightbot, 153 )
      setElementArmor( clean1msfightbot, 1000,107 )
	     setPedAnimation( clean1msfightbot, "slothBot", "Sprint_Wuzi  ")
end
)



local cleanjobmarker= createMarker (2149, -2286, 13.77, "cylinder", 2,255, 200, 0, 150)

function startHcccleanMiIssssion (player)
if getElementType(player) == "vehicle" or getPedOccupiedVehicle(player) then return end
 fadeCamera(player,false,1 )
      setTimer(fadeCamera,1000,1,player,true,5 )
		hunteeedddeeer = createVehicle ( 574, 2160, -2295, 14 )
		setTimer ( destroyElement, 9000000, 1, hunteeedddeeer )
		warpPedIntoVehicle(player,hunteeedddeeer)
   	outputChatBox ( "Hello", player,255, 200, 0, 150 )
    outputChatBox ( "Take this streetcleaner and go clean the street", player,255, 200, 0, 150 )
	    outputChatBox ( "after accepting follow the c icons on your radar", player,255, 200, 0, 150 )
end

addEventHandler( "onMarkerHit", cleanjobmarker, startHcccleanMiIssssion )

@xXGhostXx

Link to comment
3 hours ago, KnucklesSAEG said:

CLIENT----
sx,sy = guiGetScreenSize()
lpclean1m = getLocalPlayer()
clean1mdelmissie1window = guiCreateWindow(0.3*sx,0.3*sy,0.3*sx,0.3*sy,"Streetcleaner",false)
clean1mdelmissie1memo = guiCreateMemo(0.01,0.1,0.7,0.8,"cleanermission, accept the job, take the streetcleaner, and go clean the street for money, follow the pink C icon",true,clean1mdelmissie1window)
guiMemoSetReadOnly(romemo, true)
clean1mdelmissie1takebutton = guiCreateButton(0.73,0.4,0.3,0.17,"Have Job",true,clean1mdelmissie1window)
clean1mdelmissie1declinebutton = guiCreateButton(0.73,0.2,0.3,0.17,"Close",true,clean1mdelmissie1window)
guiSetVisible(clean1mdelmissie1window,false)


clean1mdelmissie1marker = createMarker(2149, -2286, 13.77,"cylinder",2,0,255,0)
clean1mdelmissie1theMarker = createPickup(3725, -2079, 1370112.375, 3, 14863, 100 )   

addEventHandler('onClientRender', root,
	function()
		local px, py, pz = getElementPosition(getLocalPlayer())
		if getDistanceBetweenPoints2D(9999,-9999, px, py) <= 17 then
			local x, y = getScreenFromWorldPosition(9999,-9999,43.5)
			if x and y then
		end
		end
		end
)
addEventHandler("onClientMarkerHit",clean1mdelmissie1marker,function(p) if p == lpclean1m then guiSetVisible(clean1mdelmissie1window,true) showCursor(true) end end)


addEventHandler("onClientGUIClick",clean1mdelmissie1window,
function(b) 
	if b == "left" then
		if source == clean1mdelmissie1takebutton then 
			if not getElementData(lpclean1m, "clean1mdelmissie1") then
			triggerServerEvent("haveclean1mdelmissie1Job",lpclean1m)
			else
			guiSetVisible(clean1mdelmissie1window,false)
			showCursor(false)
			triggerServerEvent("clean1mdelmissie1Route",root,lpclean1m)
	       theclean1Blip = createBlipAttachedTo(clean1mdelmissie1theMarker,12)
			end
		elseif source == clean1mdelmissie1declinebutton then
		guiSetVisible(clean1mdelmissie1window,false)
		showCursor(false)
		end
	end
end)

addEvent("clean1mdelmissie1Route",true)
function clean1mdelmissie1Route(tab)
for k,pos in ipairs(tab) do
if k == 1 then x = pos
elseif k == 2 then y = pos
elseif k == 3 then setElementPosition(clean1mdelmissie1theMarker,x,y,pos) outputChatBox("follow the #FF0000PINK C ICON#FFFFFF"..getZoneName(x,y,pos,true)..", "..getZoneName(x,y,pos)..".",255,255,255,true) 
end
end
end
addEventHandler("clean1mdelmissie1Route",root,clean1mdelmissie1Route)

addEventHandler("onClientPickupHit",clean1mdelmissie1theMarker,
function(p) if p == lpclean1m then
	if getElementData(lpclean1m, "clean1mdelmissie1") then
	setElementPosition(clean1mdelmissie1theMarker,35, 68, 1370112.375)
	amount = math.random(1456,8999)
	triggerServerEvent ("giveclean1mdelmissie1PlayerSomeMoney", getLocalPlayer(), amount )
	playSound("geld.mp3")
	outputChatBox("You recieved #00FF00 $"..tostring(amount).."#FFFFFF for cleaning the street",255,255,255,true) 
	setTimer(triggerServerEvent,5000,1,"clean1mdelmissie1Route",root,lpclean1m)
else
	outputChatBox("Only clean1mdelmissie1s.",255,0,0,true) 
end
end
end
)

function che7896fck()
            if isElement (clean1mdelmissie1theMarker) then
                setElementPosition(clean1mdelmissie1theMarker,3725, -2079, 1370112.375)
            end
            if isElement (theclean1Blip) then
                destroyElement(theclean1Blip)
         end
        end
addEvent("che7896fck",true)
addEventHandler("che7896fck",root,che7896fck)


local blip = createBlip(2149, -2286, 13.77, 56, 0, 0, 0, 0, 0, 0, 250)
outputDebugString("Blip visible distance: "..getBlipVisibleDistance(blip)) --50
setBlipVisibleDistance(blip, 150)
outputDebugString("Blip visible distance: "..getBlipVisibleDistance(blip)) --60

SERVER
 


clean1mdelmissie1stations = {{2000, -2169, 13.40},{1731, -2108, 13.40},{1966, -1979, 13.55},{2210, -2004, 13.30},{2244, -2113, 13.30},{2258, -2219, 13.29},{2095, -2175, 13.39},{2293, -2300, 13.55},{2380, -2402, 13.39},{2426, -2229, 13.37}}
nclnns = table.maxn(clean1mdelmissie1stations)

addEvent("haveclean1mdelmissie1Job",true)
function haveclean1mdelmissie1Job()
setElementData(source,"clean1mdelmissie1",true)
end
addEventHandler("haveclean1mdelmissie1Job",root,haveclean1mdelmissie1Job)

addEvent("clean1mdelmissie1Route",true)
function clean1mdelmissie1Route(source)
neclnrwr = math.random(1,nclnns)
for cnti,pos in ipairs(clean1mdelmissie1stations) do
if cnti == neclnrwr then
triggerClientEvent(source,"clean1mdelmissie1Route",root,pos)
end
end
end
addEventHandler("clean1mdelmissie1Route",root,clean1mdelmissie1Route)

function want(source)
local want = math.random( 1,2 )
if want == 1 then 
local wlevel = getPlayerwanteddLevel( source )
if wlevel < 6 then
setPlayerwanteddLevel(source,wlevel+1 )
elseif want == 2 then
end
end
end
addEvent("wantedd",true)
addEventHandler("wantedd",root,want)

function wasted()
if getElementData(source, "clean1mdelmissie1") then
setElementData(source,"clean1mdelmissie1",false)
triggerClientEvent(source,"che7896fck",source)
else
end
end
addEventHandler ( "onPlayerWasted", getRootElement(), wasted )



addEvent( "giveclean1mdelmissie1PlayerSomeMoney", true )
addEventHandler( "giveclean1mdelmissie1PlayerSomeMoney", getRootElement(),
function ( amount )
    givePlayerMoney(source, tonumber(amount))
	x,y,z = getElementPosition( source )
	playSound("geld.mp3")
	clean1msfightbot = exports [ "slothBot" ]:spawnBot ( x,y+1,z, 90,  math.random ( 750, 751 ), 0, 0, teamenemy, 9,         "hunting", true )
	   	   	   setTimer ( destroyElement, 900000, 1, clean1msfightbot )
      setElementModel ( clean1msfightbot, 153 )
      setElementArmor( clean1msfightbot, 1000,107 )
	     setPedAnimation( clean1msfightbot, "slothBot", "Sprint_Wuzi  ")
end
)



local cleanjobmarker= createMarker (2149, -2286, 13.77, "cylinder", 2,255, 200, 0, 150)

function startHcccleanMiIssssion (player)
if getElementType(player) == "vehicle" or getPedOccupiedVehicle(player) then return end
 fadeCamera(player,false,1 )
      setTimer(fadeCamera,1000,1,player,true,5 )
		hunteeedddeeer = createVehicle ( 574, 2160, -2295, 14 )
		setTimer ( destroyElement, 9000000, 1, hunteeedddeeer )
		warpPedIntoVehicle(player,hunteeedddeeer)
   	outputChatBox ( "Hello", player,255, 200, 0, 150 )
    outputChatBox ( "Take this streetcleaner and go clean the street", player,255, 200, 0, 150 )
	    outputChatBox ( "after accepting follow the c icons on your radar", player,255, 200, 0, 150 )
end

addEventHandler( "onMarkerHit", cleanjobmarker, startHcccleanMiIssssion )

@xXGhostXx

Server-side, Line 50?

Link to comment
13 hours ago, KnucklesSAEG said:

CLIENT----
sx,sy = guiGetScreenSize()
lpclean1m = getLocalPlayer()
clean1mdelmissie1window = guiCreateWindow(0.3*sx,0.3*sy,0.3*sx,0.3*sy,"Streetcleaner",false)
clean1mdelmissie1memo = guiCreateMemo(0.01,0.1,0.7,0.8,"cleanermission, accept the job, take the streetcleaner, and go clean the street for money, follow the pink C icon",true,clean1mdelmissie1window)
guiMemoSetReadOnly(romemo, true)
clean1mdelmissie1takebutton = guiCreateButton(0.73,0.4,0.3,0.17,"Have Job",true,clean1mdelmissie1window)
clean1mdelmissie1declinebutton = guiCreateButton(0.73,0.2,0.3,0.17,"Close",true,clean1mdelmissie1window)
guiSetVisible(clean1mdelmissie1window,false)


clean1mdelmissie1marker = createMarker(2149, -2286, 13.77,"cylinder",2,0,255,0)
clean1mdelmissie1theMarker = createPickup(3725, -2079, 1370112.375, 3, 14863, 100 )   

addEventHandler('onClientRender', root,
	function()
		local px, py, pz = getElementPosition(getLocalPlayer())
		if getDistanceBetweenPoints2D(9999,-9999, px, py) <= 17 then
			local x, y = getScreenFromWorldPosition(9999,-9999,43.5)
			if x and y then
		end
		end
		end
)
addEventHandler("onClientMarkerHit",clean1mdelmissie1marker,function(p) if p == lpclean1m then guiSetVisible(clean1mdelmissie1window,true) showCursor(true) end end)


addEventHandler("onClientGUIClick",clean1mdelmissie1window,
function(b) 
	if b == "left" then
		if source == clean1mdelmissie1takebutton then 
			if not getElementData(lpclean1m, "clean1mdelmissie1") then
			triggerServerEvent("haveclean1mdelmissie1Job",lpclean1m)
			else
			guiSetVisible(clean1mdelmissie1window,false)
			showCursor(false)
			triggerServerEvent("clean1mdelmissie1Route",root,lpclean1m)
	       theclean1Blip = createBlipAttachedTo(clean1mdelmissie1theMarker,12)
			end
		elseif source == clean1mdelmissie1declinebutton then
		guiSetVisible(clean1mdelmissie1window,false)
		showCursor(false)
		end
	end
end)

addEvent("clean1mdelmissie1Route",true)
function clean1mdelmissie1Route(tab)
for k,pos in ipairs(tab) do
if k == 1 then x = pos
elseif k == 2 then y = pos
elseif k == 3 then setElementPosition(clean1mdelmissie1theMarker,x,y,pos) outputChatBox("follow the #FF0000PINK C ICON#FFFFFF"..getZoneName(x,y,pos,true)..", "..getZoneName(x,y,pos)..".",255,255,255,true) 
end
end
end
addEventHandler("clean1mdelmissie1Route",root,clean1mdelmissie1Route)

addEventHandler("onClientPickupHit",clean1mdelmissie1theMarker,
function(p) if p == lpclean1m then
	if getElementData(lpclean1m, "clean1mdelmissie1") then
	setElementPosition(clean1mdelmissie1theMarker,35, 68, 1370112.375)
	amount = math.random(1456,8999)
	triggerServerEvent ("giveclean1mdelmissie1PlayerSomeMoney", getLocalPlayer(), amount )
	playSound("geld.mp3")
	outputChatBox("You recieved #00FF00 $"..tostring(amount).."#FFFFFF for cleaning the street",255,255,255,true) 
	setTimer(triggerServerEvent,5000,1,"clean1mdelmissie1Route",root,lpclean1m)
else
	outputChatBox("Only clean1mdelmissie1s.",255,0,0,true) 
end
end
end
)

function che7896fck()
            if isElement (clean1mdelmissie1theMarker) then
                setElementPosition(clean1mdelmissie1theMarker,3725, -2079, 1370112.375)
            end
            if isElement (theclean1Blip) then
                destroyElement(theclean1Blip)
         end
        end
addEvent("che7896fck",true)
addEventHandler("che7896fck",root,che7896fck)


local blip = createBlip(2149, -2286, 13.77, 56, 0, 0, 0, 0, 0, 0, 250)
outputDebugString("Blip visible distance: "..getBlipVisibleDistance(blip)) --50
setBlipVisibleDistance(blip, 150)
outputDebugString("Blip visible distance: "..getBlipVisibleDistance(blip)) --60

SERVER
 


clean1mdelmissie1stations = {{2000, -2169, 13.40},{1731, -2108, 13.40},{1966, -1979, 13.55},{2210, -2004, 13.30},{2244, -2113, 13.30},{2258, -2219, 13.29},{2095, -2175, 13.39},{2293, -2300, 13.55},{2380, -2402, 13.39},{2426, -2229, 13.37}}nclnns = table.maxn(clean1mdelmissie1stations)addEvent("haveclean1mdelmissie1Job",true)function haveclean1mdelmissie1Job()setElementData(source,"clean1mdelmissie1",true)endaddEventHandler("haveclean1mdelmissie1Job",root,haveclean1mdelmissie1Job)addEvent("clean1mdelmissie1Route",true)function clean1mdelmissie1Route(source)neclnrwr = math.random(1,nclnns)for cnti,pos in ipairs(clean1mdelmissie1stations) doif cnti == neclnrwr thentriggerClientEvent(source,"clean1mdelmissie1Route",root,pos)endendendaddEventHandler("clean1mdelmissie1Route",root,clean1mdelmissie1Route)function want(source)local want = math.random( 1,2 )if want == 1 then local wlevel = getPlayerwanteddLevel( source )if wlevel < 6 thensetPlayerwanteddLevel(source,wlevel+1 )elseif want == 2 thenendendendaddEvent("wantedd",true)addEventHandler("wantedd",root,want)function wasted()if getElementData(source, "clean1mdelmissie1") thensetElementData(source,"clean1mdelmissie1",false)triggerClientEvent(source,"che7896fck",source)elseendendaddEventHandler ( "onPlayerWasted", getRootElement(), wasted )addEvent( "giveclean1mdelmissie1PlayerSomeMoney", true )addEventHandler( "giveclean1mdelmissie1PlayerSomeMoney", getRootElement(),function ( amount )    givePlayerMoney(source, tonumber(amount))	x,y,z = getElementPosition( source )	playSound("geld.mp3")	clean1msfightbot = exports [ "slothBot" ]:spawnBot ( x,y+1,z, 90,  math.random ( 750, 751 ), 0, 0, teamenemy, 9,         "hunting", true )	   	   	   setTimer ( destroyElement, 900000, 1, clean1msfightbot )      setElementModel ( clean1msfightbot, 153 )      setElementArmor( clean1msfightbot, 1000,107 )	     setPedAnimation( clean1msfightbot, "slothBot", "Sprint_Wuzi  ")end)local cleanjobmarker= createMarker (2149, -2286, 13.77, "cylinder", 2,255, 200, 0, 150)function startHcccleanMiIssssion (player)if getElementType(player) == "vehicle" or getPedOccupiedVehicle(player) then return end fadeCamera(player,false,1 )      setTimer(fadeCamera,1000,1,player,true,5 )		hunteeedddeeer = createVehicle ( 574, 2160, -2295, 14 )		setTimer ( destroyElement, 9000000, 1, hunteeedddeeer )		warpPedIntoVehicle(player,hunteeedddeeer)   	outputChatBox ( "Hello", player,255, 200, 0, 150 )    outputChatBox ( "Take this streetcleaner and go clean the street", player,255, 200, 0, 150 )	    outputChatBox ( "after accepting follow the c icons on your radar", player,255, 200, 0, 150 )endaddEventHandler( "onMarkerHit", cleanjobmarker, startHcccleanMiIssssion )

@xXGhostXx

No !

I want simple code for job system !

Doesn't have marker, check point and all of them !

All players enter the vehicle id and driving in street and give 6$ money in 3seconds !

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