Jump to content

Castillo

Retired Staff
  • Posts

    21,935
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by Castillo

  1. What do you mean...? you can't "output" a command.
  2. Is because you are using "playSound" instead of "playSound3D". -- client side: addEvent ( "playMyMusic", true ) addEventHandler ( "playMyMusic", getRootElement(), function ( x, y, z ) local sound = playSound3D ( "gritos/vasco.mp3", x, y, z, false ) setSoundVolume ( sound, 1.0 ) setSoundMaxDistance ( sound, 30 ) end ) -- server side: function PlayMusic ( thePlayer ) triggerClientEvent ( getRootElement(), "playMyMusic", getRootElement(), getElementPosition ( thePlayer ) ) end addCommandHandler ( "gritarvasco", PlayMusic )
  3. You're welcome. Remember, account data has a limit, so, if your JSON is too long, parts of it will be cut off.
  4. That function is used to output a message to the client console ( F8 ).
  5. I'll do the same as I did on your other post, if you think is useful or not, I don't really care. onClientMouseEnter playSound Each link has examples, use them.
  6. You can't store lua tables as account data, convert the table to a JSON string with toJSON.
  7. I don't understand what do you mean, you can already replace models/textures.
  8. A que te referis con "activar y desactivar"?
  9. 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(PCSTable) do local row = guiGridListAddRow(PCSTable) -- set the text in the first column to the vehicle name guiGridListSetItemText(PCSgridlist,row,1,name,false,false) -- set the text in the second column to the vehicle type guiGridListSetItemText(PCSgridlist,row,2,getVehicleType(vehicle),false,false) -- set the data for gridlist slot as the vehicle id guiGridListSetItemData(PCSgridlist,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)
  10. The script will only give him what he specified, maybe he has another script giving the extra experience.
  11. Castillo

    Black screen.

    I've deleted the file, I'll see if it still happens, since it didn't happen everytime I started MTA.
  12. I don't understand the problem, what are you trying to achieve?
  13. Just do: setTimer ( saveAllVehiclesAlternative, 60000, 0 )
  14. Exactly what I said, you just wanted it done.
  15. Castillo

    Black screen.

    Hey, recently I've been having this weird problem when I open MTA, the problem is that the screen is just black and my monitor's LED ( the light which says if it's turned on or not ) starts blinking, I fix the problem by restarting my computer, but there has to be something causing this. Any help is appreciated.
  16. Yeah, I put an "l" by mistake, just copy it again .
  17. Castillo

    Pickups

    I don't think there's such script, but is not hard to do it.
  18. local M4Pickup = { {4556,-5444.4333,4555}, {76789,-98766.766,8777}, } function SpawnPicks ( ) if ( not pickup ) then local x, y, z = unpack ( M4Pickup [ math.random ( #M4Pickup ) ] ) pickup = createPickup ( x, y, z, 2, 31 ) addEventHandler ( "onPickupHit", pickup, onPickupHit ) end end addEventHandler ( "onResourceStart", resourceRoot, SpawnPicks ) setTimer ( SpawnPicks, 480000, 0 ) function onPickupHit ( ) if isElement ( pickup ) then destroyElement ( pickup ) end pickup = nil end
  19. The links I gave you got examples, you obviously didn't even open them, what you want is to get it done.
  20. It does help, but you must be willing to read and learn.
×
×
  • Create New...