Jump to content

Police job problem


Recommended Posts

Hi everyone!

 

I i'm busy with creating a police job resource for my server.

But i have a problem with the police team.

Everytime when i hit the job marker and try to join the police officer team i get this message in the debug:

WARNING: [gameplay]\SRpolice\server.lua:6: Bad argument @ 'setPlayerTeam' [Expected player at argument 1, got root]

Server.lua:

Teame = createTeam("Police officer", 0, 255, 255)

function takePoliceJob ()
    local teamP = getTeamFromName ( "Police officer" )
	if teamP then
		setPlayerTeam( source, teamP )
		setElementModel( source, 280 )
		giveWeapon ( source, 3, 1 )
	end
end
addEvent( "takeJob", true )
addEventHandler( "takeJob", root, takePoliceJob )

Client.lua:

function hitJobMarker (thePlayer)
   local theVehicle = getPedOccupiedVehicle ( thePlayer )
	if theVehicle then
		guiSetVisible ( PoliceGUI, false )
	else
		setCameraMatrix(1522.40, -1646.80, 30.39, 1549.59, -1672.09, 14.39)
		guiSetVisible ( PoliceGUI, true )
		showChat(false)
		setPlayerHudComponentVisible ( "all", false )
		bindKey ("enter","down",
			function(enter, down)
				guiSetVisible ( PoliceGUI, false )
				setCameraTarget(thePlayer)
				showChat(true)
				setPlayerHudComponentVisible ( "all", true )
				triggerServerEvent ( "takeJob", root )
			end
		)
   end
end
addEventHandler ( "onClientMarkerHit", JobMarker, hitJobMarker )

Can somebody tell me what i'm doing wrong and tell me how to fix this problem? :)

Greetings!

Edited by wesleywillems17
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...