Jump to content

DNL291

Retired Staff
  • Posts

    3,875
  • Joined

  • Days Won

    67

Everything posted by DNL291

  1. local time = 240000 function onlinePlayers() outputChatBox("There are now " .. getPlayerCount() .. " players on this server!", root, 220, 220, 220) end setTimer(onlinePlayers, time, 0)
  2. Oh, and it work only for strings? I really didn't know that... Sorry for Offtopic.
  3. Instale: Visual C++ 2012 runtimes. Se o erro continuar, instale também a última versão do DirectX runtimes. Se o problema não for corrigido, leia este tópico e siga todos os passos: https://forum.multitheftauto.com/viewtopic.php?f=104&t=31668
  4. No description: https://community.multitheftauto.com/ind ... ls&id=8559 DONE
  5. Do you want to change that code to the clientside? If so: height = 2000 --put Your Height Here function setMyMaxHeight() setAircraftMaxHeight(height) end addEventHandler("onClientResourceStart", resourceRoot, setMyMaxHeight)
  6. How exactly is it wrong? because he forgot about the parentheses before " and after "? if so, then you are wrong, because that'll work anyway. My bad, I never used the get function, thought it was needed parentheses.
  7. local lowerBound,upperBound = unpack(get"color_range") (get"color_range") It's wrong.
  8. addEventHandler("onClientResourceStart", resourceRoot, function() setTimer(function() sound = playSound("winsound.mp3") bindKey("space", "down", stopMusic) end, 2000, 1) end ) function stopMusic(key, keyState) if(keyState == "down") then stopSound(sound) end end
  9. DNL291

    Script no Work

    And if you want to attach the onPlayerWasted event to function "playerJustGotDied", just replace "play" with "playerJustGotDied".
  10. viewtopic.php?f=91&t=38392&p=394705#p394705
  11. É o valor da propriedade que irá aumentar a velocidade do veículo. Acredito que seja a string "maxVelocity" o valor deve ser foat, ou seja, pode ser número quebrado. Valor mínimo: 0.1, valor máximo: 200000.
  12. function TaksiFunc() local TaksiTeam = createTeam("Taksici", 255, 255, 0 ) setPlayerTeam(source, TaksiTeam) setElementDimension( source, 120) setElementModel(source, 7) taxi = createVehicle(420, 776.20001220703, -1339.5999755859, 13.39999961853 ) warpPedIntoVehicle(source, taxi) marker1 = createMarker(780.79998779297, -1319.5999755859, 13.39999961853, "checkpoint", 2, 255, 0, 0, 255) addEventHandler("onMarkerHit", marker1, firstmarker) end addEvent("TaksiSkin", true) addEventHandler("TaksiSkin", root, TaksiFunc) function firstmarker() destroyElement(marker1) marker2 = createMarker(835.09997558594, -1322.1999511719, 13.39999961853, "checkpoint", 2, 255, 0, 0, 255) addEventHandler("onMarkerHit", marker2, secondmarker) end function secondmarker() destroyElement(marker2) marker3 = createMarker(942.09997558594, -1287.5, 14.5, "checkpoint", 2, 255, 0, 0, 255) addEventHandler("onMarkerHit", marker3, thirdmarker) end function thirdmarker() destroyElement(marker3) marker4 = createMarker(830, -1145.5, 23.700000762939, "checkpoint", 2, 255, 0, 0, 255) addEventHandler("onMarkerHit", marker4, fourthmarker) end function fourthmarker() destroyElement(marker4) marker5 = createMarker(692.20001220703, -1223.9000244141, 16.5, "checkpoint", 2, 255, 0, 0, 255) addEventHandler("onMarkerHit", marker5, fifthmarker) end function fifthmarker() destroyElement(marker5) finish = createMarker(665, -1308.4000244141, 13.5, "checkpoint", 15, 0, 255, 5, 255) addEventHandler("onMarkerHit", finish, finishmarker) end function finishmarker(thePlayer) destroyElement(finish) setElementDimension(source, 0 ) outputChatBox("Taksi Job'u bitirdin! Magasin : #FFFF00 25000 TL ", thePlayer, 255, 69, 0, true) setElementPosition(thePlayer, 769.40002441406, -1387.6999511719, 13.60000038147) setPlayerTeam(thePlayer, nil) givePlayerMoney(thePlayer, 25000) end
  13. Try: -----CREATE THE VEHICLES----- vehcreates = { [1] = createVehicle(589, 561.3701171875, -1289.9091796875, 17.248237609863), [2] = createVehicle(518, 556.1318359375, -1290.0322265625, 17.248237609863 ), [3] = createVehicle(402, 550.7373046875, -1289.525390625, 17.248237609863 ), [4] = createVehicle(603, 545.7001953125, -1289.4248046875, 17.248237609863), [5] = createVehicle(480, 540.79296875, -1289.3271484375, 17.2421875 ), [6] = createVehicle(415, 535.57421875, -1289.22265625, 17.2421875), [7] = createVehicle(562, 530.060546875, -1289.1123046875, 17.2421875), [8] = createVehicle(541, 542.0224609375, -1276.32421875, 17.2421875), [9] = createVehicle(451, 548.0458984375, -1276.681640625, 17.248237609863 ), [10] = createVehicle(506, 554.1796875, -1274.70703125, 17.248237609863), [11] = createVehicle(558,558.728515625, -1273.3828125, 17.2421875), [12] = createVehicle(559, 514.390625, -1300.3056640625, 17.242187), [13] = createVehicle(565, 511.8505859375, -1306.9794921875, 17.2421875), [14] = createVehicle(402, 512.4658203125, -1313.7265625, 17.2421875 ), [15] = createVehicle(542, 544.9677734375, -1282.751953125, 17.248237609863 ), [16] = createVehicle(562, 551.22265625, -1282.5458984375, 17.248237609863 ), [17] = createVehicle(603, 557.4365234375, -1282.0048828125, 17.248237609863 ), [18] = createVehicle(429, 563.5048828125, -1281.46875, 17.248237609863 ) } addEventHandler("onClientMarkerHit", vehmarkers[1], function () local vehName = getElementData(vehcreates[1], "vehicle-1") outputChatBox("This vehicle is a " ..getVehicleName(vehName).. "!") end ) for i, v in ipairs(vehcreates) do setElementData(v, "vehicle-"..tostring(i), v) end -----CREATING THE MARKERS------ vehmarkers = { [1] = createMarker (559.7255859375, -1289.8505859375, 16.248237609863, "cylinder", 0.96), [2] = createMarker(554.44921875, -1289.7578125, 16.248237609863, "cylinder", 0.96), [3] = createMarker(548.9931640625, -1289.76171875, 16.248237609863 , "cylinder", 0.96), [4] = createMarker(543.8017578125, -1289.751953125, 16.2421875, "cylinder", 0.96), [5] = createMarker(539.234375, -1289.666015625, 16.2421875, "cylinder", 0.96), [6] = createMarker(534.0244140625, -1289.1962890625, 16.2421875 , "cylinder", 0.96), [7] = createMarker(528.0390625, -1289.3095703125, 16.2421875 , "cylinder", 0.96), [8] = createMarker(542.8017578125, -1283.4443359375, 16.2421875 , "cylinder", 0.96), [9] = createMarker(549.5830078125, -1282.9765625, 16.248237609863 , "cylinder", 0.96), [10] = createMarker(555.8544921875, -1282.7373046875, 16.248237609863, "cylinder", 0.96), [11] = createMarker(561.4638671875, -1281.9423828125, 16.248237609863 , "cylinder", 0.96), [12] = createMarker(556.8466796875, -1273.330078125, 16.2421875 , "cylinder", 0.96), [13] = createMarker(552.474609375, -1274.5380859375, 16.248237609863 , "cylinder", 0.96), [14] = createMarker(546.3779296875, -1276.5166015625, 16.248237609863, "cylinder", 0.96), [15] = createMarker(540.3125, -1276.3251953125, 16.2421875, "cylinder", 0.96) } -----SETTING PARENT TO THE MARKERS----- ele = createElement ( "markers" ) for i, v in ipairs ( vehmarkers ) do setElementParent ( v, ele ) setElementAlpha(v, 50) end Or you can just do this: addEventHandler("onClientMarkerHit", vehmarkers[1], function () outputChatBox("This vehicle is a " ..getVehicleName(vehcreates[1]).. "!") end)
  14. O código tinha alguns erros, tente: teamVehicleList = { ['team2'] = { }, ['LEI'] = { 598, 596, 597, 599, 497, 490, 528, 599, 523, 425 }, ['Crips'] = { 520 }, ['Bloods'] = { 450 } } addEventHandler( 'onVehicleStartEnter', root, function( player ) local vModel = getElementModel (source) local pTeam = getTeamName (getPlayerTeam (player)) for kTeam, list in pairs( teamVehicleList ) do if pTeam ~= kTeam then for _,id in pairs ( list ) do if vModel == id then cancelEvent () outputChatBox( '#F08080[ERRO] #FF0000Este veículo pertence a Organização ' .. kTeam .. ' !', player, 255, 255, 255, true ) break end end end end end )
  15. Yes, i didn't said it would cause stack overflow, because it's not a clientside function. That isn't what is causing the error, anyway. But as you said - "it should be prevented".
  16. get already is a MTA function. https://wiki.multitheftauto.com/wiki/Get
  17. outputChatBox doesn't have visibleTo argument on the clientside.
  18. Add the vehicle name and the ID of that vehicle in vehicles table (line 3). local spawnMarker = createMarker(1541, -1627.4000244141, 12.60000038147, "cylinder", 2, 225, 163, 25, 225) local vehicles = { ["sabre"] = 475, ["Nrg-500"] = 522, ["carName"] = ID } function carGui () mainWindow = guiCreateWindow(266, 103, 277, 374, "Spawn Window for u", false) guiSetVisible(mainWindow, false) carsG = guiCreateGridList(9, 28, 258, 284, false, mainWindow) guiGridListAddColumn(carsG, "cars", 0.9) for k,_ in pairs(vehicles) do guiGridListAddRow(carsG) guiGridListSetItemText(carsG, guiGridListGetRowCount(carsG)-1, 1, k, false, false) end spawnButton = guiCreateButton(9, 320, 128, 44, "spawn", false, mainWindow) guiSetFont(spawnButton, "sa-header") cancelButton = guiCreateButton(144, 322, 123, 42, "cancel", false, mainWindow) guiSetFont(cancelButton, "sa-header") end addEventHandler("onClientResourceStart", resourceRoot, carGui) addEventHandler("onClientGUIClick", root, function () if (source == spawnButton) then if not (getTeamName(getPlayerTeam(localPlayer)) == "teamName") then return end local row,col = guiGridListGetSelectedItem(carsG) if (row and col and row ~= -1 and col ~= -1) then local vehicleName = guiGridListGetItemText(carsG, row, 1) if triggerServerEvent("onSpawnVehicle", localPlayer, vehicles[vehicleName]) then showWindow(false) end else outputChatBox("Select a vehicle from the list.") end elseif (source == cancelButton) then showWindow(false) end end) addEventHandler("onClientMarkerHit", spawnMarker, function (hitPlayer) if (hitPlayer == localPlayer) then showWindow(true) end end) function showWindow(bool) guiSetVisible(mainWindow, bool) showCursor(bool) end
  19. local spawnMarker = createMarker(1541, -1627.4000244141, 12.60000038147, "cylinder", 2, 225, 163, 25, 225) function carGui () mainWindow = guiCreateWindow(266, 103, 277, 374, "Spawn Window for u", false) guiSetVisible(mainWindow, false) carsG = guiCreateGridList(9, 28, 258, 284, false, mainWindow) guiGridListAddColumn(carsG, "cars", 0.9) for i = 1, 2 do guiGridListAddRow(carsG) end guiGridListSetItemText(carsG, 0, 1, "sabre", false, false) guiGridListSetItemText(carsG, 1, 1, "Nrg-500", false, false) spawnButton = guiCreateButton(9, 320, 128, 44, "spawn", false, mainWindow) guiSetFont(spawnButton, "sa-header") cancelButton = guiCreateButton(144, 322, 123, 42, "cancel", false, mainWindow) guiSetFont(cancelButton, "sa-header") end addEventHandler("onClientResourceStart", resourceRoot, carGui) addEventHandler("onClientGUIClick", root, function () if (source == spawnButton) then if not (getTeamName(getPlayerTeam(localPlayer)) == "teamName") then return end local row,col = guiGridListGetSelectedItem(carsG) if (row and col and row ~= -1 and col ~= -1) then local vehicleName = guiGridListGetItemText(carsG, row, 1) if vehicleName == "sabre" then triggerServerEvent("onSpawnVehicle", localPlayer, 475) showWindow(false) elseif vehicleName == "Nrg-500" then triggerServerEvent("onSpawnVehicle", localPlayer, 522) showWindow(false) end else outputChatBox("Select a vehicle from the list.") end elseif (source == cancelButton) then showWindow(false) end end) addEventHandler("onClientMarkerHit", spawnMarker, function (hitPlayer, dim) if (hitPlayer == localPlayer) and dim then showWindow(true) end end) function showWindow(bool) guiSetVisible(mainWindow, bool) showCursor(bool) end I tested and it works fine for me.
  20. local spawnMarker = createMarker(1541, -1627.4000244141, 12.60000038147, "cylinder", 2, 225, 163, 25, 225) function carGui () mainWindow = guiCreateWindow(266, 103, 277, 374, "Spawn Window for u", false) guiSetVisible(mainWindow, false) carsG = guiCreateGridList(9, 28, 258, 284, false, mainWindow) guiGridListAddColumn(carsG, "cars", 0.9) for i = 1, 2 do guiGridListAddRow(carsG) end guiGridListSetItemText(carsG, 0, 1, "sabre", false, false) guiGridListSetItemText(carsG, 1, 1, "Nrg-500", false, false) spawnButton = guiCreateButton(9, 320, 128, 44, "spawn", false, mainWindow) guiSetFont(spawnButton, "sa-header") cancelButton = guiCreateButton(144, 322, 123, 42, "cancel", false, mainWindow) guiSetFont(cancelButton, "sa-header") end addEventHandler("onClientResourceStart", resourceRoot, carGui) addEventHandler("onClientGUIClick", root, function () if (source == spawnButton) then if (not getTeamName(getPlayerTeam(localPlayer)) == "teamName") then return end local row,col = guiGridListGetSelectedItem(carsG) if (row and col and row ~= -1 and col ~= -1) then local vehicleName = guiGridListGetItemText(carsG, row, 1) if vehicleName == "sabre" then triggerServerEvent("onSpawnVehicle", localPlayer, 475) showWindow(false) elseif vehicleName == "Nrg-500" then triggerServerEvent("onSpawnVehicle", localPlayer, 522) showWindow(false) end else outputChatBox("Select a vehicle from the list.") end elseif (source == cancelButton) then showWindow(false) end end) addEventHandler("onClientMarkerHit", spawnMarker, function (hitPlayer) if (hitPlayer == localPlayer) then showWindow(true) end end) function showWindow(bool) guiSetVisible(mainWindow, bool) showCursor(bool) end
  21. He can pass any other element, such as the player element. DX functions doesn't need return an element to make that possible. I didn't told him to store it with setElementData instead of a variable. Using variables is obviously better and simpler.
  22. Você pode ir até o link fornecido por mim, para pedir ajuda com relação ao seu problema. Eu realmente não sei o que está causando esse problema. (Já recebi essa mensagem de erro, mas logo parei de receber sem precisar corrigir nada.)
  23. Yes, you can store the positions with setElementData and then get it using getElementData.
×
×
  • Create New...