Black2 Posted July 16, 2015 Share Posted July 16, 2015 Hello this resource works on Team how to works in Occupation ? local join = createMarker( -2975.974609375, 504.951171875, 1.3, "cylinder", 1.3, 255, 255, 0, 150) function joinjob(localPlayer) if (getElementType(localPlayer) == "player") and not ( isPedInVehicle( localPlayer ) ) then triggerClientEvent (localPlayer,"pesquero",getRootElement(),localPlayer) end end addEventHandler ("onMarkerHit", join, joinjob) createBlip( -2975.974609375, 504.951171875, 2.4296875, 56, 3, 0, 0, 255, 255, 0, 250) local Barcos = { [ 453 ] = true, [ 453 ] = true } local BarcosSkins = { [ 210 ] = true, [ 225 ] = true } local barcoTable = { { -3038.4482421875, 604.1875, -0.340974599123 }, { -3095.3408203125, 766.5185546875, -0.31019884347916 }, { -3161.6103515625, 903.453125, -0.35642492771149 }, { -3094.2880859375, 998.7802734375, -0.32000458240509 }, { -3027.7529296875, 922.7392578125, -0.34394550323486 }, { -3041.1240234375, 856.3134765625, -0.3497366309166 }, { -3053.4599609375, 750.5791015625, -0.33944514393806 }, { -3045.521484375, 643.712890625, -0.375756919384 }, { -3057.8583984375, 549.732421875, -0.36067345738411 }, { -3143.16796875, 504.248046875, -0.39858004450798 }, { -3198.35546875, 605.2978515625, -0.35631018877029 }, { -3306.8505859375, 744.03125, -0.32741913199425 }, { -3430.1376953125, 963.283203125, -0.37901026010513 }, { -3384.814453125, 1068.4091796875, -0.32916113734245 }, { -3278.1748046875, 1114.71875, -0.3424257338047 }, } function getRandombarcoTable ( ) return unpack ( barcoTable [ math.random ( #barcoTable ) ] ) end function createbarcoTeam ( ) theTeam = createTeam ( "Pesquero", 255, 255, 0 ) end addEventHandler ( "onResourceStart", resourceRoot, createbarcoTeam ) function joinBarco( skin ) setPlayerTeam ( source, theTeam ) setElementModel ( source, skin ) setElementData( source, "Occupation", "Fisherman", true ) outputChatBox ( "aqui texto",source, 0, 255, 0 ) end addEvent ( "setBarco", true ) addEventHandler ( "setBarco", root, joinBarco ) function getNewBarcoLocation ( thePlayer ) local x, y, z = getRandombarcoTable ( ) triggerClientEvent ( thePlayer, "barco_set_location", thePlayer, x, y, z ) end function onVehicleEnter ( thePlayer ) if ( not Barcos [ getElementModel ( source ) ] ) then return end if ( not getPlayerTeam ( thePlayer ) ) then return end if ( getTeamName ( getPlayerTeam ( thePlayer ) ) == "Pesquero" ) then getNewBarcoLocation ( thePlayer ) end end addEventHandler ( "onVehicleEnter", root, onVehicleEnter ) addEvent ( "pizza_finish", true ) addEventHandler("pizza_finish", root, function ( ) if ( not isPedInVehicle ( source ) ) then return end local vehicle = getPedOccupiedVehicle ( source ) if ( not Barcos [ getElementModel ( vehicle ) ] ) then return end local money = math.random ( 800, 1600 ) givePlayerMoney ( source, money ) setElementFrozen ( vehicle, true ) fadeCamera(source, false, 1.-- s8) --> setTimer(fadeCamera, 1500, 1, source, true) setElementFrozen ( vehicle, false ) getNewBarcoLocation ( source ) end ) Link to comment
Perfect Posted July 17, 2015 Share Posted July 17, 2015 Try this one: local join = createMarker( -2975.974609375, 504.951171875, 1.3, "cylinder", 1.3, 255, 255, 0, 150) function joinjob(localPlayer) if (getElementType(localPlayer) == "player") and not ( isPedInVehicle( localPlayer ) ) then triggerClientEvent (localPlayer,"pesquero",getRootElement(),localPlayer) end end addEventHandler ("onMarkerHit", join, joinjob) createBlip( -2975.974609375, 504.951171875, 2.4296875, 56, 3, 0, 0, 255, 255, 0, 250) local Barcos = { [ 453 ] = true, [ 453 ] = true } local BarcosSkins = { [ 210 ] = true, [ 225 ] = true } local barcoTable = { { -3038.4482421875, 604.1875, -0.340974599123 }, { -3095.3408203125, 766.5185546875, -0.31019884347916 }, { -3161.6103515625, 903.453125, -0.35642492771149 }, { -3094.2880859375, 998.7802734375, -0.32000458240509 }, { -3027.7529296875, 922.7392578125, -0.34394550323486 }, { -3041.1240234375, 856.3134765625, -0.3497366309166 }, { -3053.4599609375, 750.5791015625, -0.33944514393806 }, { -3045.521484375, 643.712890625, -0.375756919384 }, { -3057.8583984375, 549.732421875, -0.36067345738411 }, { -3143.16796875, 504.248046875, -0.39858004450798 }, { -3198.35546875, 605.2978515625, -0.35631018877029 }, { -3306.8505859375, 744.03125, -0.32741913199425 }, { -3430.1376953125, 963.283203125, -0.37901026010513 }, { -3384.814453125, 1068.4091796875, -0.32916113734245 }, { -3278.1748046875, 1114.71875, -0.3424257338047 }, } function getRandombarcoTable ( ) return unpack ( barcoTable [ math.random ( #barcoTable ) ] ) end function createbarcoTeam ( ) theTeam = createTeam ( "Pesquero", 255, 255, 0 ) end addEventHandler ( "onResourceStart", resourceRoot, createbarcoTeam ) function joinBarco( skin ) setPlayerTeam ( source, theTeam ) setElementModel ( source, skin ) setElementData( source, "Occupation", "Fisherman", true ) outputChatBox ( "aqui texto",source, 0, 255, 0 ) end addEvent ( "setBarco", true ) addEventHandler ( "setBarco", root, joinBarco ) function getNewBarcoLocation ( thePlayer ) local x, y, z = getRandombarcoTable ( ) triggerClientEvent ( thePlayer, "barco_set_location", thePlayer, x, y, z ) end function onVehicleEnter ( thePlayer ) if ( not Barcos [ getElementModel ( source ) ] ) then return end if ( getElementData( thePlayer, "Occupation") == false or getElementData( thePlayer, "Occupation") ~= "Fisherman" ) then return end if ( getElementData( thePlayer, "Occupation") == "Fisherman" ) then getNewBarcoLocation ( thePlayer ) end end addEventHandler ( "onVehicleEnter", root, onVehicleEnter ) addEvent ( "pizza_finish", true ) addEventHandler("pizza_finish", root, function ( ) if ( not isPedInVehicle ( source ) ) then return end local vehicle = getPedOccupiedVehicle ( source ) if ( not Barcos [ getElementModel ( vehicle ) ] ) then return end local money = math.random ( 800, 1600 ) givePlayerMoney ( source, money ) setElementFrozen ( vehicle, true ) fadeCamera(source, false, 1.0) setTimer(fadeCamera, 1500, 1, source, true) setElementFrozen ( vehicle, false ) getNewBarcoLocation ( source ) end ) For checking player occupation, the syntax is as follows: if ( getElementData( thePlayer, "Occupation") == "Fisherman" ) then -- Check if player 'Occupation' is equals to 'Fisherman' Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now