Jump to content

Sparrow

Members
  • Posts

    378
  • Joined

  • Last visited

Everything posted by Sparrow

  1. try this function sendMessage2( messageclean, messageType) local message = string.lower(messageclean) local x, y, z = getElementPosition ( source ) if (string.find(messageclean, "a ") and string.find(messageclean, "infernus")) then outputChatBox("Your car has spawned, enjoy!", source, 0, 255, 0) vehicle = createVehicle ( 411, x, y+5, z + 10 ) warpPedIntoVehicle ( source, vehicle ) end end addEventHandler("onPlayerChat",root,sendMessage2)
  2. oops, I forget that lol. what I must add to script to set the player can spawn only 1 vehicle? thanks again...
  3. oh thanks solidsnake, it works now. a little question, whats the different between "ipairs" and "pairs" ?
  4. still no vehilces http://img577.imageshack.us/img577/4518 ... 195533.png
  5. client: local marker = createMarker (1605.600, -1625.300, 12.5, "cylinder", 2, 25, 50, 255, 255 ) local cars = { [596] = 'Police LS', [597] = 'Police SF', [598] = 'Police LV', [599] = 'Police Ranger' } window = guiCreateWindow(561,187,260,388,"Spawn Vehicle",false) guiWindowSetSizable(window,false) spawnButton = guiCreateButton(26,317,96,37,"Spawn",false,window) closeButton = guiCreateButton(142,318,96,37,"Close",false,window) carGrid = guiCreateGridList(23,34,210,249,false,window) guiGridListSetSelectionMode(carGrid,2) guiGridListAddColumn(carGrid,"Vehicle name",0.85) for id,vehName in ipairs(cars) do local row = guiGridListAddRow ( carGrid ) guiGridListSetItemText ( carGrid, row, column, tostring(vehName), false, false ) end function showWindow() local playerTeam = getPlayerTeam (localPlayer) local teamName = getTeamName ( playerTeam ) if teamName == "Police" then guiSetVisible( window, true ) showCursor(true) end end addEventHandler ("onClientMarkerHit", marker, showWindow) function spawn() triggerServerEvent('onGUIClick',localPlayer) end addEventHandler('onClientGUIClick',spawnButton, spawn, false) function setVisible() guiSetVisible(window,false) showCursor(false) end addEvent('setGUIVisible',true) addEventHandler('setGUIVisible',root,setVisible) function closeWindow() guiSetVisible(window,false) showCursor(false) end addEventHandler ("onClientGUIClick", closeButton, closeWindow, false) server: function spawnVeh( ) local uTeam = getPlayerTeam( source ) if not uTeam or uTeam and getTeamName ( uTeam ) ~= 'Police' then local theVehicle = createVehicle (cars, x, y, z, 0, 0, rotZ) -- you have to change cars to the return of the grid list selected vehicle warpPedIntoVehicle(source,theVehicle) triggerClientEvent('setGUIVisible',source) end end addEvent('onGUIClick',true) addEventHandler('onGUIClick',root,spawnVeh)
  6. still no vehicles on grid list
  7. no vehicles on gridlist and erros when I walk to marker are:
  8. the script didn't work with localPlayer() so I change it to localPlayer and now errors are:
  9. still same errors also no vehicles on gridlist
  10. I need to add "warpPedIntoVehicle" in another lua file? or just copy yours draken?
  11. well, I'll trying to do a marker for spawning vehicles only for Police team, and this is my first time I add grid list, I used wiki, but can't get help from there, this is the error: and on the grid list, there are no vehicles script: local marker = createMarker (1605.600, -1625.300, 12.5, "cylinder", 2, 25, 50, 255, 255 ) local cars = {[596] = true, [597] = true, [598] = true, [599] = true} window = guiCreateWindow(561,187,260,388,"Spawn Vehicle",false) guiWindowSetSizable(window,false) spawnButton = guiCreateButton(26,317,96,37,"Spawn",false,window) closeButton = guiCreateButton(142,318,96,37,"Close",false,window) carGrid = guiCreateGridList(23,34,210,249,false,window) guiGridListSetSelectionMode(carGrid,2) guiGridListAddColumn(carGrid,"Vehicle name",0.85) for key,vehName in ipairs(cars) do local row = guiGridListAddRow ( carGrid ) guiGridListSetItemText ( carGrid, row, column, vehName, false, false ) end lp = getLocalPlayer ( ) function showWindow() local playerTeam = getPlayerTeam ( lp ) local teamName = getTeamName ( playerTeam ) if teamName == "Police" then if not guiGetVisible( window ) then guiSetVisible( window, true ) showCursor( true ) end end end addEventHandler ("onClientMarkerHit", marker, showWindow) function spawnVeh( ) local uTeam = getPlayerTeam( lp ) if not uTeam or uTeam and getTeamName ( uTeam ) ~= 'Police' then local theVehicle = createVehicle (cars, x, y, z, 0, 0, rotZ) warpPedIntoVehicle(source, theVehicle) guiSetVisible( window, false ) showCursor( false ) end end addEventHandler( "onClientGUIClick", spawnButton , spawnVeh, false )
  12. in what line are the error(s)?
  13. Sparrow

    Private car

    I've done that before, I may post it in community... EDIT: script on the community: https://community.multitheftauto.com/index.php?p= ... ls&id=3793
  14. Sparrow

    Private car

    you mean set vehicle owner?
  15. it showed for all players when I hit marker I test it
  16. here is the gui, I wanna only the GUI showed on screen when player walk to it. window = guiCreateWindow(438,171,370,406,"Job System",false) guiWindowSetSizable(window,false) infoLabel = guiCreateLabel(150,32,66,20,"Police job",false,window) guiLabelSetColor(infoLabel,0,255,0) guiSetFont(infoLabel,"clear-normal") jobMemo = guiCreateMemo(19,61,332,255,"Police job: Description coming soon.!",false,window) guiMemoSetReadOnly(jobMemo,true) acceptButton = guiCreateButton(54,334,113,45,"Accept",false,window) closeButton = guiCreateButton(206,333,113,45,"Close",false,window)
  17. I'm using yours, but the GUI comes to all players when they join or walk to marker.
  18. I get job by pressing a button on an GUI, so I don't need command for it. ok, this is good, it's working. hm, I got another problem, when player join or when someone walk to marker, all the players recive the GUI, how to fix that?
  19. herr herr, what the fail?
  20. I do this, it didn't work, also no errors server: function createPoliceTeam() policeTeam = createTeam ("Police", 25, 50, 255) end addEventHandler ("onResourceStart", getRootElement(), createPoliceTeam) function acceptJob ( ) local getTeam = getTeamFromName ("Police") if theTeam then setPlayerTeam (source, policeTeam) setElementModel (source, 280) guiSetVisible(window, false) showCursor(false) outputChatBox ("You are now police officer.", source, 0,255, 0) else outputChatBox ("You are wanted, you can not take this job.", source, 255, 0, 0) end end addEvent ("setTeam", true) addEventHandler ("setTeam", getRootElement(), acceptJob) client: local jobMarker = createMarker (1574.700, -1634.300, 12.600, "cylinder", 1.5, 25, 50, 255, 255) function setJob(hitElement, thePlayer) local wanted = getPlayerWantedLevel (thePlayer) if (wanted == 0) then if getElementType(hitElement) == "player" then playerName = getPlayerName ( getLocalPlayer() ) if not guiGetVisible(window) then guiSetVisible(window, true) showCursor(true) elseif (wanted > 0) then showCursor(false) guiSetVisible(window, false) end end end end addEventHandler("onClientMarkerHit", jobMarker, setJob)
×
×
  • Create New...