Client Side :
-- Client Side
PolicePed = createPed(280,1554.33032, -1675.53552, 16.19531,90)
Marker = createMarker(1553.61292, -1675.59033, 15.19531,"cylinder",2,100, 149, 237)
--- Cancel Ped Damage
addEventHandler ( "onClientPedDamage" , root , function ( )
if ( source == PolicePed ) then
cancelEvent ( );
end
end );
--- Create Window After Start The Resource
addEventHandler ( "onClientResourceStart" , resourceRoot , function ( )
window = guiCreateWindow(0.30, 0.19, 0.44, 0.46, "Police Job", true)
guiWindowSetSizable(window, false)
guiSetVisible ( window , false )
guiSetProperty(window, "CaptionColour", "FF1544C9")
buttonaccept = guiCreateButton(10, 293, 91, 50, "Accept", false, window)
guiSetFont(buttonaccept, "default-bold-small")
buttonclose = guiCreateButton(497, 295, 90, 48, "Close", false, window)
guiSetFont(buttonclose, "default-bold-small")
end );
-- Open Window On Marker Hit
addEventHandler ( "onClientMarkerHit" , root , function ( player )
if ( source == Marker and player == localPlayer and not isPedInVehicle ( player ) ) then
guiSetVisible ( window , true )
showCursor ( true )
guiSetInputEnabled ( true )
end
end );
--- Buttons Clicked
addEventHandler ( "onClientGUIClick" , root , function ( )
if ( source == buttonaccept ) then
guiSetVisible ( window , false )
showCursor ( false )
guiSetInputEnabled ( false )
triggerServerEvent ( "JoinPolice" , localPlayer )
elseif ( source == buttonclose ) then
guiSetVisible ( window , false )
showCursor ( false )
guiSetInputEnabled ( false )
end
end );
Server Side :
aTeam = createTeam ( "Police" , 0 , 0 , 255 );
addEvent("JoinPolice",true)
addEventHandler("JoinPolice",root , function ( )
if ( getPlayerTeam ( source ) and getPlayerTeam ( source ) == aTeam ) then return outputChatBox ("* you have this team",source,255,0,0,true) end
setPlayerTeam ( source , aTeam )
outputChatBox ( 'Now You Are in police job!',source,0,255,0 )
end );