Jump to content

Search the Community

Showing results for tags 'lua'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Multi Theft Auto: San Andreas 1.x
    • Support for MTA:SA 1.x
    • User Guides
    • Open Source Contributors
    • Suggestions
    • Ban appeals
  • General MTA
    • News
    • Media
    • Site/Forum/Discord/Mantis/Wiki related
    • MTA Chat
    • Other languages
  • MTA Community
    • Scripting
    • Maps
    • Resources
    • Other Creations & GTA modding
    • Competitive gameplay
    • Servers
  • Other
    • General
    • Multi Theft Auto 0.5r2
    • Third party GTA mods
  • Archive
    • Archived Items
    • Trash

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


About Me


Member Title


Gang


Location


Occupation


Interests

  1. I made a hud but it has a bug. For those who register and login, setElementData is not set. How to fix it ? If the resource is restarted, the element data will be set and saved in the account data Server Side addEventHandler("onPlayerQuit", root, function(type) if type == "Quit" then local health = getElementHealth(source) local armor = getPedArmor(source) local water = getElementData(source, "water") local food = getElementData(source, "food") local account = getPlayerAccount(source) setAccountData(account, "health", health) setAccountData(account, "armor", armor) setAccountData(account, "water", water) setAccountData(account, "food", food) end end) addEventHandler("onPlayerLogin", root, function(pa, ca) local account = getPlayerAccount(source) if not isGuestAccount(account) then local health = getAccountData(account, "health") local armor = getAccountData(account, "armor") local water = getAccountData(account, "water") local food = getAccountData(account, "food") setElementHealth(source, health) setPlayerArmor(source, armor) setElementData(source, "water", water) setElementData(source, "food", food) end end) function drinkWater(player, price, size) if getPlayerMoney(player) < System.prices.food_price then outputChatBox("water cannot be given because you have no money", player, 255, 0, 0) else if getElementData(player, "water") >= 95 then outputChatBox("You can't get more food because your stomach is full!", player, 255, 0, 0) else setElementData(player, "water", getElementData(player, "water") + 20) takePlayerMoney(player, System.prices.water_price) triggerClientEvent(player, "drinking", player) end end end function eatFood(player, price, size) if getPlayerMoney(player) < System.prices.water_price then outputChatBox("Food cannot be given because you have no money", player, 255, 0, 0) else if getElementData(player, "food") >= 95 then outputChatBox("You can't get more food because your stomach is full!", player, 255, 0, 0) else setElementData(player, "food", getElementData(player, "food") + 20) takePlayerMoney(player, System.prices.food_price) triggerClientEvent(player, "eating", player) end end end addEventHandler("onPlayerWasted", root, function() setElementData(source, "water", 50) setElementData(source, "food", 50) end) addEvent("fireStop", true) addEventHandler("fireStop", root, function(player) toggleControl(player, "fire", false) end) addEvent("fireStart", true) addEventHandler("fireStart", root, function(player) toggleControl(player, "fire", true) end) addEvent("runStop", true) addEventHandler("runStop", root, function(player) toggleControl(player, "sprint", false) end) addEvent("runStart", true) addEventHandler("runStart", root, function(player) toggleControl(player, "sprint", true) end) Client Side local screenW, screenH = guiGetScreenSize() setElementData(localPlayer, "water", 100) setElementData(localPlayer, "food", 100) showPlayerHudComponent("health", false) showPlayerHudComponent("armour", false) showPlayerHudComponent("money", false) showPlayerHudComponent("ammo", false) showPlayerHudComponent("weapon", false) showPlayerHudComponent("clock", false) function render() health = getElementHealth(localPlayer) armor = getPedArmor(localPlayer) water = getElementData(localPlayer, "water") food = getElementData(localPlayer, "food") money = getPlayerMoney(localPlayer) time = getRealTime() hour = time.hour minute = time.minute second = time.second weaponID = getPlayerWeapon(localPlayer) weaponName = getWeaponNameFromID(weaponID) ammo = getPedAmmoInClip(localPlayer) allammo = getPedTotalAmmo(localPlayer) -- health dxDrawCircle((screenW - 225), (screenH / 5000 + 30), 25, -270,(health * 3.6 - 270), tocolor(0, 255, 0), 30) -- health line dxDrawCircle((screenW - 225), (screenH / 5000 + 30), 18, 0, 360, tocolor(26, 26, 26)) -- black circle dxDrawImage((screenW - 225) - (27 / 2), (screenH / 300 + 15), 27, 27, "assets/icons/heart.png") -- health icon -- armor dxDrawCircle((screenW - 160), (screenH / 5000 + 30), 25, -270,(armor * 3.6 - 270), tocolor(194, 194, 194), 30) -- armor line dxDrawCircle((screenW - 160), (screenH / 5000 + 30), 18, 0, 360, tocolor(26, 26, 26)) -- black circle dxDrawImage((screenW - 160) - (27 / 2), (screenH / 300 + 16), 27, 27, "assets/icons/armor.png") -- armor icon -- water dxDrawCircle((screenW - 95), (screenH / 5000 + 30), 25, -270,(water * 3.6 - 270), tocolor(10, 252, 236), 30) -- water line dxDrawCircle((screenW - 95), (screenH / 5000 + 30), 18, 0, 360, tocolor(26, 26, 26)) -- black circle dxDrawImage((screenW - 95) - (20 / 2), (screenH / 300 + 12), 20, 30, "assets/icons/water.png") -- water icon -- food dxDrawCircle((screenW - 30), (screenH / 5000 + 30), 25, -270,(food * 3.6 - 270), tocolor(209, 102, 8), 30) -- food line dxDrawCircle((screenW - 30), (screenH / 5000 + 30), 18, 0, 360, tocolor(26, 26, 26)) -- black circle dxDrawImage((screenW - 28) - (27 / 2), (screenH / 300 + 13), 27, 27, "assets/icons/food.png") -- food icon --background dxDrawRectangle((screenW - 235), (screenH / 5000 + 62), 260, 50, tocolor(23, 23, 23, 230)) dxDrawCircle((screenW - 235), (screenH / 5000 + 87), 25, -90, -270, tocolor(23, 23, 23, 230)) -- money dxDrawText("MONEY: $"..money, (screenW - 203), (screenH / 5000 + 70), 20, 20 , tocolor(0, 186, 43), 0.5, "bankgothic") -- real time dxDrawText(string.format("TIME: %02d:%02d:%02d", hour,minute,second), (screenW - 200), (screenH / 5000 + 90), 20, 20 , tocolor(166, 166, 166), 0.5, "bankgothic") -- weapons if weaponID ~= 0 then dxDrawRectangle((screenW - 235), (screenH / 5000 + 120), 260, 25, tocolor(23, 23, 23, 230)) dxDrawCircle((screenW - 235), (screenH / 5000 + 132.5), 12, -90, -270, tocolor(23, 23, 23, 230)) dxDrawText(weaponName.." | "..ammo.." | "..allammo, (screenW - 203), (screenH / 5000 + 125), 20, 20 , tocolor(237, 186, 0), 0.5, "bankgothic") end if (food <= 2) then triggerServerEvent("fireStop", resourceRoot, localPlayer) else triggerServerEvent("fireStart", resourceRoot, localPlayer) end if (water <= 2) then triggerServerEvent("runStop", resourceRoot, localPlayer) else triggerServerEvent("runStart", resourceRoot, localPlayer) end end addEventHandler("onClientRender", root, render) setTimer(function(player) if (getElementData(localPlayer, "water") <= 2) then return else setElementData(localPlayer, "water", getElementData(localPlayer, "water") - 1) end end, System.decrease.water, 0) setTimer(function(player) if (getElementData(localPlayer, "food") <= 2) then return else setElementData(localPlayer, "food", getElementData(localPlayer, "food") - 1) end end, System.decrease.food, 0)
  2. what is problem this code ? gate = createObject(980, 364.82147, 186.89452, 1019.98438) setElementInterior(gate, 3) bombMarker = createMarker(364.70267, 186.29311, 1019.98438 -0.5, "cylinder", 1, 255, 0, 0) setElementInterior(bombMarker, 3) addEventHandler("onMarkerHit", bombMarker, function(player) outputChatBox("ugh!") end)
  3. Why is outPutChatBox saying false instead of 1 ? What I need is to get the outPutChatBox as 1 marker = createMarker(2093.75464, -1948.29468, 13.54688, "cylinder", 1) addEventHandler("onClientMarkerHit", marker, function(player) setElementData(player, "item", 1) outputChatBox("hitted") end) addEventHandler("onClientRender", root, function(player) count = tostring(getElementData(player, "item")) outputChatBox(count) end)
  4. Why doesn't the vehicle destroy when the player disconnects ? marker = createMarker(2169.62500, -1983.23706, 13.55469, "cylinder", 1) vehicles = {} addEventHandler("onMarkerHit", marker, function(player) vehicles[player] = createVehicle(408, 2169.62500 + 3, -1983.23706, 13.55469) end) addEventHandler("onPlayerQuit", root, function(type) if (type == "Quit") then destroyElement(vehicles[player]) end end)
  5. This is a dirt job script I'm currently working on... There's a bug here, why isn't the marker destroyed when the player exits the vehicle? client side -- client side local screenW, screenH = guiGetScreenSize() local w, h = 400, 330 local jobMarker = createMarker(-1895.57104, -1660.41797, 22.11562, "cylinder", 1.0, 0, 255, 0) local window setMoonSize(1000) function getJob(player, matchingDeminsion) if player == localPlayer and matchingDeminsion then if not isPedInVehicle(player) then if isPedOnGround(player) then if not (window) then window = guiCreateWindow((screenW / 2) - (w / 2), (screenH / 2) - (h / 2), w, h, "garbage job", false) memo = guiCreateMemo(0, 30, w, 200, "this is garbage job!", false, window) guiMemoIsReadOnly(memo) accept = guiCreateButton(0, 290, 100, 40, "Accept", false, window) leave = guiCreateButton(130, 290, 100, 40, "Leave Job", false, window) close = guiCreateButton(250, 290, 100, 40, "Close", false, window) showCursor(true) else guiSetVisible(window, false) window = nil showCursor(false) end end end end end addEventHandler("onClientMarkerHit", jobMarker, getJob) function clicks() if (source == accept) then guiSetVisible(window, false) window = nil showCursor(false) triggerServerEvent("acceptJob", resourceRoot, localPlayer) elseif (source == leave) then guiSetVisible(window, false) window = nil showCursor(false) triggerServerEvent("leaveJob", resourceRoot, localPlayer) elseif (source == close) then guiSetVisible(window, false) window = nil showCursor(false) end end addEventHandler("onClientGUIClick", root, clicks) Server side -- server side addEventHandler("onResourceStart", root, function() team = createTeam("garbage", 0, 255, 0) end) addEvent("acceptJob", true) addEvent("leaveJob", true) function checkAccept(player) -- [accept job function] if (getElementData(player, "Jobs") == "garbage") then outputChatBox("you have alrady garbage job sorry!", player, 255, 0, 0) else setElementData(player, "Jobs", "garbage") setElementData(player, "trashlocation", 0) outputChatBox("job accept successfully!", player, 0, 255, 0) startJob(player) if (team) then setPlayerTeam(player, team) end end end addEventHandler("acceptJob", root, checkAccept) vehicles = { [408] = true } garbages = { [1] = {-1881.14380, -1707.47888, 21.75000}, [2] = {-1885.83081, -1723.84656, 21.75641}, [3] = {-1896.03723, -1731.46301, 21.75000}, [4] = {-1908.80933, -1733.61536, 21.75000}, [5] = {-1930.82690, -1767.77832, 26.18353}, [6] = {-1938.78809, -1781.46545, 29.32999}, [7] = {-1936.23059, -1760.15820, 24.36698}, [8] = {-1935.32361, -1742.58679, 22.91065}, [9] = {-1935.62610, -1719.10291, 21.75000}, [10] = {-1921.58350, -1706.34143, 21.90317}, [11] = {-1902.96033, -1704.98352, 21.75000} } function pickUpLocation(player, id) local x, y, z = garbages[id][1],garbages[id][2],garbages[id][3] local marker = createMarker(x, y, z, "cylinder", 3.0) -- <<<<<< Marker is here addEventHandler("onMarkerHit", marker, function(player) if getElementModel(getPedOccupiedVehicle(player)) == 408 then destroyElement(marker) marker = nil outputChatBox("hitted") setElementData(player, "trashlocation", getElementData(player, "trashlocation")+1) newLocation = getElementData(player, "trashlocation") pickUpLocation(player, newLocation) end end) end addEventHandler("onPlayerVehicleEnter", root, function(vehicle, seat, jacked) --[on player vehicle enter] if (vehicles[getElementModel(vehicle)]) and (getElementData(source, "Jobs") ~= "garbage") then removePedFromVehicle(source) x, y, z = getElementPosition(source) setElementPosition(source, x+1, y, z) outputChatBox("You don't have a garbage job", player, 255, 0, 0) end end) addEventHandler("onPlayerVehicleExit", root, function(vehicle, seat, jeacked) --[on player vehicle exit] if (getElementData(source, "Jobs") == "garbage") then if (getElementModel(vehicle) == 408) then outputChatBox("exited") setElementData(source, "Jobs", nil) destroyElement(marker) -- <<<<<<< problem is ehere end end end) trashVehicles = {} trashVehiclesBlips = {} function startJob(player) trashVehicle = createVehicle(408, -1879.74951, -1672.44751, 21.75000, 0, 0, 180) trashVehicleBlip = createBlipAttachedTo(trashVehicle, 51) trashVehicles[player] = trashVehicle trashVehiclesBlips[player] = trashVehicleBlip function checkVehicle(player) local vehicle = getPedOccupiedVehicle(source) local vehicleId = getElementModel(vehicle) outputChatBox(vehicleId) if (vehicleId == 408) then pickUpLocation(player, 1) setElementData(player, "trashlocation", 1) end end addEventHandler("onPlayerVehicleEnter", root, checkVehicle) end function leave(player)-- [leave job function] setElementData(player, "Jobs", nil) setPlayerTeam(player, nil) outputChatBox("leave successfully garbage job!", player, 255, 255, 0) end addEventHandler("leaveJob", root, leave)
  6. I made a trashman job. But there is a small problem, how can only those who have the trashman job try to enter the trash vehicle? -- client side local screenW, screenH = guiGetScreenSize() local w, h = 400, 330 local jobMarker = createMarker(-1895.57104, -1660.41797, 22.11562, "cylinder", 1.0, 0, 255, 0) local window function getJob(player, matchingDeminsion) if player == localPlayer and matchingDeminsion then if not isPedInVehicle(player) then if isPedOnGround(player) then if not (window) then window = guiCreateWindow((screenW / 2) - (w / 2), (screenH / 2) - (h / 2), w, h, "garbage job", false) memo = guiCreateMemo(0, 30, w, 200, "this is garbage job!", false, window) guiMemoIsReadOnly(memo) accept = guiCreateButton(0, 290, 100, 40, "Accept", false, window) leave = guiCreateButton(130, 290, 100, 40, "Leave Job", false, window) close = guiCreateButton(250, 290, 100, 40, "Close", false, window) showCursor(true) else guiSetVisible(window, false) window = nil showCursor(false) end end end end end addEventHandler("onClientMarkerHit", jobMarker, getJob) function clicks() if (source == accept) then guiSetVisible(window, false) window = nil showCursor(false) triggerServerEvent("acceptJob", resourceRoot, localPlayer) elseif (source == leave) then guiSetVisible(window, false) window = nil showCursor(false) triggerServerEvent("leaveJob", resourceRoot, localPlayer) elseif (source == close) then guiSetVisible(window, false) window = nil showCursor(false) end end addEventHandler("onClientGUIClick", root, clicks) --server side addEvent("acceptJob", true) addEvent("leaveJob", true) function checkAccept(player) -- [accept job function] if (getElementData(player, "Jobs") == "garbage") then outputChatBox("you have alrady garbage job sorry!", player, 255, 0, 0) else setElementData(player, "Jobs", "garbage") outputChatBox("job accept successfully!", player, 0, 255, 0) startJob(player) end end function startJob(player) trashVehicle = createVehicle(408, -1879.74951, -1672.44751, 21.75000, 0, 0, 180) end addEventHandler("acceptJob", root, checkAccept) function leave(player)-- [leave job function] setElementData(player, "Jobs", nil) destroyElement(trashVehicle) outputChatBox("leave successfully garbage job!", player, 255, 255, 0) end addEventHandler("leaveJob", root, leave)
  7. When one of these markers is hit, another marker is destroyed. After that, even if other markers are hit, none of the markers will be destroyed. What is the reason for it ? garbages = { {-1881.14380, -1707.47888, 21.75000}, {-1885.83081, -1723.84656, 21.75641}, {-1896.03723, -1731.46301, 21.75000}, {-1908.80933, -1733.61536, 21.75000} } function pickup(player) for i,garbage in pairs(garbages) do marker = createMarker(garbage[1], garbage[2], garbage[3], "cylinder", 3.0) function picked(player) destroyElement(marker) end addEventHandler("onMarkerHit", marker, picked) end end
  8. How to increase the shooting speed of a weapon ?
  9. This is a script I made. This has been working fine so far and then suddenly stopped working. What is the reason for it? addEvent("startMinerJob", true) function startJob(thePlayer) if not (getElementData(thePlayer, "Jobs") == "miner") then setElementData(thePlayer, "Jobs", "miner") setElementData(thePlayer, "copper", getElementData(thePlayer, "copper")) end mineMarker = createMarker(596.22632, 926.04364, -37.97111, "cylinder", 10.0) addEventHandler("onMarkerHit", mineMarker, function() playerWeapon = getPlayerWeapon(thePlayer) if playerWeapon == 23 then outputChatBox("test", thePlayer) setPedFrozen(thePlayer, true) setTimer(function() setPedAnimation(thePlayer, "SWORD", "sword_4", -1, false, false, false, false) end, 1000, 5) setTimer( function() outputChatBox("relesed", thePlayer) setPedFrozen(thePlayer, false) setElementData(thePlayer, "copper", getElementData(thePlayer, "copper")+3) end , 5000, 1) end end) end addEventHandler("startMinerJob", root, startJob) --[[ Leave Miner Job Section ]] addEvent("leaveMinerJob", true) function leaveJob(thePlayer) if (getElementData(thePlayer, "Jobs") == "miner") then setElementData(thePlayer, "Jobs", nil) outputChatBox("you leaved miner job!", thePlayer, 0, 255, 0) end end addEventHandler("leaveMinerJob", root, leaveJob) --[[ Job Testing Section ]] function test(thePlayer) de = getElementData(thePlayer, "copper") outputChatBox("you have "..de.." coppers") end addCommandHandler("gg", test)
  10. scolen

    [HELP]DATABSE

    No purchased vehicles will be left. In the console, here is an error: "CarShop-System/Server.lua:120: dbExec failed; (1) SQL argument error ".. but the localhost is working fine without any errors, when I put it on the server it happens like this. What is the reason for that ? createBlip ( 2131.88086, -1149.92566, 24.21433, 55, 2, 0, 0, 0, 255, 0, 99999.0, getRootElement( ) ) local vehDB = dbConnect( 'sqlite', 'Loja de veiculos - Database.db' ) dbExec( vehDB, ' CREATE TABLE IF NOT EXISTS `VehiclesSystem_Players` (pSerial, vehID, vehName, vehPrice, Subscription) ' ) --dbExec( vehDB, ' DROP TABLE `VehiclesSystem_Players` ' ) vehPers = { }; vehview = { }; function refreshMyList( ) local check = dbQuery( vehDB, ' SELECT * FROM `VehiclesSystem_Players` ' ) local results = dbPoll( check, -1 ) if ( type( results ) == 'table' and #results == 0 or not results ) then triggerClientEvent( root, 'VehiclesSystem;emptyMyList', root ) return end triggerClientEvent( root, 'VehiclesSystem;putMyVehicles', root, results ) end addEvent( 'refreshMyListS', true ) addEventHandler( 'refreshMyListS', root, refreshMyList ) function viewVehiclex( ID, x, y, z, state ) if ( state == 'close' ) then if ( isElement( vehview[source] ) ) then destroyElement( vehview[source] ) end elseif ( state == 'view' ) then if ( isElement( vehview[source] ) ) then if ( getElementModel( vehview[source] ) ) == ID then return end destroyElement( vehview[source] ) end vehview[source] = createVehicle( ID, x, y, z + 0.2, 0, 0, 10 ) setElementDimension( vehview[source], getElementData( root, 'vehiclesSystem;dimension' ) or 1 ) setElementDimension( source, getElementData( root, 'vehiclesSystem;dimension' ) or 1 ) setElementData( root, 'vehiclesSystem;dimension', getElementData( root, 'vehiclesSystem;dimension' ) + 1 or 1 ) end end addEvent( 'VehiclesSystem;createViewVehicle', true ) addEventHandler( 'VehiclesSystem;createViewVehicle', root, viewVehiclex ) addEvent( 'VehiclesSystem;destroyPersonalVehicle', true ) addEventHandler( 'VehiclesSystem;destroyPersonalVehicle', root, function( ) if ( isElement( vehPers[source] ) ) then destroyElement( vehPers[source] ) end end ) addEvent( 'VehiclesSystem;createRentVehicle', true ) addEventHandler( 'VehiclesSystem;createRentVehicle', root, function( ID, vehName ) if ( isElement( vehPers[source] ) ) then destroyElement( vehPers[source] ) end vehPers[source] = createVehicle( ID, 2126.08862, -1136.05115, 25.47241 + 1, -0, 0, 224.5189666748 ) fadeCamera( source, false ) setTimer( fadeCamera, 1500, 1, source, true ) takePlayerMoney( source, 1000 ) setElementDimension( vehPers[source], 0 ) setElementDimension( source, 0 ) setTimer( warpPedIntoVehicle, 1500, 1, source, vehPers[source] ) setTimer( destroyElement, 300000, 1, vehPers[source] ) setTimer( function( ) outputChatBox( '#1E90FF[Car Shop] #FFFFFFWarning: Your rental time is up and your vehicle has been removed #FF0000!', source, 255, 255, 255, true ) end, 300000, 1 ) triggerClientEvent( source, 'VehiclesSystem;gridListAddRent', source, ID, vehName ) end ) addEvent( 'VehiclesSystem;lock/unlockPersonalVehicle', true ) addEventHandler( 'VehiclesSystem;lock/unlockPersonalVehicle', root, function( ) if ( not isElement( vehPers[source] ) ) then outputChatBox( '#1E90FF[Car Shop] #FFFFFFError: you dont have this vehicle #FF0000!', source, 255, 255, 255, true ) return end if ( isVehicleLocked( vehPers[source] ) == true ) then setVehicleLocked( vehPers[source], false ) outputChatBox( '#2BFF00*#1E90FF[Car Shop] #FFFFFFSuccess, Your vehicle has been unlocked #2BFF00!', source, 255, 255, 255, true ) else setVehicleLocked( vehPers[source], true ) outputChatBox( '#2BFF00*#1E90FF[Car Shop] #FFFFFFSuccess, Your vehicle has been locked #2BFF00!', source, 255, 255, 255, true ) end end ) addEvent( 'VehiclesSystem;off/onPersonalVehicle', true ) addEventHandler( 'VehiclesSystem;off/onPersonalVehicle', root, function( ) if ( not isElement( vehPers[source] ) ) then outputChatBox( '#1E90FF[Car Shop] #FFFFFFError: you dont have this vehicle #FF0000!', source, 255, 255, 255, true ) return end if ( getVehicleEngineState( vehPers[source] ) == true ) then setVehicleEngineState( vehPers[source], false ) outputChatBox( '#2BFF00*#1E90FF[Car Shop] #FFFFFFEngine off #2BFF00!', source, 255, 255, 255, true ) else setVehicleEngineState( vehPers[source], true ) outputChatBox( '#2BFF00*#1E90FF[Car Shop] #FFFFFFEngine on #2BFF00!', source, 255, 255, 255, true ) end end ) addEvent( 'VehiclesSystem;off/onLightsPersonalVehicle', true ) addEventHandler( 'VehiclesSystem;off/onLightsPersonalVehicle', root, function( ) if ( not isElement( vehPers[source] ) ) then outputChatBox( '#1E90FF[Car Shop] #FFFFFFError: you dont have this vehicle #FF0000!', source, 255, 255, 255, true ) return end if ( getVehicleLightState( vehPers[source], 0 ) == 0 and getVehicleLightState( vehPers[source], 1 ) == 0 ) then setVehicleLightState( vehPers[source], 0, 1 ) setVehicleLightState( vehPers[source], 1, 1 ) setVehicleLightState( vehPers[source], 2, 1 ) setVehicleLightState( vehPers[source], 3, 1 ) outputChatBox( '#2BFF00*#1E90FF[Car Shop] #FFFFFFlights off #2BFF00!', source, 255, 255, 255, true ) else setVehicleLightState( vehPers[source], 0, 0 ) setVehicleLightState( vehPers[source], 1, 0 ) setVehicleLightState( vehPers[source], 2, 0 ) setVehicleLightState( vehPers[source], 3, 0 ) outputChatBox( '#2BFF00*#1E90FF[Car Shop] #FFFFFFLights on #2BFF00!', source, 255, 255, 255, true ) end end ) addEvent( 'VehiclesSystem;sellMyPersonalVehicle', true ) addEventHandler( 'VehiclesSystem;sellMyPersonalVehicle', root, function( ID, price ) local check = dbQuery( vehDB, ' SELECT * FROM `VehiclesSystem_Players` WHERE pSerial = ? AND vehID = ? ', getPlayerSerial( source ), ID ) local results = dbPoll( check, -1 ) if ( type( results ) == 'table' and #results == 0 or not results ) then outputChatBox( '#1E90FF[Car Shop] #FFFFFFError: This vehicle is not permanent, you cannot sell it #FF0000!', source, 255, 255, 255, true ) return end if ( isElement( vehPers[source] ) ) then destroyElement( vehPers[source] ) end dbExec( vehDB, ' DELETE FROM `VehiclesSystem_Players` WHERE pSerial = ? AND vehID = ? ', getPlayerSerial( source ), ID ) refreshMyList( ) givePlayerMoney( source, price ) outputChatBox( '#2BFF00*#1E90FF[Car Shop] #FFFFFFSold! You have successfully sold your vehicle #2BFF00!', source, 255, 255, 255, true ) end ) addEvent( 'VehiclesSystem;createPersonalVehicle', true ) addEventHandler( 'VehiclesSystem;createPersonalVehicle', root, function( ID ) local x, y, z = getElementPosition( source ) if ( isElement( vehPers[source] ) ) then destroyElement( vehPers[source] ) end vehPers[source] = createVehicle( ID, x + 2, y + 2, z + 1 ) if ( getElementData( source, 'VehiclesSystem;WarpToVehicle' ) == 'Enabled' ) then warpPedIntoVehicle( source, vehPers[source] ) setElementData( vehPers[source], 'myPersVehicle', getPlayerName( source ) ) end end ) addEvent( 'VehiclesSystem;buyCurrentCar', true ) addEventHandler( 'VehiclesSystem;buyCurrentCar', root, function( ID, Name, Price ) local check = dbQuery( vehDB, ' SELECT * FROM `VehiclesSystem_Players` WHERE pSerial = ? AND vehddID = ? ', getPlayerSerial( source ), ID ) local results = dbPoll( check, -1 ) if ( type( results ) == 'table' and #results == 0 or not results ) then dbExec( vehDB, ' INSERT INTO `VehiclesSystem_Players` VALUES(?,?,?,?,?) ', getPlayerSerial( source ), tonumber(ID), Name, Price, 'Permanente' ) vehPers[source] = createVehicle( ID, 2126.08862, -1136.05115, 25.47241 + 1, -0, 0, 224.5189666748 ) warpPedIntoVehicle( source, vehPers[source] ) takePlayerMoney( source, Price ) setTimer(setCameraTarget, 1500, 1, source ) setElementDimension( vehPers[source], 0 ) setElementDimension( source, 0 ) fadeCamera( source, false ) setTimer( fadeCamera, 1500, 1, source, true ) triggerClientEvent( source, 'VehiclesSystem;hideBuyWindow', source ) viewVehiclex( nil, nil, nil, nil, 'close' ) refreshMyList( ) else outputChatBox( '#1E90FF[Car Shop] #FFFFFFError: This vehicle already exists in your list #FF0000!', source, 255, 255, 255, true ) return end end )
  11. Is there a resource that spawns from the nearest hospital after a player dies ?... or how to make it. I have put many respawn resources but there is some error and it doesn't spawn from the nearest hospital.
  12. I created a Miner Job but there is a problem. When I hit the plant command several times, I could mine only the 5 stones in this script, but the other stones are not destroyed. What is the reason for this? Please help? addEvent("startMinerJob", true) function startJob(thePlayer) if not (getElementData(thePlayer, "Jobs") == "miner") then setElementData(thePlayer, "Jobs", "miner") end function plant(thePlayer) if (getElementData(thePlayer, "Jobs") == "miner") then x, y, z = getElementPosition(thePlayer) disx = 611.54028 disy = 878.61017 disz = -42.9609 if (getDistanceBetweenPoints3D(x, y, z, disx, disy, disz) < 90) then outputChatBox("Bomb Planted!", thePlayer, 255, 0, 0) setTimer(function() createExplosion(x, y, z, 10) stone1 = createObject(3930, x+0, y+1, z-0.5) stone2 = createObject(3930, x+1*2, y+3, z-0.5) stone3 = createObject(3930, x+2*2, y+2, z-0.5) stone4 = createObject(3930, x+3*2, y+5, z-0.5) stone5 = createObject(3930, x+4*2, y+4, z-0.5) x1, y1, z1 = getElementPosition(stone1) x2, y2, z2 = getElementPosition(stone2) x3, y3, z3 = getElementPosition(stone3) x4, y4, z4 = getElementPosition(stone4) x5, y5, z5 = getElementPosition(stone5) marker1 = createMarker(x1, y1, z1, "cylinder", 1.0, 0, 0, 0, 0) marker2 = createMarker(x2, y2, z2, "cylinder", 1.0, 0, 0, 0, 0) marker3 = createMarker(x3, y3, z3, "cylinder", 1.0, 0, 0, 0, 0) marker4 = createMarker(x4, y4, z4, "cylinder", 1.0, 0, 0, 0, 0) marker5 = createMarker(x5, y5, z5, "cylinder", 1.0, 0, 0, 0, 0) addEventHandler("onMarkerHit", marker1, function(thePlayer) setPedFrozen(thePlayer, true) setPedAnimation(thePlayer, "FIGHT_B", "FightB_G", -1, false, false, false, false) destroyElement(marker1) setTimer(function() destroyElement(stone1) setPedFrozen(thePlayer, false) givePlayerMoney(thePlayer, 300) end, 3000, 1) end) addEventHandler("onMarkerHit", marker2, function(thePlayer) setPedFrozen(thePlayer, true) setPedAnimation(thePlayer, "FIGHT_B", "FightB_G", -1, false, false, false, false) destroyElement(marker2) setTimer(function() destroyElement(stone2) setPedFrozen(thePlayer, false) givePlayerMoney(thePlayer, 300) end, 3000, 1) end) addEventHandler("onMarkerHit", marker3, function(thePlayer) setPedFrozen(thePlayer, true) setPedAnimation(thePlayer, "FIGHT_B", "FightB_G", -1, false, false, false, false) destroyElement(marker3) setTimer(function() destroyElement(stone3) setPedFrozen(thePlayer, false) givePlayerMoney(thePlayer, 300) end, 3000, 1) end) addEventHandler("onMarkerHit", marker4, function(thePlayer) setPedFrozen(thePlayer, true) setPedAnimation(thePlayer, "FIGHT_B", "FightB_G", -1, false, false, false, false) destroyElement(marker4) setTimer(function() destroyElement(stone4) setPedFrozen(thePlayer, false) givePlayerMoney(thePlayer, 300) end, 3000, 1) end) addEventHandler("onMarkerHit", marker5, function(thePlayer) setPedFrozen(thePlayer, true) setPedAnimation(thePlayer, "FIGHT_B", "FightB_G", -1, false, false, false, false) destroyElement(marker5) setTimer(function() destroyElement(stone5) setPedFrozen(thePlayer, false) givePlayerMoney(thePlayer, 300) end, 3000, 1) end) end, 5000, 1) end end end addCommandHandler("plant", plant) end addEventHandler("startMinerJob", root, startJob) --[[ Leave Miner Job Section ]] addEvent("leaveMinerJob", true) function leaveJob(thePlayer) if (getElementData(thePlayer, "Jobs") == "miner") then setElementData(thePlayer, "Jobs", nil) outputChatBox("you leaved miner job!", thePlayer, 0, 255, 0) end end addEventHandler("leaveMinerJob", root, leaveJob)
  13. da rapaziada, gostaria de saber como faço para modificar um do lados do retangulo, tipo deixar um dos lados dele um pouco na diagonal, tipo assim " / ", poderiam me ajudar?
  14. Lua tables are a fundamental data structure that allows you to store key-value pairs and create complex data structures. Tables in Lua are versatile and can contain values of different types. Let's dive into a detailed explanation with examples : Table Creation: To create a table in Lua, you use curly braces { } and separate the elements with commas. Here's an example: local table = {1, 2, 3, 4, 5} -- table crt In the above example, we created a table named table and populated it with values 1, 2, 3, 4, and 5. Accessing Table Elements: You can access table elements by using square brackets [ ]. Indices in Lua start from 1. Here's an example: -- Accessing table elements print(table[1]) --output : 1 print(table[3]) --output : 3 In the above example, we access the value at the 1st index (1) and the 3rd index (3) of the table. Adding Elements to a Table: To add a new element to a table, you specify the index and the value. If the specified index already exists in the table, the value will be overwritten. Here's an example: -- Removing elements from a table table[3] = nil In the above example, we remove the element at the 3rd index of the table. Getting the Size of a Table: To get the size of a table (i.e., the number of elements), you can use the # operator. Here's an example: -- Getting the size of a table print(#table) -- 5 In the above example, we print the size of the table using the # operator. Table Iteration: You can iterate over the elements in a table using the ipairs or pairs functions. ipairs provides index-based iteration, while pairs provides key-based iteration. Here's an example: -- Table iteration for index, value in ipairs(table) do print(index, value) end In the above example, we iterate over the table using ipairs and print the index and value of each element. +---------------------------------------------------+ | Game Settings | +---------------------------------------------------+ | Difficulty: | Hard | | Sound Volume: | 80% | | Controls: | Keyboard & Mouse | | Graphics Quality: | High | +---------------------------------------------------+ In the above example, an ASCII art representation is used to display a Lua table representing game settings. The table consists of different elements representing various game settings. Here's the Lua code that represents the table: local gameSettings = { difficulty = "Hard", soundVolume = "80%", controls = "Keyboard & Mouse", graphicsQuality = "High" } In the Lua code, a table named "gameSettings" is created, and different elements representing game settings such as difficulty, sound volume, controls, and graphics quality are added to the table. local person = { name = "Eren", age = 20, occupation = "Software Engineer", country = "Germany" } local tableFormat = [[ +-----------------------+ | Person Info | +-----------------------+ | Name: %s | | Age: %d | | Occupation: %s | | Country: %s | +-----------------------+ ]] local formattedTable = string.format(tableFormat, person.name, person.age, person.occupation, person.country) print(formattedTable) In the example above, we create a Lua table named "person" and populate it with some sample information about a person. We then define a string format named "tableFormat" which represents an ASCII table structure. We use placeholders like %s and %d to indicate the places where the values from the "person" table will be inserted. Finally, we use the string.format function to fill in the format with the data from the "person" table and store it in the variable "formattedTable". We print the "formattedTable" to display the final result. I explained string methods in the previous tutorial, here is the link: string methods LINK Output : +-----------------------+ | Person Info | +-----------------------+ | Name: Eren | | Age: 20 | | Occupation: Software Engineer | | Country: Germany | +-----------------------+ Nested Tables: Tables can contain other tables, allowing you to create nested or multidimensional data structures. Here's an example: -- Nested tables local team = { name = "Team A", players = { { name = "Eren", age = 20 }, { name = "Emily", age = 27 }, { name = "Angela", age = 23 } } } print(team.name) -- Team A print(team.players[2].name) -- Emily In the above example, we created a table named team with two elements: name and players. The players element is a nested table that contains information about individual players. We access the name element of the team table and the name of the player at the 2nd index of the players table. Table Insertion and Removal: Lua provides various functions for inserting and removing elements from tables. Here's an example that demonstrates these operations: -- Table insertion and removal local fruits = {"apple", "banana"} table.insert(fruits, "orange") -- Insert an element at the end table.insert(fruits, 2, "grape") -- Insert an element at the 2nd index table.remove(fruits, 1) -- Remove the element at the 1st index for index, fruit in ipairs(fruits) do print(index, fruit) end In the above example, we start with a table named fruits containing two elements. Using table.insert, we add an element at the end and another element at the 2nd index. Then, using table.remove, we remove the element at the 1st index. Finally, we iterate over the modified fruits table and print the index and value of each element. Table Concatenation: Lua allows you to concatenate tables using the .. operator. Here's an example: -- Table concatenation local table1 = {1, 2, 3} local table2 = {4, 5, 6} local mergedTable = {} for _, value in ipairs(table1) do table.insert(mergedTable, value) end for _, value in ipairs(table2) do table.insert(mergedTable, value) end for index, value in ipairs(mergedTable) do print(index, value) end In the above example, we have two tables named table1 and table2. We create an empty table named mergedTable and use table.insert to concatenate the elements from table1 and table2 into mergedTable. Finally, we iterate over mergedTable and print the index and value of each element. for MTA:SA Player Information: Lua tables can be used to store player information in MTA:SA. Below is an example of a player table that contains details such as the player's name, level, and score: local player = { name = "Eren", level = 5, score = 1000 } In the above example, we create a table named "player" and populate it with the player's name, level, and score. Vehicle List: Lua tables can be utilized to store data related to vehicles in MTA:SA. Here's an example of a vehicle table that includes the model names and colors of the vehicles: local vehicles = { { model = "Infernus", color = {255, 0, 0} }, { model = "Bullet", color = {0, 0, 255} }, { model = "Sultan", color = {0, 255, 0} } } In the above example, we create a table named "vehicles" and store each vehicle as a separate table with its model name and color data. Colors are represented using RGB values. NPC (Non-Player Character) List: Lua tables can be used to store in-game NPCs in MTA:SA. Here's an example of an NPC list table that includes the model IDs and coordinates of the NPCs: local npcs = { { model = 23, x = 100, y = 200, z = 10 }, { model = 56, x = 150, y = 250, z = 15 }, { model = 89, x = 200, y = 300, z = 20 } } In the above example, we create a table named "npcs" and store each NPC as a separate table with their model ID and coordinates. I hope you will like it
  15. How do you try not to hit the marker when a player is in a vehicle ?
  16. i created tree cuting job in my server but it have probem. when i take job ,job panel going to all players in server . how can fix it jobPed = createPed(230, 870.47406, -24.95437, 63.97986, 160) setPedFrozen(jobPed, true) jobMarker = createMarker(870.02686, -25.90853, 62.90933, "cylinder", 1.5) createBlipAttachedTo(jobMarker, 22) addEventHandler("onClientMarkerHit", jobMarker, function(player) window = guiCreateWindow(500, 200, 250, 250, "*Tree JoB*", false) memo = guiCreateMemo(100, 20, 240, 100, "Unicos RP Tree Job You can make esy money with rhis one# happy happy happy", false, window) button = guiCreateButton(20, 150, 100, 100, "Accep", false, window) closebutton = guiCreateButton(150, 150, 100, 100, "Close", false, window) showCursor(true) end) function clicks() if source == closebutton then guiSetVisible(window, false) showCursor(false) elseif source == button then guiSetVisible(window, false) showCursor(false) --outputChatBox("You Have a Job!", 0, 255, 0) triggerServerEvent("StartTreeJob", resourceRoot, localPlayer) end end addEventHandler("onClientGUIClick", root, clicks)
  17. I made a bank rob script and there is a big problem. When a person plants the bomb, if another player hits the markers to get money, nothing will happen to him. The person who planted the bomb will get those things. How to fix it? ped1 = createPed(76, 2306.65967, -3.14179, 26.74219, -90) ped2 = createPed(76, 2312.06738, -11.00959, 26.74219, 90*2) ped3 = createPed(76, 2318.17793, -7.16190, 26.74219, 90) entranceGate = createObject(3036, 2304.04873, -17.82764, 26.74219, 0, 0, 90) exitgate = createObject(2930, 2314.72744, 0.79857, 27.94219, 0, 0, 90) marker = createMarker(2303.18848, -16.23989, 25.58438, "cylinder", 1.5, 255,0,0) createBlipAttachedTo(marker, 36) addEventHandler("onMarkerHit", marker, function(thePlayer) destroyElement(marker) setPedFrozen(thePlayer, true) setTimer(function()-- repeat animation set bomb setPedAnimation(thePlayer, "BOMBER", "BOM_Plant", -1, false, false, false, false) end, 1000, 15) setTimer(function()-- bomb planting time Dynamite = createObject(1654, 2303.78211, -16.25232, 25.78438, 0, 90, -90) setObjectScale(Dynamite, 2) setPedFrozen(thePlayer, false) outputChatBox("Run! Run! Run! The bomb was planted", thePlayer, 255,0,0) end, 15000, 1) setTimer(function()-- settimer to expolsion x = 1 while (x < 20) do expolsion = createExplosion(2304.04873, -17.82764, 26.74219, 10) x = x+1 end if expolsion then outputChatBox("The entrance of the bank was destroyed", thePlayer, 255,255,0) destroyElement(entranceGate) destroyElement(Dynamite) setPedAnimation(ped1, "ped", "handsup", -1, false) setPedAnimation(ped2, "ped", "handsup", -1, false) setPedAnimation(ped3, "ped", "handsup", -1, false) end moneyOb1 = createObject(1212, 2312.23828, -17.32469, 27.38801) moneyOb2 = createObject(1212, 2314.83828, -17.32469, 27.38801) setObjectScale(moneyOb1, 2) setObjectScale(moneyOb2, 2) moneyOne = createMarker(2312.33984, -16.28635, 25.84957, "cylinder", 1, 0,255,255) moneyTwo = createMarker(2314.93530, -16.28635, 25.84957, "cylinder", 1, 0,255,255) addEventHandler("onMarkerHit", moneyOne, function() setPedFrozen(thePlayer, true) destroyElement(moneyOne) setTimer(function() setPedAnimation(thePlayer, "BOMBER", "BOM_Plant", -1, false, false, false, false) end, 500, 20) setTimer(function() setPedFrozen(thePlayer, false) mathRandomMoney = math.random(40000, 60000) givePlayerMoney(thePlayer, mathRandomMoney) outputChatBox("You have received $"..mathRandomMoney, thePlayer, 0,255,0) destroyElement(moneyOb1) moneyBag = createObject(1550,0,0,0) exports.bone_attach:attachElementToBone(moneyBag,thePlayer,3, 0, -0.17, 0.07, 0, 0, 0) setTimer(function() ---- Money bag destroy Time 5min (1000*60*5) destroyElement(moneyBag) end, 1000*60*5, 1) end, 1000*35, 1) end) addEventHandler("onMarkerHit", moneyTwo, function() setPedFrozen(thePlayer, true) destroyElement(moneyTwo) setTimer(function() setPedAnimation(thePlayer, "BOMBER", "BOM_Plant", -1, false, false, false, false) end, 500, 20) setTimer(function() setPedFrozen(thePlayer, false) mathRandomMoney = math.random(40000, 60000) givePlayerMoney(thePlayer, mathRandomMoney) outputChatBox("You have received $"..mathRandomMoney, thePlayer, 0,255,0) destroyElement(moneyOb2) moneyBag = createObject(1550,0,0,0) exports.bone_attach:attachElementToBone(moneyBag,thePlayer,3, 0, -0.17, 0.07, 0, 0, 0) setTimer(function()---- Money bag destroy Time 5min (1000*60*5) destroyElement(moneyBag) end, 1000*60*5, 1) end, 1000*35, 1) end) end, 25000, 1) end)
  18. Hey guys, I'm doing freelance on MTA. Prices are very cheap, I accept almost any pay method. Can do: Lua scripting, web development (React/Vue) + Backend (express.js), UI/UX design, simple low poly GTA SA style models, shaders Portfolio: https://imgur.com/a/39PFt56 (click see more) Shaders portfolio: I don't respond on forum, text me on discord borsuk#1102
  19. When I randomly tap my voice button or just hold it for sec, I experience bug when event "onClientPlayerVoiceStop" is not being called. Anyone experience it yet? Image with UI representation of bug https://imgur.com/a/LfysaBA thanks for any replay ;)
  20. getJobMarker = createMarker(872.03754, -29.07278, 62.3000, "cylinder", 1.0, 0, 255, 255, 255, getRootElement()) ped = createPed(159, 872.92389, -27.08743, 63.94565, 160) setPedFrozen(ped, true) blip = createBlipAttachedTo(getJobMarker, 56) function hitMarkerWindow() window = guiCreateWindow(0.35, 0.35, 0.35, 0.30, "wood job", true) memo = guiCreateMemo(0.10, 0.20, 0.80, 0.4, "this is wood cutting job", true, window) accept = guiCreateButton(0.10, 0.75, 0.22, 0.14, "Accept Job", true, window) leave = guiCreateButton(0.35, 0.75, 0.22, 0.14, "Leave Job", true, window) close = guiCreateButton(0.60, 0.75, 0.22, 0.14, "Close", true, window) showCursor(true) guiMemoSetReadOnly(memo, true) end addEventHandler("onClientMarkerHit", getJobMarker, hitMarkerWindow) function clientClick() if source == close then guiSetVisible(window, false) showCursor(false) triggerServerEvent("cancelButton", resourceRoot, localPlayer) elseif source == accept then guiSetVisible(window, false) showCursor(false) triggerServerEvent("acceptWoodJob", resourceRoot, localPlayer) elseif source == leave then guiSetVisible(window, false) showCursor(false) triggerServerEvent("leaveJob", resourceRoot, localPlayer) end end addEventHandler("onClientGUIClick", root, clientClick)
  21. function tpbloods(playerSource) if isObjectInACLGroup("user." ..getAccountName(getPlayerAccount(playerSource)), aclGetGroup("Staff")) then if getElementData(playerSource, "Expediente-STAFF") == "Sim" then if not Flying[playerSource] then Flying[playerSource] = true setElementAlpha(playerSource, 0) triggerClientEvent(playerSource, "onClientFlyToggle", playerSource) end setElementPosition(playerSource, 2219.984, -1143.273, 25.797) setElementRotation(playerSource, 0, 0, 353.328) showInfobox(playerSource, "Você teleportou na base Bloods", "success") else atendimento(playerSource) end end end addCommandHandler("tpbloods", tpbloods) function tpgrove(playerSource) if isObjectInACLGroup("user." ..getAccountName(getPlayerAccount(playerSource)), aclGetGroup("Staff")) then if getElementData(playerSource, "Expediente-STAFF") == "Sim" then if not Flying[playerSource] then Flying[playerSource] = true setElementAlpha(playerSource, 0) triggerClientEvent(playerSource, "onClientFlyToggle", playerSource) end setElementPosition(playerSource, 2463.633, -1659.423, 13.311) setElementRotation(playerSource, 0, 0, 88.373) showInfobox(playerSource, "Você teleportou na base da Grove", "success") else atendimento(playerSource) end end end addCommandHandler("tpgrove", tpgrove) function tpcrips(playerSource) if isObjectInACLGroup("user." ..getAccountName(getPlayerAccount(playerSource)), aclGetGroup("Staff")) then if getElementData(playerSource, "Expediente-STAFF") == "Sim" then if not Flying[playerSource] then Flying[playerSource] = true setElementAlpha(playerSource, 0) triggerClientEvent(playerSource, "onClientFlyToggle", playerSource) end setElementPosition(playerSource, 2183.58, -1761.268, 13.375) setElementRotation(playerSource, 0, 0, 359.602) showInfobox(playerSource, "Você teleportou na base Crips", "success") else atendimento(playerSource) end end end addCommandHandler("tpcrips", tpcrips) function tpsiliciana(playerSource) if isObjectInACLGroup("user." ..getAccountName(getPlayerAccount(playerSource)), aclGetGroup("Staff")) then if getElementData(playerSource, "Expediente-STAFF") == "Sim" then if not Flying[playerSource] then Flying[playerSource] = true setElementAlpha(playerSource, 0) triggerClientEvent(playerSource, "onClientFlyToggle", playerSource) end setElementPosition(playerSource, 2418.157, -2009.204, 13.396) setElementRotation(playerSource, 0, 0, 90.592) showInfobox(playerSource, "Você teleportou na base Siliciana", "success") else atendimento(playerSource) end end end addCommandHandler("tpsiliciana", tpsiliciana) ---------------------------------------------------------------------------------------------------------------------------- function showInfobox(element, message, tipo) exports["[HYPE]NOTIFY"]:addNotification(element, message, tipo) end atendimento = function (element) return triggerClientEvent(element, "HypeNotify", element, "Você não está em modo atendimento use /pro", "error") end Basicamente são vários comandos que executam basicamente a mesma função eu gostaria que fosse menor tipo executar o comando e o nome da base ai ele puxar a posição da base e teleportar pequeno exemplo abaixo bases = {{yakuza, 2418.157, -2009.204, 13.396 }, {bloods, 1234.09, -2029.24, 13.396 }}
  22. I am new to Mtasa scripting. May I know what is Root and Source and in what situations they are used?
  23. Nesse script abaixo se você arrastar o item do inventario chamado "chavedefenda" ele executa uma função eu gostaria q esse item roubasse cada pneu do carro ou seja o jogador chega perto do pneu e arrasta a chave de fenda pro carro ai ele começa a roubar o pneu do carro quando ele termina de roubar o pneu vai pro inventario e o pneu do carro some automaticamente o mesmo serve pra quando o jogador tem o pneu no inventario ai arrasta a chave de fenda pro carro fazendo assim ele coloca o pneu de volta no carro ou seja se ele tiver o pneu no inventario e o carro não tiver um ou mais pneus ele coloca o pneu no lugar e ele sai do inventario do jogador quem conseguir fazer pra mim elseif getElementType(target) == "vehicle" then --Interação com veículos if item == "toolbox" then --Reparar o veículos drop = false local health = getElementHealth(target) if health >= 1000 then sendNotification(player, "error", "O veículo não precisa de reparo.") return false end local result = takeItem(player, slot, "toolbox", 1) if result then closeInventory(player) setPedAnimation(player, "OTB", "betslp_loop", 0, true, true, false) toggleControl(player, "fire", false) toggleControl(player, "jump", false) setElementFrozen(target, true) toggleAllControls(player, false) playSound3D(target, "fix.mp3", 20) sendProgressbar(player, 15, "Reparando o veículo...") cooldown[player] = setTimer(function() setPedAnimation( player, "ped", "facanger", 0, false, false, false) toggleControl(player, "fire", true) toggleControl(player, "jump", true) setElementFrozen(target, false) toggleAllControls(player, true) setElementHealth(target, 1000) fixVehicle(target) cooldown[player] = nil sendNotification(player, "success", "Veículo reparado com sucesso.") end, 1000*15, 1) else sendNotification(player, "error", "Ocorreu um erro ao usar este item.") end elseif item == "chavedefenda" then drop = false local theVehicle = getPedOccupiedVehicle ( player ) if ( theVehicle ) then sendNotification(player, "error", "Desça do veiculo primeiro") return false end local result = takeItem(player, slot, "chavedefenda", 1) if result then closeInventory(player) setPedAnimation(player, "OTB", "betslp_loop", 0, true, true, false)--animação roubando toggleControl(player, "fire", false) toggleControl(player, "jump", false) setElementFrozen(target, true) toggleAllControls(player, false) sendProgressbar(player, 15, "Roubando o pneu...") cooldown[player] = setTimer(function() setPedAnimation( player, "ped", "facanger", 0, false, false, false) toggleControl(player, "fire", true) toggleControl(player, "jump", true) setElementFrozen(target, false) toggleAllControls(player, true) --setElementData(target, "Gasolina", gasolina + 25) cooldown[player] = nil sendNotification(player, "success", "você roubou o pneu do veiculo com sucesso") end, 1000*15, 1) else sendNotification(player, "error", "Ocorreu um erro ao usar este item") end end end
  24. Esses 2 helicópteros contem armas q meus players que forem pilotar eles vão querer usar em algum momento eu gostaria de bloquear esses armamentos do meu servidor como eu poderia fazer isso?
  25. EU SIMPLESMENTE GOSTARIA QUE QUEM TIVESSE NAS ACLS VIPS [ DIAMANTE, OURO, PRATA, BRONZE ] TIVESSE MAIS SLOTS NA GARAGEM O SCRIPT É ASSIM createEventHandler ("MST.onPlayerBuyVehicle", getRootElement (), function (player, selecionado, cor_1, cor_2, cor_3, cor_4) if selecionado then local accName = getAccountName (getPlayerAccount (player)) local result = dbPoll (dbQuery (db, "SELECT * FROM Veiculos WHERE Conta = ? AND Modelo = ?", accName, selecionado.model), -1) if #result == 0 then if getAllPlayerVehicles (player) >= config.gerais.veiculosmax then --eu sei q é aqui q impede que o jogador compre mais carros message (player, "Você já possui a quantidade máxima de veículos", "error") return end local money = getPlayerMoney (player) if money >= selecionado.price then local id = NovoID () local cor = cor_1..", "..cor_2..", "..cor_3..", "..cor_4 local t_1, t_2, t_3, t_4, t_5, t_6, t_7, t_8, t_9, t_10, t_11, t_12, t_13, t_14, t_15 = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 local tunning = t_1..", "..t_2..", "..t_3..", "..t_4..", "..t_5..", "..t_6..", "..t_7..", "..t_8..", "..t_9..", "..t_10..", "..t_11..", "..t_12..", "..t_13..", "..t_14..", "..t_15 dbExec (db, "INSERT INTO Veiculos VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", accName, id, selecionado.name, selecionado.model, "Guardado", cor, tunning, "Não", 0, "SemPlaca", selecionado.price, 1000, 100) message (player, "Você comprou o veículo "..selecionado.name.." por R$"..convertNumber(selecionado.price)..",00.", "success") takePlayerMoney (player, selecionado.price) triggerClientEvent (player, "MST.onPlayerCloseEvents", player) else message (player, "Você não possui dinheiro suficiente.", "error") end else message (player, "Você já possui esse veículo.", "error") end else message (player, "Selecione algum veículo da lista.", "error") end end) --aqui é a função a cima q verifica os carros q o jogador tem na garagem function getAllPlayerVehicles (player) local accName = getAccountName (getPlayerAccount (player)) local result = dbPoll (dbQuery (db, "SELECT * FROM Veiculos WHERE Conta = ?", accName), -1) return #result end --aqui e no arquivo de configuração config = { gerais = { veiculosmax = 2, -- Veículos Máximos que o Jogador vai poder ter na Garagem. elementfuel = "Gasolina", -- Element Data de Gasolina do seu Servidor. elementid = "ID", -- Element Data de ID do seu Servidor. infobox = "addBox", -- Evento da sua Infobox. distancia = 30, -- Distancia do Player e do Veículo. (Guardar Veículo) velocitymax = 400, -- Velocidade Máximas de todos os Veículos. acls = {"Console"}, -- ACL's Administradoras do seu Servidor. },
×
×
  • Create New...