Jump to content

yousseftawab

Members
  • Posts

    13
  • Joined

  • Last visited

Everything posted by yousseftawab

  1. I made spawn markers it's supposed that when you spawn a car it gets spawned with a certain rotation and with certain colors and if you spawn another car it still does the same functions but it destorys the previous car. My problem is: 1. it spawns the car with the 1st color only I need to make it with the 2 colors 2.it spawns cars from all markers not just this marker in the same rotation. example: I have four medic spawn markers they all spawn in the same rotation 3.When I edit the script to make each marker spawn in it's own rotation, when I spawn the previous car doesn't get destroyed. Client: local marker = createMarker(429, -1904, 2, 'cylinder', 1.5, 10, 10, 200, 200) local vehicles = {"Rancher", "HPV1000", "Police LV", "Police LS", "Police SF", "S.W.A.T.", "Police Ranger", "Enforcer", "Cheetah"} function createVehGui () MainGui = guiCreateWindow(408,203,240,349,"SWAT Spawn Marker",false) guiWindowSetSizable ( MainGui, false ) VehGrid = guiCreateGridList(14,32,180,256,false,MainGui) guiGridListSetSelectionMode(VehGrid,2) _bikes = guiGridListAddColumn(VehGrid,"Vehicles",0.85) Spawn = guiCreateButton(15,305,96,35,"Spawn",false,MainGui) guiSetFont(Spawn,"clear-normal") Cancel = guiCreateButton(128,305,96,35,"Cancel",false,MainGui) guiSetFont(Cancel,"clear-normal") for index, vehicle in ipairs(vehicles) do local row = guiGridListAddRow (VehGrid) guiGridListSetItemText ( VehGrid, row, _bikes, tostring(vehicle), false, false ) end end addEventHandler ( "onClientMarkerHit", marker, function ( hitElement ) if ( getTeamName(getPlayerTeam(hitElement)) == "SWAT Team") then if not isPedInVehicle ( hitElement ) then if isPedOnGround (hitElement) then if ( hitElement == localPlayer ) then createVehGui ( hitElement ) if ( MainGui ~= nil ) then guiSetVisible ( MainGui, true ) showCursor ( true ) guiSetInputEnabled ( true ) setElementFrozen ( hitElement, true ) end end end end end end ) addEventHandler("onClientGUIClick", root, function () if (source == Spawn) then local row,col = guiGridListGetSelectedItem(VehGrid) if (row and col and row ~= -1 and col ~= -1) then local vehicleName = guiGridListGetItemText(VehGrid, row, 1) if vehicleName == "Rancher" then triggerServerEvent("spawnvehicleSWAT",localPlayer,490) elseif vehicleName == "HPV1000" then triggerServerEvent("spawnvehicleSWAT",localPlayer,523) elseif vehicleName == "Police LV" then triggerServerEvent("spawnvehicleSWAT",localPlayer,598) elseif vehicleName == "Police LS" then triggerServerEvent("spawnvehicleSWAT",localPlayer,596) elseif vehicleName == "Police SF" then triggerServerEvent("spawnvehicleSWAT",localPlayer,597) elseif vehicleName == "S.W.A.T." then triggerServerEvent("spawnvehicleSWAT",localPlayer,601) elseif vehicleName == "Police Ranger" then triggerServerEvent("spawnvehicleSWAT",localPlayer,599) elseif vehicleName == "Enforcer" then triggerServerEvent("spawnvehicleSWAT",localPlayer,427) elseif vehicleName == "Cheetah" then triggerServerEvent("spawnvehicleSWAT",localPlayer,415) end else outputChatBox("Error: Please, select a vehicle of list.",255,0,0) end elseif (source == Cancel) then triggerEvent("closeWindow", root ) end end ) addEventHandler("onClientMarkerLeave", marker, function () triggerEvent("closeWindow", root ) end ) addEvent("closeWindow", true) addEventHandler("closeWindow", root, function () guiSetVisible(MainGui, false) showCursor(false) guiSetInputEnabled(false) setElementFrozen(localPlayer, false) end ) Server: local vehicles = { } addEvent ( "spawnvehicleSWAT", true ) addEventHandler ( "spawnvehicleSWAT", root, function ( vehID ) if ( isElement ( vehicles [ source ] ) ) then destroyElement ( vehicles [ source ] ) end vehicles [ source ] = createVehicle ( vehID, getElementPosition ( source ) ) if ( vehicles [ source ] ) then setVehicleColor ( vehicles [ source ], 10, 10, 200 ) setVehicleRotation ( vehicles [ source ], 0, 0, 0 ) end setTimer ( warpPedIntoVehicle, 200, 1, source, vehicles [ source ] ) triggerClientEvent ( source, "closeWindow", root ) end ) and here is another marker just in-case: Client: local marker = createMarker(1598.6999511719, -1626.4000244141, 12.5, 'cylinder', 1.5, 55, 97, 255, 200) local vehicles = {"Police LS", "Police SF","Police LV","Police Ranger"} function createVehGui () MainGui = guiCreateWindow(408,203,240,349,"Police Spawn",false) guiWindowSetSizable ( MainGui, false ) VehGrid = guiCreateGridList(14,32,180,256,false,MainGui) guiGridListSetSelectionMode(VehGrid,2) _bikes = guiGridListAddColumn(VehGrid,"Vehicles",0.85) Spawn = guiCreateButton(15,305,96,35,"Spawn",false,MainGui) guiSetFont(Spawn,"clear-normal") Cancel = guiCreateButton(128,305,96,35,"Cancel",false,MainGui) guiSetFont(Cancel,"clear-normal") for index, vehicle in ipairs(vehicles) do local row = guiGridListAddRow (VehGrid) guiGridListSetItemText ( VehGrid, row, _bikes, tostring(vehicle), false, false ) end end addEventHandler ( "onClientMarkerHit", marker, function ( hitElement ) if ( getTeamName(getPlayerTeam(hitElement)) == "Police Service") then if not isPedInVehicle ( hitElement ) then if isPedOnGround ( hitElement ) then if ( hitElement == localPlayer ) then createVehGui ( hitElement ) if ( MainGui ~= nil ) then guiSetVisible ( MainGui, true ) showCursor ( true ) guiSetInputEnabled ( true ) setElementFrozen ( hitElement, true ) end end end end end end ) addEventHandler("onClientGUIClick", root, function () if (source == Spawn) then local row,col = guiGridListGetSelectedItem(VehGrid) if (row and col and row ~= -1 and col ~= -1) then local vehicleName = guiGridListGetItemText(VehGrid, row, 1) if vehicleName == "Police LV" then triggerServerEvent("spawnvehiclePOL",localPlayer,598) elseif vehicleName == "Police LS" then triggerServerEvent("spawnvehiclePOL",localPlayer,596) elseif vehicleName == "Police SF" then triggerServerEvent("spawnvehiclePOL",localPlayer,601) elseif vehicleName == "Police Ranger" then triggerServerEvent("spawnvehiclePOL",localPlayer,599) end else outputChatBox("Error: Please, select a vehicle of list.",255,0,0) end elseif (source == Cancel) then triggerEvent("closeWindow", root ) end end ) addEventHandler("onClientMarkerLeave", marker, function () triggerEvent("closeWindow", root ) end ) addEvent("closeWindow", true) addEventHandler("closeWindow", root, function () guiSetVisible(MainGui, false) showCursor(false) guiSetInputEnabled(false) setElementFrozen(localPlayer, false) end ) Server: local vehicles = { } addEvent ( "spawnvehiclePOL", true ) addEventHandler ( "spawnvehiclePOL", root, function ( vehID ) if ( isElement ( vehicles [ source ] ) ) then destroyElement ( vehicles [ source ] ) end vehicles [ source ] = createVehicle ( vehID, getElementPosition ( source ) ) if ( vehicles [ source ] ) then setVehicleColor ( vehicles [ source ], 0, 0, 0 ) setVehicleRotation ( vehicles [ source ], 0, 0, 0 ) end setTimer ( warpPedIntoVehicle, 200, 1, source, vehicles [ source ] ) triggerClientEvent ( source, "closeWindow", root ) end )
  2. I want the player to warp to the other side of the wall on marker hit and it Only Works if he is out of a vehicle I Want it for Both in a vehicle and out of a vehicle local allowedGroups = { ["Armed Forces"]=true } afMarker8 = createMarker ( 135.19999694824, 1938.4000244141, 18.60000038147, "cylinder", 5, 255, 255, 255, 0 ) function afmaker8(hitElement) if ( allowedGroups [ getElementData ( hitElement, "gang" ) ] ) then setElementPosition( hitElement, 135.19999694824, 1952.6999511719, 19 ) end end addEventHandler("onMarkerHit", afMarker8, afmaker8)
  3. it says incorrect client type for this command EDIT: it's still not working and i tried everything
  4. Still Not Working the gui opens when I press take job it doesn't do anything
  5. Still not working I don't know what to do
  6. I want to restrict the job to Armed forces ACL but it doesn't work it what is wrong. it works fine with no restriction but with the restriction it wont work what is wrong? CLIENT SIDE local marker = createMarker( 94.800003051758, 1925.1999511719, 17, "Cylinder", 2, 40, 73, 0, 200) GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Label = {} windowjob = guiCreateWindow(531,232,301,397,"Armed Forces",false) guiSetVisible(windowjob, false) GUIEditor_Button[1] = guiCreateButton(22,352,108,35,"Take job",false,windowjob) GUIEditor_Label[1] = guiCreateLabel(193,-103,5,5,"",false,windowjob) GUIEditor_Button[2] = guiCreateButton(179,352,110,36,"Cancel",false,windowjob) GUIEditor_Memo[1] = guiCreateMemo(19,33,273,215,"Welcome To Armed Forces\n\nTo take Armed Forces job, press Take job.\n\nIf you don't want to, press Cancel.",false,windowjob) function AFjob( pPlayer ) if local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Armed Forces" ) ) then if pPlayer == localPlayer then if not guiGetVisible(windowjob) then guiSetVisible(windowjob, true) showCursor(true) end end end end end addEventHandler("onClientMarkerHit", marker, AFjob) function AFjobleave( pPlayer ) if pPlayer == localPlayer then if guiGetVisible(windowjob) then guiSetVisible(windowjob, false) showCursor(false) end end end addEventHandler("onClientMarkerLeave", marker, AFjobleave) function joinTeam() triggerServerEvent("setAF",localPlayer) guiSetVisible(windowjob, false) showCursor(false) end addEventHandler("onClientGUIClick", GUIEditor_Button[1] , joinTeam, false) function removeAFWindow() guiSetVisible(windowjob, false) showCursor(false) end addEventHandler("onClientGUIClick", GUIEditor_Button[2] , removeAFWindow, false) SERVER SIDE function createTeamsOnStart () teamAF = createTeam ( "Armed Forces", 40, 73, 0 ) setTeamFriendlyFire ( teamAF, false ) end addEventHandler("onResourceStart", resourceRoot, createTeamsOnStart) function joinAF(hitElement) setPlayerTeam(source,teamAF) setBlipColor ( source, 40, 73, 0, 255 ) setElementModel(source,287) setPlayerNametagColor (source, 40, 73, 0 ) giveWeapon ( source, 3, 1 ) setElementData( source, "Occupation", "Armed Forces", true ) outputChatBox("You have been employed as Armed Forces.",source,0,255,0) end addEvent("setAF", true) addEventHandler("setAF",root,joinAF)
  7. it Worked! you all rock thanks guys
  8. I set timer and it's still bugged look ---------server side-------- addEvent("warpEvent", true) function warp ( thePlayer, theCar ) warpPedIntoVehicle( thePlayer, theCar ) end addEventHandler("warpEvent", getRootElement(), warp) setTimer ( warpPedIntoVehicle, 2500, 1 ) --------client side---------- function Patriot() humvee = createVehicle ( 470, 208.60000610352, 1920.6999511719, 16.60000038147, 0, 0, 90 ) guiSetVisible(GUIEditor_Window[1], false) showCursor(false) triggerServerEvent( "warpEvent", source, humvee ) end addEventHandler("onClientGUIClick", GUIEditor_Button[1] , Patriot)
  9. what is wrong? when i walk into the marker the gui pops up when I press patriot it spawns but it warps me over it not in it please help function Patriot() humvee = createVehicle ( 470, 208.60000610352, 1920.6999511719, 16.60000038147, 0, 0, 90 ) guiSetVisible(GUIEditor_Window[1], false) showCursor(false) warpPedIntoVehicle ( source, humvee ) end addEventHandler("onClientGUIClick", GUIEditor_Button[1] , Patriot, false)
  10. I made a spawn marker but I want it to spawn only when someone from the Armed Forces Team steps in But it's not working what's wrong with it? --server sided local vehicleMarker = createMarker(208.60000610352, 1920.6999511719, 16.60000038147, 'cylinder', 2.0, 40, 73, 0, 200 ) function vehicleMarkerHit ( hitElement, matchingDimension ) if getPlayerTeam(source) == ("Armed Forces") then if getElementType ( hitElement ) == "player" and not isPedInVehicle (hitElement) then local vehicle = createVehicle ( 470, 208.60000610352, 1920.6999511719, 16.60000038147, 0, 0, 90 ) warpPedIntoVehicle(hitElement, vehicle) else end end end addEventHandler( "onMarkerHit", vehicleMarker , vehicleMarkerHit )
  11. please help I made a lot of jobs and everything is working well but when someone walks into the marker the gui appears to everyone not him only. I want the Gui to appear to him only I tried everything please help me. here is the code: local marker = createMarker( 94.800003051758, 1925.1999511719, 17, "Cylinder", 2, 40, 73, 0, 200) GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Label = {} windowjob = guiCreateWindow(531,232,301,397,"Armed Forces",false) guiSetVisible(windowjob, false) GUIEditor_Button[1] = guiCreateButton(22,352,108,35,"Take job",false,windowjob) GUIEditor_Label[1] = guiCreateLabel(193,-103,5,5,"",false,windowjob) GUIEditor_Button[2] = guiCreateButton(179,352,110,36,"Cancel",false,windowjob) GUIEditor_Memo[1] = guiCreateMemo(19,33,273,215,"Welcome To Armed Forces\n\nTo take Armed Forces job, press Take job.\n\nIf you don't want to, press Cancel.",false,windowjob) function AFjob(hitElement) if getElementType(hitElement) == "player" then if not guiGetVisible(windowjob) then guiSetVisible(windowjob, true) showCursor(true) end end end addEventHandler("onClientMarkerHit", marker, AFjob) function AFjobleave(leaveElement) if getElementType(leaveElement) == "player" then if guiGetVisible(windowjob) then guiSetVisible(windowjob, false) showCursor(false) end end end addEventHandler("onClientMarkerLeave", marker, AFjobleave) function joinTeam() triggerServerEvent("setAF",localPlayer) guiSetVisible(windowjob, false) showCursor(false) end addEventHandler("onClientGUIClick", GUIEditor_Button[1] , joinTeam, false) function removeAFWindow() guiSetVisible(windowjob, false) showCursor(false) end addEventHandler("onClientGUIClick", GUIEditor_Button[2] , removeAFWindow, false) server side: function createTeamsOnStart () teamAF = createTeam ( "Armed Forces", 40, 73, 0 ) setTeamFriendlyFire ( teamAF, false ) end addEventHandler("onResourceStart", resourceRoot, createTeamsOnStart) function joinAF() setPlayerTeam(source,teamAF) setElementModel(source,287) setPlayerNametagColor (source, 40, 73, 0 ) giveWeapon ( source, 3, 1 ) setElementData( source, "Occupation", "Armed Forces", true ) outputChatBox("You have been employed as Armed Forces.",source,0,255,0) end addEvent("setAF", true) addEventHandler("setAF",root,joinAF)
  12. Please help me I have the same Problem when the player dies he gets kicked out of his team and I don't understand what to do?
×
×
  • Create New...