illestiraqi Posted February 21, 2013 Share Posted February 21, 2013 I don't know whats wrong with this script someone please help me fix it! client: local marker = createMarker( 186.30000305176, 1938.3000488281, 16.700000762939, "Cylinder", 2, 0, 40, 0, 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,170,"Armed Soldier") guiSetVisible(windowjob, false) GUIEditor_Button[1] = guiCreateButton(22,80,108,35,"Take job",false,windowjob) GUIEditor_Button[3] = guiCreateButton(22,120,108,35,"Quit Job",false,windowjob) GUIEditor_Button[2] = guiCreateButton(179,120,110,36,"Cancel",false,windowjob) GUIEditor_Label[1] = guiCreateLabel(19,33,273,20,"Are you sure you want to take/leave this job?",false,windowjob) 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) addEventHandler("onClientMarkerHit", marker1, SAPDjob) addEventHandler("onClientMarkerHit", marker2, SAPDjob) function SAPDjobleave(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) addEventHandler("onClientMarkerLeave", marker1, SAPDjobleave) addEventHandler("onClientMarkerLeave", marker2, SAPDjobleave) function joinTeam() triggerServerEvent("setSAPD",localPlayer) guiSetVisible(windowjob, false) showCursor(false) end addEventHandler("onClientGUIClick", GUIEditor_Button[1] , joinTeam, false) function removeTeam() triggerServerEvent("removeSAPD",localPlayer) guiSetVisible(windowjob, false) showCursor(false) end addEventHandler("onClientGUIClick", GUIEditor_Button[3] , removeTeam, false) function removeSAPDWindow() guiSetVisible(windowjob, false) showCursor(false) end addEventHandler("onClientGUIClick", GUIEditor_Button[2] , removeSAPDWindow, false) server: createBlip ( 1552.4996337891, -1677.3264160156, 15.1953125, 30 ) createBlip ( -1604.5458984375, 712.25848388672, 12.8671875, 30 ) createBlip ( 2340.9245605469, 2456.0463867188, 13.96875, 30 ) function createSAPDTeam () SAPDteam = createTeam ("Army", 0, 70, 0) end addEventHandler ("onResourceStart", resourceRoot, createSAPDTeam) function joinSAPD() setPlayerTeam(source,SAPDteam) setElementModel(source, 287) giveWeapon ( source, 3 ) playeraccount = getPlayerAccount( source ) setAccountData( playeraccount, "team", "police", true ) outputChatBox("You are now an Armed Soldier!",source,0,70,0) end addEvent("setSAPD", true) addEventHandler("setSAPD",root,joinSAPD) function removeSAPD() setPlayerTeam(source, 0) takeWeapon(source, 3) playeraccount = getPlayerAccount(source) if getAccountData(playeraccount, "standardskin") == 0 then setElementModel(source, 0) else setElementModel(source,getAccountData(playeraccount,"standardskin")) end outputChatBox("You are now an unemployed.",source,255,0,0) end addEvent("removeSAPD", true) addEventHandler("removeSAPD",root,removeSAPD) Link to comment
Castillo Posted February 21, 2013 Share Posted February 21, 2013 Well, would be helpful if you told us what's wrong and if you are getting any error. Link to comment
illestiraqi Posted February 21, 2013 Author Share Posted February 21, 2013 Well, would be helpful if you told us what's wrong and if you are getting any error. Apperently from what I know the only thing that works is the blip. The Cylinder Markers doesn't show, the job gui doesent show if i walk on the spot where the cylinder is supposed to be plz fix.! Link to comment
TAPL Posted February 21, 2013 Share Posted February 21, 2013 "Cylinder" Should be "cylinder" Link to comment
iPrestege Posted February 21, 2013 Share Posted February 21, 2013 (edited) Where's Marker1 and Marker2 ? addEventHandler("onClientMarkerLeave", marker1, SAPDjobleave) addEventHandler("onClientMarkerLeave", marker2, SAPDjobleave) you will get bad argument . Edited February 21, 2013 by Guest Link to comment
tosfera Posted February 21, 2013 Share Posted February 21, 2013 "Cylinder" Should be "cylinder" is it case sensitive?! O_O Link to comment
TAPL Posted February 21, 2013 Share Posted February 21, 2013 "Cylinder" Should be "cylinder" is it case sensitive?! O_O Of course. Link to comment
iPrestege Posted February 21, 2013 Share Posted February 21, 2013 The Script Will Work if you Add The marker1 and marker2 and edit the marker as "TAPL" say . Link to comment
tosfera Posted February 21, 2013 Share Posted February 21, 2013 "Cylinder" Should be "cylinder" is it case sensitive?! O_O Of course. learned something new again! @illestiraqi, you made the same mistake as I did. you said this; addEventHandler("onClientMarkerHit", , ) And thats something that is wrong! You should do it like this; addEventHandler("onClientMarkerHit", root, ) And inside your function, check if the marker is the job marker; if ( source == marker ) then try this, client: local SAPDJobMarker = createMarker( 186.30000305176, 1938.3000488281, 16.700000762939, "cylinder", 2, 0, 40, 0, 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,170,"Armed Soldier") guiSetVisible(windowjob, false) GUIEditor_Button[1] = guiCreateButton(22,80,108,35,"Take job",false,windowjob) GUIEditor_Button[3] = guiCreateButton(22,120,108,35,"Quit Job",false,windowjob) GUIEditor_Button[2] = guiCreateButton(179,120,110,36,"Cancel",false,windowjob) GUIEditor_Label[1] = guiCreateLabel(19,33,273,20,"Are you sure you want to take/leave this job?",false,windowjob) function SAPDjob(hitElement) if (getElementType(hitElement) == "player") and (hitElement == localPlayer) and (source == SAPDJobMarker) then guiSetVisible(windowjob, true) showCursor(true) end end addEventHandler("onClientMarkerHit", root, SAPDjob) function SAPDjobleave(leaveElement) if (source == SAPDJobMarker) and (getElementType(leaveElement) == "player") and (leaveElement == localPlayer) then if guiGetVisible(windowjob) then guiSetVisible(windowjob, false) showCursor(false) end end end addEventHandler("onClientMarkerLeave", root, SAPDjobleave) function joinTeam() triggerServerEvent("setSAPD",localPlayer) guiSetVisible(windowjob, false) showCursor(false) end addEventHandler("onClientGUIClick", GUIEditor_Button[1] , joinTeam, false) function removeTeam() triggerServerEvent("removeSAPD",localPlayer) guiSetVisible(windowjob, false) showCursor(false) end addEventHandler("onClientGUIClick", GUIEditor_Button[3] , removeTeam, false) function removeSAPDWindow() guiSetVisible(windowjob, false) showCursor(false) end addEventHandler("onClientGUIClick", GUIEditor_Button[2] , removeSAPDWindow, false) Link to comment
TAPL Posted February 21, 2013 Share Posted February 21, 2013 setAccountData( playeraccount, "team", "police", true ) should be setAccountData( playeraccount, "team", "police" ) Also setPlayerTeam(source, 0) should be setPlayerTeam(source, nil) Link to comment
illestiraqi Posted February 22, 2013 Author Share Posted February 22, 2013 tosfera, I tried your's but didn't work. For the others thanks for trying to help me but the truth is I can't script i just tried but it's still not working, I tried changing "C" in cylinder to "c" but didn't work please if you know problem plz re-write the script for me because i don't know how to sorry Link to comment
iPrestege Posted February 22, 2013 Share Posted February 22, 2013 (edited) Try This Server Side : createBlip ( 1552.4996337891, -1677.3264160156, 15.1953125, 30 ) createBlip ( -1604.5458984375, 712.25848388672, 12.8671875, 30 ) createBlip ( 2340.9245605469, 2456.0463867188, 13.96875, 30 ) function createSAPDTeam () SAPDteam = createTeam ("Army", 0, 70, 0) end addEventHandler ("onResourceStart", resourceRoot, createSAPDTeam) function joinSAPD() setPlayerTeam(source,SAPDteam) setElementModel(source, 287) giveWeapon ( source, 3 ) playeraccount = getPlayerAccount( source ) if not isGuestAccount ( playeraccount ) then setAccountData( playeraccount, "team", "police" ) outputChatBox("You are now an Armed Soldier!",source,0,70,0) end end addEvent("setSAPD", true) addEventHandler("setSAPD",root,joinSAPD) function removeSAPD() setPlayerTeam(source,nil) takeWeapon(source, 3) setElementModel(source, 0) outputChatBox("You are now an unemployed.",source,255,0,0) end addEvent("removeSAPD", true) addEventHandler("removeSAPD",root,removeSAPD) Client Side : local marker = createMarker( 1552.4996337891, -1677.3264160156, 15.1953125, "cylinder", 2, 0, 40, 0, 170 ) local marker1 = createMarker( -1604.5458984375, 712.25848388672, 12.8671875, "cylinder", 2, 0, 40, 0, 170 ) local marker2 = createMarker( 2340.9245605469, 2456.0463867188, "cylinder", 2, 0, 40, 0, 170 ) 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,170,"Armed Soldier") guiSetVisible(windowjob, false) GUIEditor_Button[1] = guiCreateButton(22,80,108,35,"Take job",false,windowjob) GUIEditor_Button[3] = guiCreateButton(22,120,108,35,"Quit Job",false,windowjob) GUIEditor_Button[2] = guiCreateButton(179,120,110,36,"Cancel",false,windowjob) GUIEditor_Label[1] = guiCreateLabel(19,33,273,20,"Are you sure you want to take/leave this job?",false,windowjob) 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) addEventHandler("onClientMarkerHit", marker1, SAPDjob) addEventHandler("onClientMarkerHit", marker2, SAPDjob) function SAPDjobleave(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) addEventHandler("onClientMarkerLeave", marker1, SAPDjobleave) addEventHandler("onClientMarkerLeave", marker2, SAPDjobleave) function joinTeam() triggerServerEvent("setSAPD",localPlayer) guiSetVisible(windowjob, false) showCursor(false) end addEventHandler("onClientGUIClick", GUIEditor_Button[1] , joinTeam, false) function removeTeam() triggerServerEvent("removeSAPD",localPlayer) guiSetVisible(windowjob, false) showCursor(false) end addEventHandler("onClientGUIClick", GUIEditor_Button[3] , removeTeam, false) function removeSAPDWindow() guiSetVisible(windowjob, false) showCursor(false) end addEventHandler("onClientGUIClick", GUIEditor_Button[2] , removeSAPDWindow, false) Edited February 22, 2013 by Guest Link to comment
illestiraqi Posted February 22, 2013 Author Share Posted February 22, 2013 (edited) UPDATE: Let Me Try it Edited February 22, 2013 by Guest Link to comment
iPrestege Posted February 22, 2013 Share Posted February 22, 2013 Read My Post Again ^^ . Link to comment
illestiraqi Posted February 22, 2013 Author Share Posted February 22, 2013 Apperently it isn't working any reason why? Well actually the marker isn't showing. Link to comment
iPrestege Posted February 22, 2013 Share Posted February 22, 2013 Marker is showing with me but are you sure you setAccountData To standardskin Before? ** Check My Post Again i remove the standardskin data try it client and server side copy again . 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