All didn't understand event system.
Client side:
You trigger localPlayer 2 times but you can do it once.
triggerServerEvent( 'Get.Job', localPlayer ) -- source is localPlayer
Server side:
Argument 'thePlayer' doesn't needed because we can use source( source = player here ).
So it should be
addEvent( 'Get.job', true )
addEventHandler( 'Get.job', root,
function()
if getTeamName( getPlayerTeam( source ) ) == 'Police' then
exports["guimessages"]:outputServer( root, 'Error: You are already working as a police', 255, 0, 0 )
else
exports["guimessages"]:outputServer( root, 'You are now working as a police', 0, 0, 255 )
setPlayerTeam( source, Policeteam )
setPlayerNametagColor( source, 100, 149, 237 )
setElementModel( source, 280 )
giveWeapon( source, 3 )
end
end
)
https://wiki.multitheftauto.com/wiki/Event_system
viewtopic.php?f=91&t=39678