mint3d
Members-
Posts
425 -
Joined
-
Last visited
Everything posted by mint3d
-
I can see marker but no gui shows up
-
f = createMarker( x,y,z, "cylinder", 2, 0, 100, 255, 100 ) local vehicles = {} function spawnVeh(id) local x, y, z = getElementPosition(source) if isElement(vehicles[source]) then destroyElement(vehicles[source]) end vehicles[source] = createVehicle(id, x + 3, y, z) warpPedIntoVehicle ( source, vehicles[source] ) end addEvent("CreVehice",true) addEventHandler("CreVehice", root, spawnVeh) addEventHandler("onPlayerQuit", root, function() if isElement(vehicles[source]) then destroyElement(vehicles[source]) vehicles[source] = nil end end) function showGUI(hitPlayer) triggerClientEvent (hitPlayer,"showGUI2",getRootElement(),hitPlayer) end addEventHandler("onMarkerHit",t,showGUI)
-
I have a car spawner script but when i walk into the marker no gui shows up help Wnd = guiCreateWindow(550,100,382,450,"Vehicle System",false) guiSetAlpha( Wnd, 1 ) guiWindowSetMovable(Wnd,true) guiWindowSetSizable(Wnd,false) button = guiCreateButton(36,400,110,47,"Exit",false,Wnd) button2 = guiCreateButton(249,400,110,47,"Spawn",false,Wnd) label2 = guiCreateLabel(127,47,242,15,'',false,Wnd) label = guiCreateLabel(127,34,242,15,"Click on the vehicle you want",false,Wnd) guiLabelSetVerticalAlign(label2,"center") guiLabelSetHorizontalAlign(label2,"center",false) showCursor(false) guiSetVisible( Wnd, false ) vehicles =( ("Infernus", 411) grid = guiCreateGridList(36,78,300,300,false,Wnd) guiGridListAddColumn(grid, "Vehicles", 0.85) for i,veh in ipairs(vehicles) do row = guiGridListAddRow(grid) ) guiGridListSetItemText(grid, row, 1, tostring(veh[1]), false, false guiGridListSetItemData(grid, row, 1, tostring(veh[2])) end function use2() local row, col = guiGridListGetSelectedItem(grid) if (row and col and row ~= -1 and col ~= -1) then local model = tonumber(guiGridListGetItemData(grid, row, 1)) if model ~= "" then --takePlayerMoney (thePlayer, 1000) --takePlayerMoney (player, 1000) triggerServerEvent("CreVehice", localPlayer, model) end end end addEventHandler("onClientGUIClick", button2, use2, false) function close2() if (source == button2) then --takePlayerMoney (localPlayer, 1000) guiSetVisible(Wnd,false) showCursor(false) end end addEventHandler("onClientGUIClick", button2, close2) function close() if (source == button) then guiSetVisible(Wnd,false) showCursor(false) end end addEventHandler("onClientGUIClick", button, close) function showGUI2(hitElement) if getElementType(hitElement) == "player" and (hitElement == localPlayer) then guiSetVisible(Wnd,true) showCursor(true) end end addEvent("showGUI2",true) addEventHandler("showGUI2", getRootElement(), showGUI2)
-
Do you mean something like this dataToFindPlayersJob = "team" vehicles = { {Roles = "Example", vehicles = {1337, 1338}, x = 1337, y = -1337, z = 36.5, rotation = 25, r = 250, g = 250, b = 250, vehR = 0, vehG = 0, vehB = 0}, }
-
[2013-05-10 01:35:44] ERROR: vehiclespawn\vehs.lua:22: bad argument #1 to 'ipairs' (table expected, got nil) and i cant see any marker
-
server local vehicle = {} function isVehicleSpawned(vehicle) return getElementData(vehicle, "jobvehicle") end function doesPlayerHaveVehicleSpawned(player) if (isElement(vehicle[player])) then return true else return false end end function destroyVehicle(vehicle, player) if (isElement(vehicle[player])) then destroyElement(vehicle[player]) end end function createTheJobVehicles() for index, table in ipairs(vehicles) do marker = createMarker(839.95318603516, -2065, 12, "cylinder", 1.4, 11, 11, 11, 255) setElementData(marker, "vehiclemarker-role", table.Roles) setElementData(marker, "vehiclemarker-vehicles", table.vehicles) setElementData(marker, "vehiclemarker-rotation", table.rotation) vehicle[marker] = table.Roles local position = table.x..", "..table.y..", "..table.z..", "..", "..table.rotation local color = table.vehR..", "..table.vehG..", "..table.vehB..", " setElementData(marker, "vehiclemarker-position", position) setElementData(marker, "vehiclemarker-color", color) addEventHandler("onMarkerHit", marker, onPlayerVehicleMarkerHit) end end addEventHandler("onResourceStart", resourceRoot, createTheJobVehicles) function onPlayerVehicleMarkerHit(player) local role = getElementData(source, "vehiclemarker-role") local vehicles = getElementData(source, "vehiclemarker-vehicles") local rotation = getElementData(source, "vehiclemarker-rotation") if (getElementType(player) == "player") then if ( getPlayerTeam(player, getTeamName) == team or team == "SWAT") then if (isPedInVehicle(player)) then return end local position = getElementData(source, "vehiclemarker-position") local color = getElementData(source, "vehiclemarker-color") local posX, posY, posZ, rotation = unpack(split(position, ",")) local r, g, b = unpack(split(color, ",")) triggerClientEvent(player, "jobvehicles.showVehicleGUI", root, vehicles, rotation, posX, posY, posZ, rotation, r, g, b) else outputChatBox("This marker is reserved for '"..role.."'", player, 250, 0, 0) end end end function onPlayerSpawnVehicle(vid, vx, vy, vz, rotation, r, g, b) if (isElement(vehicle[client])) then destroyElement(vehicle[client]) end vehicle[client] = createVehicle(vid, vx, vy, vz) setElementData(vehicle[client], "jobvehicle", true) warpPedIntoVehicle(client, vehicle[client]) setElementRotation(vehicle[client], 0, 0, rotation) outputDebugString(getPlayerName(client).. " has spawned a '"..getVehicleNameFromModel(vid)) outputServerLog(getPlayerName(client).. " has spawned a '"..getVehicleNameFromModel(vid).."'") if (r) then setVehicleColor(vehicle[client], r, g, b) end end addEvent("jobvehicles.onPlayerSpawnVehicle", true) addEventHandler("jobvehicles.onPlayerSpawnVehicle", root, onPlayerSpawnVehicle) function destroyPlayerVehicle() if (isElement(vehicle[source])) then destroyElement(vehicle[source]) end end addEventHandler("onPlayerWasted", root, destroyPlayerVehicle) addEventHandler("onPlayerLogout", root, destroyPlayerVehicle) addEventHandler("onPlayerQuit", root, destroyPlayerVehicle) function destroyMyOwnVehicle(player) if (isElement(vehicle[player])) then outputChatBox("You have succesfully destroyed your "..getVehicleNameFromModel(getElementModel(vehicle[player])).."!", player, 0, 255, 10) destroyElement(vehicle[player]) elseif (not isElement(vehicle[player])) then outputChatBox("You currently do not have a job vehicle spawned to destroy!", player, 250, 0, 0) end end addCommandHandler("destroyv", destroyMyOwnVehicle) function destroyVehicleOnExplode() if (getElementData(source, "jobvehicle")) then destroyElement(source) end end addEventHandler("onVehicleExplode", root, destroyVehicleOnExplode) function onAdminDestroyJobVehicle(admin, cmd, target) local accountname = getAccountName(getPlayerAccount(admin)) if (hasObjectPermissionTo("user."..accountname, "function.kickPlayer") and target) then local player = getPlayerFromName(target) if (isElement(vehicle[player]) and player) then outputChatBox("You have destroyed "..getPlayerName(player).."' s "..getVehicleNameFromModel(getElementModel(vehicle[player])).." (jobvehicle)", admin, 0, 255, 10) outputChatBox(getPlayerName(admin).." has destroyed your "..getVehicleNameFromModel(getElementModel(vehicle[player])).." (jobvehicle)", player, 255, 10, 0) destroyElement(vehicle[player]) elseif (not isElement(vehicle[player]) and player) then outputChatBox(getPlayerName(player).. " does not currently have any job vehicle spawned.", admin, 255, 10, 0) else outputChatBox("The player do not exist!", admin, 250, 0, 0) end end end addCommandHandler("dv", onAdminDestroyJobVehicle) Client local screenWidth, screenHeight = guiGetScreenSize() local v_table = {} function createVehicleChooserGUI() if (isElement(wndVehicle)) then if (guiGetVisible(wndVehicle)) then return end end windowWidth, windowHeight = 321, 338 windowX, windowY = (screenWidth / 2) - (windowWidth / 2), (screenHeight / 2) - (windowHeight / 2) wndVehicle = guiCreateWindow(windowX, windowY, windowWidth, windowHeight, "Select Vehicle",false) guiSetAlpha(wndVehicle, 1) gridVehicle = guiCreateGridList(9,23,303,249,false,wndVehicle) vehicleColumn = guiGridListAddColumn(gridVehicle,"Vehicle",0.-- s8) --> vehicleSpawn = guiCreateButton(9,282,96,37,"Select",false,wndVehicle) vehicleClose = guiCreateButton(216,282,96,37,"Exit",false,wndVehicle) addEventHandler("onClientGUIClick", vehicleSpawn, onPlayerSelectVehicle) addEventHandler("onClientGUIClick", vehicleClose, onPlayerExitVehicleGUI) end function showVehicleGUI(vehicles, rotation, posX, posY, posZ, rotation, r, g, b) createVehicleChooserGUI() v_table[1] = posX v_table[2] = posY v_table[3] = posZ v_table[4] = rotation v_table[5] = r v_table[6] = g v_table[7] = b showCursor(true) guiGridListClear(gridVehicle) for index, vehicles in ipairs(vehicles) do vehicleRow = guiGridListAddRow(gridVehicle) guiGridListSetItemText(gridVehicle, vehicleRow, vehicleColumn, getVehicleNameFromModel(vehicles), false, true) end end addEvent("jobvehicles.showVehicleGUI", true) addEventHandler("jobvehicles.showVehicleGUI", root, showVehicleGUI) function onPlayerExitVehicleGUI(button, state) if (button ~= "left" or state ~= "up") then return end guiSetVisible(wndVehicle, false) showCursor(false) end function onPlayerSelectVehicle(button, state) if (button ~= "left" or state ~= "up") then return end if (guiGridListGetSelectedItem(gridVehicle) == -1) then return end local vrow = guiGridListGetSelectedItem(gridVehicle) local vname = guiGridListGetItemText(gridVehicle, vrow, vehicleColumn) local vid = getVehicleModelFromName(vname) guiSetVisible(wndVehicle, false) showCursor(false) triggerServerEvent("jobvehicles.onPlayerSpawnVehicle", root, vid, v_table[1], v_table[2], v_table[3], v_table[4], v_table[5], v_table[6], v_table[7]) end
-
I have a car spawner script but i dont know how to make it for team FBI Server; local vehicle = {} function isVehicleSpawned(vehicle) return getElementData(vehicle, "jobvehicle") end function doesPlayerHaveVehicleSpawned(player) if (isElement(vehicle[player])) then return true else return false end end function destroyVehicle(vehicle, player) if (isElement(vehicle[player])) then destroyElement(vehicle[player]) end end function createTheJobVehicles() for index, table in ipairs(vehicles) do marker = createMarker(839.95318603516, -2065, 12, "cylinder", 1.4, 11, 11, 11, 255) setElementData(marker, "vehiclemarker-role", table.Roles) setElementData(marker, "vehiclemarker-vehicles", table.vehicles) setElementData(marker, "vehiclemarker-rotation", table.rotation) vehicle[marker] = table.Roles local position = table.x..", "..table.y..", "..table.z..", "..", "..table.rotation local color = table.vehR..", "..table.vehG..", "..table.vehB..", " setElementData(marker, "vehiclemarker-position", position) setElementData(marker, "vehiclemarker-color", color) addEventHandler("onMarkerHit", marker, onPlayerVehicleMarkerHit) end end addEventHandler("onResourceStart", resourceRoot, createTheJobVehicles) function onPlayerVehicleMarkerHit(player) local role = getElementData(source, "vehiclemarker-role") local vehicles = getElementData(source, "vehiclemarker-vehicles") local rotation = getElementData(source, "vehiclemarker-rotation") if (getElementType(player) == "player") then if (getElementData(player, dataToFindPlayersJob) == role or role == "ALL") then if (isPedInVehicle(player)) then return end local position = getElementData(source, "vehiclemarker-position") local color = getElementData(source, "vehiclemarker-color") local posX, posY, posZ, rotation = unpack(split(position, ",")) local r, g, b = unpack(split(color, ",")) triggerClientEvent(player, "jobvehicles.showVehicleGUI", root, vehicles, rotation, posX, posY, posZ, rotation, r, g, b) else outputChatBox("This marker is reserved for '"..role.."'", player, 250, 0, 0) end end end function onPlayerSpawnVehicle(vid, vx, vy, vz, rotation, r, g, b) if (isElement(vehicle[client])) then destroyElement(vehicle[client]) end vehicle[client] = createVehicle(vid, vx, vy, vz) setElementData(vehicle[client], "jobvehicle", true) warpPedIntoVehicle(client, vehicle[client]) setElementRotation(vehicle[client], 0, 0, rotation) outputDebugString(getPlayerName(client).. " has spawned a '"..getVehicleNameFromModel(vid)) outputServerLog(getPlayerName(client).. " has spawned a '"..getVehicleNameFromModel(vid).."'") if (r) then setVehicleColor(vehicle[client], r, g, b) end end addEvent("jobvehicles.onPlayerSpawnVehicle", true) addEventHandler("jobvehicles.onPlayerSpawnVehicle", root, onPlayerSpawnVehicle) function destroyPlayerVehicle() if (isElement(vehicle[source])) then destroyElement(vehicle[source]) end end addEventHandler("onPlayerWasted", root, destroyPlayerVehicle) addEventHandler("onPlayerLogout", root, destroyPlayerVehicle) addEventHandler("onPlayerQuit", root, destroyPlayerVehicle) function destroyMyOwnVehicle(player) if (isElement(vehicle[player])) then outputChatBox("You have succesfully destroyed your "..getVehicleNameFromModel(getElementModel(vehicle[player])).."!", player, 0, 255, 10) destroyElement(vehicle[player]) elseif (not isElement(vehicle[player])) then outputChatBox("You currently do not have a job vehicle spawned to destroy!", player, 250, 0, 0) end end addCommandHandler("destroyv", destroyMyOwnVehicle) function destroyVehicleOnExplode() if (getElementData(source, "jobvehicle")) then destroyElement(source) end end addEventHandler("onVehicleExplode", root, destroyVehicleOnExplode) function onAdminDestroyJobVehicle(admin, cmd, target) local accountname = getAccountName(getPlayerAccount(admin)) if (hasObjectPermissionTo("user."..accountname, "function.kickPlayer") and target) then local player = getPlayerFromName(target) if (isElement(vehicle[player]) and player) then outputChatBox("You have destroyed "..getPlayerName(player).."' s "..getVehicleNameFromModel(getElementModel(vehicle[player])).." (jobvehicle)", admin, 0, 255, 10) outputChatBox(getPlayerName(admin).." has destroyed your "..getVehicleNameFromModel(getElementModel(vehicle[player])).." (jobvehicle)", player, 255, 10, 0) destroyElement(vehicle[player]) elseif (not isElement(vehicle[player]) and player) then outputChatBox(getPlayerName(player).. " does not currently have any job vehicle spawned.", admin, 255, 10, 0)[lua]local screenWidth, screenHeight = guiGetScreenSize() local v_table = {} function createVehicleChooserGUI() if (isElement(wndVehicle)) then if (guiGetVisible(wndVehicle)) then return end end windowWidth, windowHeight = 321, 338 windowX, windowY = (screenWidth / 2) - (windowWidth / 2), (screenHeight / 2) - (windowHeight / 2) wndVehicle = guiCreateWindow(windowX, windowY, windowWidth, windowHeight, "Select Vehicle",false) guiSetAlpha(wndVehicle, 1) gridVehicle = guiCreateGridList(9,23,303,249,false,wndVehicle) vehicleColumn = guiGridListAddColumn(gridVehicle,"Vehicle",0.-- s8) --> vehicleSpawn = guiCreateButton(9,282,96,37,"Select",false,wndVehicle) vehicleClose = guiCreateButton(216,282,96,37,"Exit",false,wndVehicle) addEventHandler("onClientGUIClick", vehicleSpawn, onPlayerSelectVehicle) addEventHandler("onClientGUIClick", vehicleClose, onPlayerExitVehicleGUI) end function showVehicleGUI(vehicles, rotation, posX, posY, posZ, rotation, r, g, b) createVehicleChooserGUI() v_table[1] = posX v_table[2] = posY v_table[3] = posZ v_table[4] = rotation v_table[5] = r v_table[6] = g v_table[7] = b showCursor(true) guiGridListClear(gridVehicle) for index, vehicles in ipairs(vehicles) do vehicleRow = guiGridListAddRow(gridVehicle) guiGridListSetItemText(gridVehicle, vehicleRow, vehicleColumn, getVehicleNameFromModel(vehicles), false, true) end end addEvent("jobvehicles.showVehicleGUI", true) addEventHandler("jobvehicles.showVehicleGUI", root, showVehicleGUI) function onPlayerExitVehicleGUI(button, state) if (button ~= "left" or state ~= "up") then return end guiSetVisible(wndVehicle, false) showCursor(false) end function onPlayerSelectVehicle(button, state) if (button ~= "left" or state ~= "up") then return end if (guiGridListGetSelectedItem(gridVehicle) == -1) then return end local vrow = guiGridListGetSelectedItem(gridVehicle) local vname = guiGridListGetItemText(gridVehicle, vrow, vehicleColumn) local vid = getVehicleModelFromName(vname) guiSetVisible(wndVehicle, false) showCursor(false) triggerServerEvent("jobvehicles.onPlayerSpawnVehicle", root, vid, v_table[1], v_table[2], v_table[3], v_table[4], v_table[5], v_table[6], v_table[7]) end Client; local screenWidth, screenHeight = guiGetScreenSize() local v_table = {} function createVehicleChooserGUI() if (isElement(wndVehicle)) then if (guiGetVisible(wndVehicle)) then return end end windowWidth, windowHeight = 321, 338 windowX, windowY = (screenWidth / 2) - (windowWidth / 2), (screenHeight / 2) - (windowHeight / 2) wndVehicle = guiCreateWindow(windowX, windowY, windowWidth, windowHeight, "Select Vehicle",false) guiSetAlpha(wndVehicle, 1) gridVehicle = guiCreateGridList(9,23,303,249,false,wndVehicle) vehicleColumn = guiGridListAddColumn(gridVehicle,"Vehicle",0.-- s8) --> vehicleSpawn = guiCreateButton(9,282,96,37,"Select",false,wndVehicle) vehicleClose = guiCreateButton(216,282,96,37,"Exit",false,wndVehicle) addEventHandler("onClientGUIClick", vehicleSpawn, onPlayerSelectVehicle) addEventHandler("onClientGUIClick", vehicleClose, onPlayerExitVehicleGUI) end function showVehicleGUI(vehicles, rotation, posX, posY, posZ, rotation, r, g, b) createVehicleChooserGUI() v_table[1] = posX v_table[2] = posY v_table[3] = posZ v_table[4] = rotation v_table[5] = r v_table[6] = g v_table[7] = b showCursor(true) guiGridListClear(gridVehicle) for index, vehicles in ipairs(vehicles) do vehicleRow = guiGridListAddRow(gridVehicle) guiGridListSetItemText(gridVehicle, vehicleRow, vehicleColumn, getVehicleNameFromModel(vehicles), false, true) end end addEvent("jobvehicles.showVehicleGUI", true) addEventHandler("jobvehicles.showVehicleGUI", root, showVehicleGUI) function onPlayerExitVehicleGUI(button, state) if (button ~= "left" or state ~= "up") then return end guiSetVisible(wndVehicle, false) showCursor(false) end function onPlayerSelectVehicle(button, state) if (button ~= "left" or state ~= "up") then return end if (guiGridListGetSelectedItem(gridVehicle) == -1) then return end local vrow = guiGridListGetSelectedItem(gridVehicle) local vname = guiGridListGetItemText(gridVehicle, vrow, vehicleColumn) local vid = getVehicleModelFromName(vname) guiSetVisible(wndVehicle, false) showCursor(false) triggerServerEvent("jobvehicles.onPlayerSpawnVehicle", root, vid, v_table[1], v_table[2], v_table[3], v_table[4], v_table[5], v_table[6], v_table[7]) end
-
you need to make a script or go here and put the TXD and DFF files on this http://mta.dzek.eu/vehicle/
-
I have the gate script but the gate dosent close behind me gateList = {} gateListMoveToX = {} gateListMoveToY = {} gateListMoveToZ = {} gateListMoveTorX = {} gateListMoveTorY = {} gateListMoveTorZ = {} shapes = {} team = {} temp = {} status = {} -- 0 = not moving. 1 = moving to open. 2 = moving to close function checkClass(hitElement, matchingDimension) if ( getElementType(hitElement) == "vehicle" ) then hitElement = getVehicleController(hitElement) end for i=0,#gateList do local name = getTeamName(getPlayerTeam(hitElement)) if(name == false) then name = "false" end if ( name == team[i] or name == "true") then detection = isElementWithinColShape ( hitElement, shapes[i] ) if detection == true then move(i, false) end end end end function loadup(startedResource) gates = xmlLoadFile ( "gates.xml" ) count = xmlNodeGetChildren(gates) for i=1,#count do local gate = xmlFindChild ( gates, "gate", i-1 ) local attributes = xmlNodeGetAttributes ( gate ) for name,value in pairs ( attributes ) do temp["" .. name .. ""] = value end gateList[i] = createObject(temp["objectID"], temp["x"], temp["y"], temp["z"], temp["rx"], temp["ry"], temp["rz"]) gateListMoveToX[i] = temp["x2"] gateListMoveToY[i] = temp["y2"] gateListMoveToZ[i] = temp["z2"] gateListMoveTorX[i] = temp["rx2"] gateListMoveTorY[i] = temp["ry2"] gateListMoveTorZ[i] = temp["rz2"] outputDebugString("" .. temp["objectID"] .. "") shapes[i] = createColRectangle(temp["collisionx"], temp["collisionY"], temp["collisionZ"], temp["collisionSize"],temp["collisionSize"]) team[i] = temp["team"] setElementInterior(gateList[i], temp["interiorID"]) status[i] = 0 addEventHandler ( "onColShapeHit", shapes[i], checkClass ) end xmlUnloadFile ( gates ) end function move(gateIndex, rotate) -- 0 = not moving. 1 = moving to open. 2 = moving to close outputDebugString("moving..") x,y,z = getElementPosition(gateList[gateIndex]) rx,ry,rz = getObjectRotation(gateList[gateIndex]) if status[gateIndex] == 0 then moveObject ( gateList[gateIndex], 2000, gateListMoveToX[gateIndex], gateListMoveToY[gateIndex],gateListMoveToZ[gateIndex]) status[gateIndex] = 2 setTimer ( moveBack, 1000, 2,gateIndex, x,y,z,rx,ry,rz, raising ) end end function resetTimer(index) status[index] =1 end addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), loadup ) Editor = {} Gate = {} Gate2 = {} Precision = {} status = {} coll = {} coll2 = {} coll3 = {} coll4 = {} -- this script mod is (no longer) PRIVATE -- - Deject3d function startBuilding(playerSource, commandName, objectid) if not objectid then outputChatBox("usage: /addgate objectid teamname", playerSource) end team = getTeamName(getPlayerTeam(playerSource)) if team == false then team = "" end for i = 1,20 do if Editor[i] == playerSource then destroyElement(Gate[i]) Gate[i] = null Editor[i] = null Precision[i] = null end if Editor[i] == null then Editor[i] = playerSource -- set Editor[i] to who made the object --creating object -v local x,y,z = getElementPosition(playerSource) object = createObject ( objectid, x + 3,y + 3,z) interior = getElementInterior ( playerSource ) setElementInterior(object,interior) --created object -^ Gate[i] = object -- added object identifier to the array, corresponds to who created it Precision[i] = .5 -- default precision bindKey(playerSource, "i", "down", moveIt) bindKey(playerSource, "j", "down", moveIt) bindKey(playerSource, "k", "down", moveIt) bindKey(playerSource, "l", "down", moveIt) bindKey(playerSource, "mouse_wheel_up", "down", moveIt) bindKey(playerSource, "mouse_wheel_down", "down", moveIt) bindKey(playerSource, "pgup", "down", moveIt) bindKey(playerSource, "pgdn", "down", moveIt) bindKey(playerSource, "u", "down", moveIt) bindKey(playerSource, "o", "down", moveIt) bindKey(playerSource, "[", "down", moveIt) bindKey(playerSource, "]", "down", moveIt) bindKey(playerSource, "enter", "down", nextPosition ,objectid, team) bindKey(playerSource, "delete", "down", removeIt, playerSource) break -- done adding our object and who created it to the arrays... stop the loop end end end function nextPosition(playerSource, key, keyState, objectid, team) unbindKey ( playerSource, "i" ) unbindKey ( playerSource, "j" ) unbindKey ( playerSource, "k" ) unbindKey ( playerSource, "l" ) unbindKey ( playerSource, "pgup" ) unbindKey ( playerSource, "pgdn" ) unbindKey ( playerSource, "mouse_wheel_down") unbindKey ( playerSource, "mouse_wheel_up" ) unbindKey ( playerSource, "enter" ) unbindKey ( playerSource, "delete" ) unbindKey ( playerSource, "u" ) unbindKey ( playerSource, "o" ) unbindKey ( playerSource, "[" ) unbindKey ( playerSource, "]" ) outputDebugString("object 1 set. object 2 controlled. ID: " .. objectid .." team: " .. team .. "") for i = 1,20 do if Editor[i] == playerSource then --creating object -v local x,y,z = getElementPosition(Gate[i]) local rx,ry,rz= getObjectRotation(Gate[i]) object = createObject ( objectid, x,y,z,rx,ry,rz) interior = getElementInterior ( playerSource ) setElementInterior(object,interior) --created object -^ Gate2[i] = object -- added object identifier to the array, corresponds to who created it Precision[i] = .5 -- default precision bindKey(playerSource, "i", "down", moveIt2) bindKey(playerSource, "j", "down", moveIt2) bindKey(playerSource, "k", "down", moveIt2) bindKey(playerSource, "l", "down", moveIt2) bindKey(playerSource, "mouse_wheel_up", "down", moveIt2) bindKey(playerSource, "mouse_wheel_down", "down", moveIt2) bindKey(playerSource, "pgup", "down", moveIt2) bindKey(playerSource, "pgdn", "down", moveIt2) bindKey(playerSource, "u", "down", moveIt2) bindKey(playerSource, "o", "down", moveIt2) bindKey(playerSource, "[", "down", moveIt2) bindKey(playerSource, "]", "down", moveIt2) bindKey(playerSource, "enter", "down", collisionObject, team, objectID) bindKey(playerSource, "delete", "down", removeIt, playerSource) break -- done adding our object and who created it to the arrays... stop the loop end end end function changePrecision(playerSource,commandName,value) if value then for i = 1,20 do if Editor[i] == playerSource then Precision[i] = value outputChatBox("Sensitivity set to: " .. value .. "", playerSource) break end end end end function moveIt(source, key, keyState) for i = 1,20 do if Editor[i] == source then object = Gate[i] prec = Precision[i] break end end if key == "i" then x,y,z = getElementPosition(object) setElementPosition ( object, x,y + prec,z ) end if key =="j" then x,y,z = getElementPosition(object) setElementPosition ( object, x - prec,y,z ) end if key =="l" then x,y,z = getElementPosition(object) setElementPosition ( object, x + prec,y,z ) end if key =="k" then x,y,z = getElementPosition(object) setElementPosition ( object, x,y - prec,z ) end if key =="pgup" then x,y,z = getElementPosition(object) setElementPosition ( object, x,y,z + prec ) end if key =="pgdn" then x,y,z = getElementPosition(object) setElementPosition ( object, x,y ,z - prec ) end -- rotation -- if key =="mouse_wheel_up" then rx,ry,rz = getObjectRotation(object) setObjectRotation ( object, rx,ry,rz - prec * 5) end if key =="mouse_wheel_down" then rx,ry,rz = getObjectRotation(object) setObjectRotation ( object, rx,ry,rz + prec * 5) end if key =="u" then rx,ry,rz = getObjectRotation(object) setObjectRotation ( object, rx,ry - prec*10,rz) end if key =="o" then rx,ry,rz = getObjectRotation(object) setObjectRotation ( object, rx,ry + prec*10,rz) end if key =="[" then rx,ry,rz = getObjectRotation(object) setObjectRotation ( object, rx- prec*10,ry,rz) end if key =="]" then rx,ry,rz = getObjectRotation(object) setObjectRotation ( object, rx+ prec*10,ry,rz) end end function moveIt2(source, key, keyState) for i = 1,20 do if Editor[i] == source then object = Gate2[i] prec = Precision[i] break end end if key == "i" then x,y,z = getElementPosition(object) setElementPosition ( object, x,y + prec,z ) end if key =="j" then x,y,z = getElementPosition(object) setElementPosition ( object, x - prec,y,z ) end if key =="l" then x,y,z = getElementPosition(object) setElementPosition ( object, x + prec,y,z ) end if key =="k" then x,y,z = getElementPosition(object) setElementPosition ( object, x,y - prec,z ) end if key =="pgup" then x,y,z = getElementPosition(object) setElementPosition ( object, x,y,z + prec ) end if key =="pgdn" then x,y,z = getElementPosition(object) setElementPosition ( object, x,y ,z - prec ) end -- rotation -- if key =="mouse_wheel_up" then rx,ry,rz = getObjectRotation(object) setObjectRotation ( object, rx,ry,rz - prec * 5) end if key =="mouse_wheel_down" then rx,ry,rz = getObjectRotation(object) setObjectRotation ( object, rx,ry,rz + prec * 5) end if key =="u" then rx,ry,rz = getObjectRotation(object) setObjectRotation ( object, rx,ry - prec*10,rz) end if key =="o" then rx,ry,rz = getObjectRotation(object) setObjectRotation ( object, rx,ry + prec*10,rz) end if key =="[" then rx,ry,rz = getObjectRotation(object) setObjectRotation ( object, rx- prec*10,ry,rz) end if key =="]" then rx,ry,rz = getObjectRotation(object) setObjectRotation ( object, rx+ prec*10,ry,rz) end
-
Ok i have a SWAT job but everybody see the GUI when i walk in and when it says You must be in SWAT to do this everybody can see also Client; local marker = createMarker( 1288.7602539063, -1642.1657714844, 12.5, "Cylinder", 1.4, 0, 0, 255, 255) 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 showCursor(false) windowjob = guiMyCwindow(301,170,"[sGN] SWAT Team ") 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 SWATjob ( hitElement ) if (getElementType(hitElement) == 'player' ) then if getPlayerTeam(hitElement) and getTeamName(getPlayerTeam(hitElement)) == "SWAT" then guiSetVisible(windowjob, true) showCursor(true) else outputChatBox ("You Must Be on SWAT Team To Do This ",255, 0, 0) end end end addEventHandler("onClientMarkerHit", marker, SWATjob ) function SWATjobleave(leaveElement) if (getElementType(leaveElement) == 'player' ) then guiSetVisible(windowjob, false) showCursor(false) end end addEventHandler("onClientMarkerLeave", marker, SWATjobleave) function joinTeam() triggerServerEvent("setSWAT",localPlayer) guiSetVisible(windowjob, false) showCursor(false) end addEventHandler("onClientGUIClick", GUIEditor_Button[1] , joinTeam, false) function removeTeam() triggerServerEvent("removeSWAT",localPlayer) guiSetVisible(windowjob, false) showCursor(false) end addEventHandler("onClientGUIClick", GUIEditor_Button[3] , removeTeam, false) function removeSWATWindow() guiSetVisible(windowjob, false) showCursor(false) end addEventHandler("onClientGUIClick", GUIEditor_Button[2] , removeSWATWindow, false) Server; function createSWATTeam () SWATteam = createTeam ("SWAT", 0, 0, 255) end addEventHandler ("onResourceStart", resourceRoot, createSWATTeam) function joinSWAT() setPlayerTeam(source,SWATteam) setElementModel(source, 285) giveWeapon ( source, 3 ) playeraccount = getPlayerAccount( source ) setAccountData( playeraccount, "team", "SWAT", true ) outputChatBox("You are now SWAT.",source,0,0,255) end addEvent("setSWAT", true) addEventHandler("setSWAT",root,joinSWAT) function removeSWAT() setPlayerTeam(source, 0) 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("removeSWAT", true) addEventHandler("removeSWAT",root,removeSWAT) function SWATJob ( attacker, attackerweapon, bodypart, loss ) if attacker and getElementType(attacker) == "player" then theTeam = getPlayerTeam ( attacker ) theWL = getPlayerWantedLevel ( source ) theSkin = getElementModel ( attacker ) if (attackerweapon == 3) and (loss > 2 ) and (theWL > 0) then if getTeamName( theTeam ) == "police" or getTeamName( theTeam ) == "SWAT" or getTeamName( theTeam ) == "FBI" then setElementPosition (source, 4076.3999023438, -1788.5, 3.511967, true) theName = getPlayerName ( source ) theCop = getPlayerName ( attacker ) outputChatBox ( "You have been jailed by "..theCop.. " for 60 seconds.", source ) local playeraccount = getPlayerAccount ( attacker ) givePlayerMoney (attacker, 100) setTimer ( setElementPosition, 60000, 1, source, 1544.4332275391, -1674.7698974609, 13.688399200439) setPlayerWantedLevel (source, 0) end end end end addEventHandler ("onPlayerDamage", getRootElement(), policeJob)
-
and it say You are now SWAT only i can see
-
It still shows up about the You must be in swat to do this and Take job Quit job and Cancel
-
i have police because from my police script but i dont' know how to make it by wanted level the jail time
-
Like when it come up Take Job Leave Job and Cancel and all players can see that and the bit You need to be swat to do this
-
i have made a script but when you walk in marker everybody see the info and the You must be in SWAT to do this etc can you help Server function createSWATTeam () SWATteam = createTeam ("SWAT", 0, 0, 255) end addEventHandler ("onResourceStart", resourceRoot, createSWATTeam) function joinSWAT() setPlayerTeam(source,SWATteam) setElementModel(source, 285) giveWeapon ( source, 3 ) playeraccount = getPlayerAccount( source ) setAccountData( playeraccount, "team", "SWAT", true ) outputChatBox("You are now SWAT.",source,0,0,255) end addEvent("setSWAT", true) addEventHandler("setSWAT",root,joinSWAT) function removeSWAT() setPlayerTeam(source, 0) 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("removeSWAT", true) addEventHandler("removeSWAT",root,removeSWAT) function SWATJob ( attacker, attackerweapon, bodypart, loss ) if attacker and getElementType(attacker) == "player" then theTeam = getPlayerTeam ( attacker ) theWL = getPlayerWantedLevel ( source ) theSkin = getElementModel ( attacker ) if (attackerweapon == 3) and (loss > 2 ) and (theWL > 0) then if getTeamName( theTeam ) == "police" or getTeamName( theTeam ) == "SWAT" or getTeamName( theTeam ) == "FBI" then setElementPosition (source, 4076.3999023438, -1788.5, 3.511967, true) theName = getPlayerName ( source ) theCop = getPlayerName ( attacker ) outputChatBox ( "You have been jailed by "..theCop.. " for 60 seconds.", source ) local playeraccount = getPlayerAccount ( attacker ) givePlayerMoney (attacker, 100) setTimer ( setElementPosition, 60000, 1, source, 1544.4332275391, -1674.7698974609, 13.688399200439) setPlayerWantedLevel (source, 0) end end end end addEventHandler ("onPlayerDamage", getRootElement(), policeJob) Client local marker = createMarker( 1288.7602539063, -1642.1657714844, 12.5, "Cylinder", 1.4, 0, 0, 255, 255) 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 showCursor(false) windowjob = guiMyCwindow(301,170,"[sGN] SWAT Team ") 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 SWATjob ( hitElement ) if (getElementType(hitElement) == 'player' ) then if getPlayerTeam(hitElement) and getTeamName(getPlayerTeam(hitElement)) == "SWAT" then guiSetVisible(windowjob, true) showCursor(true) else outputChatBox('You Must Be on SWAT Team To Do This ',255, 0, 0) end end end addEventHandler("onClientMarkerHit", marker, SWATjob) function SWATjobleave(leaveElement) if (getElementType(leaveElement) == 'player' ) then guiSetVisible(windowjob, false) showCursor(false) end end addEventHandler("onClientMarkerLeave", marker, SWATjobleave) function joinTeam() triggerServerEvent("setSWAT",localPlayer) guiSetVisible(windowjob, false) showCursor(false) end addEventHandler("onClientGUIClick", GUIEditor_Button[1] , joinTeam, false) function removeTeam() triggerServerEvent("removeSWAT",localPlayer) guiSetVisible(windowjob, false) showCursor(false) end addEventHandler("onClientGUIClick", GUIEditor_Button[3] , removeTeam, false) function removeSWATWindow() guiSetVisible(windowjob, false) showCursor(false) end addEventHandler("onClientGUIClick", GUIEditor_Button[2] , removeSWATWindow, false)
