Monty Posted May 21, 2012 Share Posted May 21, 2012 don't work server createBlip ( 1552.4996337891, -1677.3264160156, 15.1953125, 30 ) function createSAPDTeam () SAPDteam = createTeam ("SAPD", 100, 149, 237) end addEventHandler ("onResourceStart", resourceRoot, createSAPDTeam) function joinSAPD() setPlayerTeam(source,SAPDteam) setElementModel(source, 280) giveWeapon ( source, 3 ) setElementData( source, "Occupation", "SAPD", true ) outputChatBox("You are now SAPD agent.",source,0,255,0) end addEvent("setSAPD", true) addEventHandler("setSAPD",root,joinSAPD) addEvent("police:arrest", true) addEventHandler("police:arrest", root, function (police) setElementPosition( source, 68.12606811523, 83.171829223633, 1001.0390625 ) givePlayerMoney(police, 1000) -- Gives 100$ to the medic each time the function is executed takePlayerMoney(source, 100) -- Takes 100$ from the source when he get healed end) client local marker = createMarker( 1552.4996337891, -1677.3264160156, 15.1953125, "Cylinder", 1.5, 0, 0, 255, 150) GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Label = {} function guiMyCwindow(w,h,t) local x,y = guiGetScreenSize() return guiCreateWindow((x-w)/2,(y-h)/2,w,h,t,false) end windowjob = guiMyCwindow(301,250,"SAPD agent") guiSetVisible(windowjob, false) GUIEditor_Button[1] = guiCreateButton(22,200,108,35,"Take job",false,windowjob) GUIEditor_Label[1] = guiCreateLabel(193,-103,5,5,"",false,windowjob) GUIEditor_Button[2] = guiCreateButton(179,200,110,36,"Cancel",false,windowjob) GUIEditor_Memo[1] = guiCreateMemo(19,33,273,100,"To take SAPD job, press Take job.\n\nIf you don't want to, press Cancel.",false,windowjob) guiEditSetReadOnly(GUIEditor_Memo[1],true) function SAPDjob(hitElement) if getElementType(hitElement) == "player" and (hitElement == localPlayer) then if not guiGetVisible(windowjob) then guiSetVisible(windowjob, true) showCursor(true) end end end addEventHandler("onClientMarkerHit", marker, SAPDjob) function FBIjobleave(leaveElement) if getElementType(leaveElement) == "player" and (leaveElement == localPlayer) then if guiGetVisible(windowjob) then guiSetVisible(windowjob, false) showCursor(false) end end end addEventHandler("onClientMarkerLeave", marker, SAPDjobleave) function joinTeam() triggerServerEvent("setSAPD",localPlayer) guiSetVisible(windowjob, false) showCursor(false) end addEventHandler("onClientGUIClick", GUIEditor_Button[1] , joinTeam, false) function removeSAPDWindow() guiSetVisible(windowjob, false) showCursor(false) end addEventHandler("onClientGUIClick", GUIEditor_Button[2] , removeSAPDWindow, false) -------- addEventHandler("onClientPlayerDamage", localPlayer, function(attacker, weapon, bodypart, loss) team = getPlayerTeam(attacker) if (attacker and getElementType(attacker) == "player" and weapon == 3 and team and getTeamName(team) == "SAPD") then -- Checks if the player is using spray and is into Medic team cancelEvent() -- Cancels the damage cause by the spray if (not isTimer(pause)) then triggerServerEvent("police:arrest", localPlayer, attacker) -- Calls the Server Event pause = setTimer(function() end, 1000, 1) -- Makes a timer for the function so it won't fully heal in the first time end end end end) Link to comment
Castillo Posted May 21, 2012 Share Posted May 21, 2012 Great, so you expect us to know the bug like that? give more information if you really want help. Link to comment
Monty Posted May 21, 2012 Author Share Posted May 21, 2012 the console do not report any error but the marker doesnt appear like the radar blip, the team don't get created too Link to comment
Monty Posted May 21, 2012 Author Share Posted May 21, 2012 meta.xml <meta> <info author="stolka" name="police" version="1.0" type="script"/> <script src="police-c.lua" type="client"/> <script src="police-s.lua" type="server"/> </meta> Link to comment
X-SHADOW Posted May 21, 2012 Share Posted May 21, 2012 There was error here i fixed it try it now local marker = createMarker( 1552.4996337891, -1677.3264160156, 15.1953125, "Cylinder", 1.5, 0, 0, 255, 150) GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Label = {} function guiMyCwindow(w,h,t) local x,y = guiGetScreenSize() return guiCreateWindow((x-w)/2,(y-h)/2,w,h,t,false) end windowjob = guiMyCwindow(301,250,"SAPD agent") guiSetVisible(windowjob, false) GUIEditor_Button[1] = guiCreateButton(22,200,108,35,"Take job",false,windowjob) GUIEditor_Label[1] = guiCreateLabel(193,-103,5,5,"",false,windowjob) GUIEditor_Button[2] = guiCreateButton(179,200,110,36,"Cancel",false,windowjob) GUIEditor_Memo[1] = guiCreateMemo(19,33,273,100,"To take SAPD job, press Take job.\n\nIf you don't want to, press Cancel.",false,windowjob) guiEditSetReadOnly(GUIEditor_Memo[1],true) function SAPDjob(hitElement) if getElementType(hitElement) == "player" and (hitElement == localPlayer) then if not guiGetVisible(windowjob) then guiSetVisible(windowjob, true) showCursor(true) end end end addEventHandler("onClientMarkerHit", marker, SAPDjob) function FBIjobleave(leaveElement) if getElementType(leaveElement) == "player" and (leaveElement == localPlayer) then if guiGetVisible(windowjob) then guiSetVisible(windowjob, false) showCursor(false) end end end addEventHandler("onClientMarkerLeave", marker, SAPDjobleave) function joinTeam() triggerServerEvent("setSAPD",localPlayer) guiSetVisible(windowjob, false) showCursor(false) end addEventHandler("onClientGUIClick", GUIEditor_Button[1] , joinTeam, false) function removeSAPDWindow() guiSetVisible(windowjob, false) showCursor(false) end addEventHandler("onClientGUIClick", GUIEditor_Button[2] , removeSAPDWindow, false) -------- addEventHandler("onClientPlayerDamage", localPlayer, function(attacker, weapon, bodypart, loss) team = getPlayerTeam(attacker) if (attacker and getElementType(attacker) == "player" and weapon == 3 and team and getTeamName(team) == "SAPD") then -- Checks if the player is using spray and is into Medic team cancelEvent() -- Cancels the damage cause by the spray if (not isTimer(pause)) then triggerServerEvent("police:arrest", localPlayer, attacker) -- Calls the Server Event pause = setTimer(function() end, 1000, 1) -- Makes a timer for the function so it won't fully heal in the first time end end end) 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