Jump to content

Castillo

Retired Staff
  • Posts

    21,935
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by Castillo

  1. El cliente no esta cargado aun, es por eso.
  2. I don't really understand what do you mean.
  3. Found my problem, copy it again.
  4. Try this event: https://wiki.multitheftauto.com/wiki/OnTrailerAttach
  5. Forum bug, copy the client side code again.
  6. You mean this? tempVehicle = createVehicle ( args... ) tempMarker = createMarker ( args... ) addEventHandler ( "onMarkerHit", tempMarker, function ( hitElement ) if ( hitElement == tempVehicle ) then destroyElement ( hitElement ) end end )
  7. 1: Search on "noisebar.lua" for this: setElementData ( getLocalPlayer (), "legdamage", 1 ) That should be the limp thing. 2: Search on "gadgets_client.lua" for: bindKey ("r", "down", "Use Gadget/Spectate Next", "" ) bindKey ("r", "up", "Use Gadget/Spectate Next", "0" ) Then change "r" to "g".
  8. Castillo

    Login music

    That's because you made your sound variable local: local sound = playSound("music.mp3", false) Should be: function loginMusic () sound = playSound("music.mp3", false) setSoundVolume(sound, 3.2) end addEventHandler ( "onClientResourceStart", resourceRoot, loginMusic) function stopMySound ( ) if isElement ( sound ) then destroyElement ( sound ) end end addEventHandler ( "onClientPlayerSpawn", localPlayer, stopMySound )
  9. Castillo

    Login music

    You got me wrong, I didn't told you to remove destroyElement. function stopMySound ( ) if isElement ( sound ) then destroyElement ( sound ) end end addEventHandler ( "onClientPlayerSpawn", localPlayer, stopMySound )
  10. Castillo

    Login music

    addEventHandler ( "onClientPlayerSpawn", localPlayer() stopMySound ) That's wrong, should be: addEventHandler ( "onClientPlayerSpawn", localPlayer, stopMySound ) Also, check if the sound exist, because the player won't spawn just once, so, use: isElement to check if the sound element exists before attemp to destroy it.
  11. Castillo

    Login music

    Use: "onClientPlayerSpawn" and attach it to the local player instead of to the root element. Also, you forgot to define "sound": sound = playSound ( "music.mp3" ) And use destroyElement instead of stopSound.
  12. Check debugscript, look for any error.
  13. triggerClientEvent("login", root, player) That's wrong, should be: triggerClientEvent ( player, "login", player ) The same on "rejestration" event.
  14. -- client side: local screenWidth, screenHeight = guiGetScreenSize() local marker 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. 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, mkr) marker = mkr createVehicleChooserGUI() 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", localPlayer, vid, marker) end -- server side: 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(table.x, table.y, table.z, "cylinder", 2, table.r, table.g, table.b) setElementData(marker, "vehiclemarker-data", { table.Roles, table.vehicles, { table.x, table.y, table.z, table.rotation }, { table.vehR, table.vehG, table.vehB } }, false) addEventHandler("onMarkerHit", marker, onPlayerVehicleMarkerHit) end end addEventHandler("onResourceStart", resourceRoot, createTheJobVehicles) function onPlayerVehicleMarkerHit(player) local data = getElementData(source, "vehiclemarker-data") if (getElementType(player) == "player") then if (getElementData(player, dataToFindPlayersJob) == data [ 1 ] or data [ 1 ] == "ALL") then if (isPedInVehicle(player)) then return end triggerClientEvent(player, "jobvehicles.showVehicleGUI", root, data [ 2 ], source ) end end end function onPlayerSpawnVehicle(vid, marker) if (isElement(vehicle[client])) then destroyElement(vehicle[client]) end local data = getElementData ( marker, "vehiclemarker-data" ) local x, y, z, rot = unpack ( data [ 3 ] ) local r, g, b = unpack ( data [ 4 ] ) vehicle[client] = createVehicle(vid, x, y, z, 0, 0, rot) setElementData(vehicle[client], "jobvehicle", true) warpPedIntoVehicle(client, vehicle[client]) outputDebugString(getPlayerName(client).. " has spawned a '"..getVehicleNameFromModel(vid)) outputServerLog(getPlayerName(client).. " has spawned a '"..getVehicleNameFromModel(vid).."'") if (r and g and b) 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) As you can see, I have changed how it works, I haven't tested it.
  15. Castillo

    Tops text

    What did you change exactly?
  16. soundeffect = { } addEventHandler ( "onResourceStart", resourceRoot, function ( ) local soundXML = xmlLoadFile( "commands.xml" ) if ( soundXML ) then for _, node in pairs ( xmlNodeGetChildren ( soundXML ) ) do if ( xmlNodeGetName ( node ) == "command" ) then soundeffect [ xmlNodeGetAttribute ( node, "name" ) ] = xmlNodeGetAttribute ( node, "sound" ) outputChatBox ( xmlNodeGetAttribute ( node, "name" ) ..": ".. xmlNodeGetAttribute ( node, "sound" ) ) end end end end )
  17. No, as far as I know, there's no way to do this.
  18. As far as I know, the script creates it all by itself.
×
×
  • Create New...