Jump to content

isa_Khamdan

Members
  • Posts

    484
  • Joined

  • Last visited

Everything posted by isa_Khamdan

  1. I defined it now but it still not working?
  2. What is wrong with this code? It is triggered server event addEventHandler('Spawn',root, function() local account = getPlayerAccount(source) -- get account element from player element local accname = getAccountName(account) -- get account name from account element if isObjectInACLGroup("user." .. getAccountName(accname),aclGetGroup("PCS")) then outputConsole ( "accname" ) end end )
  3. Never mind I fixed it , thanks a lot for your help
  4. Ok it showed now thanks but why is the car table not showing in the GUI
  5. there is no errors now but the command that show gui doesn't work? local PCSTable = { ["Sparrow"] = 469, ["Stuntplane"] = 513, ["BF-400"] = 581, ["Freeway"] = 463, ["Speeder"] = 452, ["Jester"] = 559, ["Sabre"] = 475, ["Police Ranger"] = 599, ["Utility Van"] = 552, ["Tug"] = 583 } function createwindowPCS() windowPCS = guiCreateWindow(266, 170, 217, 365, "Private Cars System", false) guiWindowSetSizable(windowPCS, false) guiSetProperty(windowPCS, "CaptionColour", "FFFE6B00") PCSbutton = guiCreateButton(53, 298, 115, 36, "Create", false, windowPCS) addEventHandler("onClientGUIClick",PCSbutton,createVehicleHandler,false) guiSetVisible(windowPCS,false) PCSlabel = guiCreateLabel(158, 342, 50, 19, "by Nexus", false, windowPCS) PCSgridlist = guiCreateGridList(10, 54, 197, 238, false, windowPCS) guiGridListAddColumn(PCSgridlist,"Vehicle",0.2) guiGridListAddColumn(PCSgridlist,"Type",0.2) guiGridListSetColumnWidth(PCSgridlist,1,0.4,true) guiGridListSetColumnWidth(PCSgridlist,2,0.5,true) PCSscrollbar = guiCreateScrollBar(182, 3, 15, 235, false, false, PCSgridlist) end addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()), function() createwindowPCS() end ) function showwindowPCS() -- if the window isnt visible, show it if not guiGetVisible(windowPCS) then guiSetVisible(windowPCS,true) showCursor(true,true) end end -- add the command /vehicleselection and set it to call the showVehicleSelection function addCommandHandler("test",showwindowPCS) function createVehicleHandler(button,state) if button == "left" and state == "up" then -- get the selected item in the gridlist local row,col = guiGridListGetSelectedItem(PCSgridlist) -- if something is selected if row and col and row ~= -1 and col ~= -1 then -- get the vehicle id data from the gridlist that is selected local selected = guiGridListGetItemData(PCSgridlist,row,col) -- make sure the vehicle id is a number not a string selected = tonumber(selected) -- get the players position and rotation local rotz = getPedRotation(getLocalPlayer()) local x,y,z = getElementPosition(getLocalPlayer()) -- find the position directly infront of the player x = x + ( math.cos ( math.rad ( rotz+90 ) ) * 3) y = y + ( math.sin ( math.rad ( rotz+90 ) ) * 3) if selected and x and y and z then -- trigger the server triggerServerEvent("createVehicleFromGUI",getRootElement(),selected,x,y,z) -- hide the gui and the cursor guiSetVisible(windowPCS,false) showCursor(false,false) else outputChatBox("Invalid arguments.") end else -- otherwise, output a message to the player outputChatBox("Please select a vehicle.") end end end function createMyVehicle(vehicleid,x,y,z) -- check all the arguments exist if vehicleid and x and y and z then createVehicle(vehicleid,x,y,z) end end addEvent("createVehicleFromGUI",true) addEventHandler("createVehicleFromGUI",root,createMyVehicle)
  6. I am getting problem in the line 60 ' Bad argument #1 to pairs ( table expected , got nill ) else when I write the command the gui never shows up? local PCSTable = { ["Sparrow"] = 469, ["Stuntplane"] = 513, ["BF-400"] = 581, ["Freeway"] = 463, ["Speeder"] = 452, ["Jester"] = 559, ["Sabre"] = 475, ["Police Ranger"] = 599, ["Utility Van"] = 552, ["Tug"] = 583 } function createwindowPCS() windowPCS = guiCreateWindow(266, 170, 217, 365, "Private Cars System", false) guiWindowSetSizable(windowPCS, false) guiSetProperty(windowPCS, "CaptionColour", "FFFE6B00") PCSbutton = guiCreateButton(53, 298, 115, 36, "Create", false, windowPCS) addEventHandler("onClientGUIClick",PCSbutton,createVehicleHandler,false) guiSetVisible(windowPCS,false) populateGridlist() guiSetProperty(PCSbutton[1], "NormalTextColour", "FFAAAAAA") PCSlabel[2] = guiCreateLabel(158, 342, 50, 19, "by Nexus", false, windowPCS) PCSgridlist = guiCreateGridList(10, 54, 197, 238, false, windowPCS) guiGridListAddColumn(PCSgridlist,"Vehicle",0.2) guiGridListAddColumn(PCSgridlist,"Type",0.2) guiGridListSetColumnWidth(PCSgridlist,1,0.4,true) guiGridListSetColumnWidth(PCSgridlist,2,0.5,true) PCSscrollbar = guiCreateScrollBar(182, 3, 15, 235, false, false, PCSgridlist) end addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()), function() createwindowPCS() end ) function showwindowPCS() -- if the window isnt visible, show it if not guiGetVisible(windowPCS) then guiSetVisible(windowPCS,true) showCursor(true,true) end end -- add the command /vehicleselection and set it to call the showVehicleSelection function addCommandHandler("test",showwindowPCS) function populateGridlist() for name,vehicle in pairs(vehicleSelectionTable) do local row = guiGridListAddRow(PCSTable) -- set the text in the first column to the vehicle name guiGridListSetItemText(vehicleSelectionTable,row,1,name,false,false) -- set the text in the second column to the vehicle type guiGridListSetItemText(vehicleSelectionTable,row,2,getVehicleType(vehicle),false,false) -- set the data for gridlist slot as the vehicle id guiGridListSetItemData(vehicleSelectionTable,row,1,tostring(vehicle)) end end function createVehicleHandler(button,state) if button == "left" and state == "up" then -- get the selected item in the gridlist local row,col = guiGridListGetSelectedItem(PCSgridlist) -- if something is selected if row and col and row ~= -1 and col ~= -1 then -- get the vehicle id data from the gridlist that is selected local selected = guiGridListGetItemData(PCSgridlist,row,col) -- make sure the vehicle id is a number not a string selected = tonumber(selected) -- get the players position and rotation local rotz = getPedRotation(getLocalPlayer()) local x,y,z = getElementPosition(getLocalPlayer()) -- find the position directly infront of the player x = x + ( math.cos ( math.rad ( rotz+90 ) ) * 3) y = y + ( math.sin ( math.rad ( rotz+90 ) ) * 3) if selected and x and y and z then -- trigger the server triggerServerEvent("createVehicleFromGUI",getRootElement(),selected,x,y,z) -- hide the gui and the cursor guiSetVisible(windowPCS,false) showCursor(false,false) else outputChatBox("Invalid arguments.") end else -- otherwise, output a message to the player outputChatBox("Please select a vehicle.") end end end function createMyVehicle(vehicleid,x,y,z) -- check all the arguments exist if vehicleid and x and y and z then createVehicle(vehicleid,x,y,z) end end addEvent("createVehicleFromGUI",true) addEventHandler("createVehicleFromGUI",root,createMyVehicle)
  7. I am still getting the same problem
  8. I am getting error in these lines of the GUI " Error unexpected symbol near ')' so can anyone tell me how to fix this? addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()), function() createwindowPCS() end )
  9. lol now you can't even open freeroam when you are inside the car even if you are not in the modshop
  10. It is 50p Modshop script Edit : can you give me the code so I can test it? I didn't understand what did you mean about changing the source
  11. Like this function toggleFRWindow() if ( getPedOccupiedVehicle ( source ) ) then if ( getVehicleModShop( getPedOccupiedVehicle( source ) ) ) then return; end end if isWindowOpen(wndMain) then showCursor(false) hideAllWindows() colorPicker.closeSelect() else showCursor(true) showAllWindows() end end addCommandHandler('fr', toggleFRWindow) Edit : I tested it but it didn't work?
  12. Like this? addEventHandler('onClientResourceStart', g_ResRoot, function() if ( getPedOccupiedVehicle ( source ) ) then if ( getVehicleModShop( getPedOccupiedVehicle( source ) ) ) then return; end end fadeCamera(true) setTimer(getPlayers, 1000, 1) bindKey('f1', 'down', toggleFRWindow) createWindow(wndMain) hideAllWindows() guiCheckBoxSetSelected(getControl(wndMain, 'Jetpack'), doesPedHaveJetPack(g_Me)) guiCheckBoxSetSelected(getControl(wndMain, 'Falloff'), canPedBeKnockedOffBike(g_Me)) setJetpackMaxHeight ( 9001 ) triggerServerEvent('onLoadedAtClient', g_ResRoot, g_Me) end )
  13. So there is no way to cancel client events? Edit what about your way ( the mod shop isn't part of the freeroam resource ) will it work? if ( getPedOccupiedVehicle ( source ) ) then if ( getVehicleModShop( getPedOccupiedVehicle( source ) ) ) then return; end end
  14. I found another way to do that but I am having a problem how can I cancel the event that open the modshop gui? I made this code but it didn't work addEventHandler( "onMarkerLeave", getRootElement( ), function( ) local veh = getPlayerOccupiedVehicle( source ) if veh then local driver = getVehicleController( veh ) if driver == source then if getVehicleModShop( veh ) then unfreezeVehicleInModShop( veh ) triggerClientEvent( source, "modShop_moddingConfirmed", source ) else cancelEvent () triggerClientEvent( driver, "onClientPlayerEnterModShop", player, vehicle, getPlayerMoney( player ), modShops[ k ].name ) end end end end )
  15. People can use freeroam to do these things ( warp , Create ) is it possible to disable it in the modshop area?
  16. ok I made it work but what if the player created another car and the old one gone or what if he just used the map and teleported to another place?
  17. No I want it that if the vehicle leave the marker in any way ( destroyed , warped or anythings ) Edit : the code works only if the player leaves the marker
  18. How can I make this code works for vehicles too , this code works for the players only when they leave the marker but I want it for vehicles too so when the vehicle leave the marker ( destroyed or warped to another place ) it will do the functions so can anyone help me? addEventHandler( "onMarkerLeave", getRootElement( ), function( ) local veh = getPlayerOccupiedVehicle( source ) if veh then local driver = getVehicleController( veh ) if driver == source then if getVehicleModShop( veh ) then unfreezeVehicleInModShop( veh ) setModShopBusy( shop, 0, false ) triggerClientEvent( source, "modShop_moddingConfirmed", source ) end end end end )
  19. isa_Khamdan

    Pickups

    Is there any script in the community that create pickups in a selected area but in random places in the selected area and when you take the pickup the player will get amount of money and another pickup will spawn directly in another location so if there is a script like that can someone give me the link for it and if not just tell me how to make one and I will script it myself
  20. Use this Code replaceTXD = function() txd2 = engineLoadTXD("files/replacement.txd") engineImportTXD(txd2, Object ID) engineImportTXD(txd2, Object ID) engineImportTXD(txd2, Object ID) engineImportTXD(txd2, Object ID) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), replaceTXD)
  21. With other Resources like a normal script.
  22. Use dxDrawText and Choose the option always on top.
×
×
  • Create New...