Jump to content

Search the Community

Showing results for tags 'scripting'.

  • 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


Member Title


Gang


Location


Occupation


Interests

  1. Hola abro este foro para ver si alguien me puede ayudar mandandome un pack de jobs o algunos en singular para un servidor RPG de mta ya que en internet no hay muchos que funcionen correctamente no importa el idioma en el que esten ya que yo se traducirlos
  2. redditing

    Button

    -- Client Side Button = guiCreateButton(0.45, 0.54, 0.10, 0.06, "Get Value", true) guiSetProperty(Button, "NormalTextColour", "FFAAAAAA") guiSetVisible(Button, false) EditBox= guiCreateEdit(0.41, 0.45, 0.18, 0.04, " chcesz tego kupić sztuk?", true) guiSetProperty(EditBox, "NormalTextColour", "FFFF0000") guiEditSetMaxLength(EditBox, 3) guiSetVisible(EditBox, false) addEventHandler("onClientGUIClick", Button function() local inputBox = tonumber(guiGetEdit(EditBox)) if inputBox==0 then outputChatBox("U set value input "..inputBox, 255, 255, 0) end end) -- Another Client Side addCommandHandler("TurnOnButton", function() guiSetVisible(Button, true) guiSetVisible(EditBox, true) end) I don't know what's wrong, but when I type the command 'TurnOnButton' I can't click the button and the editBox as if they didn't exist
  3. español Hola, inicie un seridor con un amigo y tenemos un problema con los markets, cuando un jugador entra a uno se le aparece el cartel a todos los demas jugadores (Por ejemplo: Un jugador entra al market del job de pizzero a todos los demas jugadores les salta el cartel para tomar el trabajo esten donde esten). Seria genial si alguien nos ayudase ya que si no lo solucionamos nos vamos a ver obligados a cerrar el servidor y no queremos eso, desde ya muchas gracias aqui dejo mi discord: Fede#7027 português Olá, comece um seridor com um amigo e temos um problema com os mercados. Quando um jogador entra em um, o pôster aparece para todos os outros jogadores (por exemplo: Um jogador entra no mercado de pizza para todos os outros jogadores. pule o pôster para aceitar o trabalho onde quer que esteja). Seria ótimo se alguém nos ajudasse, porque se não resolvermos, seremos forçados a fechar o servidor e não queremos isso, muito obrigado aqui deixo minha discórdia: Fede # 7027 english Hello, start a serer with a friend and we have a problem with the markets, when a player enters one, the poster appears to all the other players (For example: A player enters the pizza job market to all the other players skip the poster to take the job wherever they are). It would be great if someone helped us because if we do not solve it we will be forced to close the server and we do not want that, thank you very much here I leave my discord: Fede # 7027
  4. local SCREEN_X, SCREEN_Y = guiGetScreenSize() local resourceName = getResourceName( getThisResource( ) ) local ONE_HOUR = 3600 local SERVICES_SECTION = 1 --Places to offer services such as house cleaning or mechanics and whatnot local CARS_VEHICLES_SECTION = 2 --Offer to buy or sell a vehicle in this section local REAL_ESTATE_SECTION = 3 --Houses for sale go in this section local COMMUNITY_SECTION = 4 --Advertisements about communities can go here, for example, palomino creek. local JOBS_SECTION = 5 --Advertisements about hiring people or looking for work will go in this section local PERSONALS_SECTION = 6 --People looking for other people go in this section local sections = { "Servicii", "Vehicule", "Proprietăți", "Communitate", "Slujbe", "Personal" } local deleteAny = false local window = { } local viewad = {} local postad = {} function getTime( day, month, timestamp ) local months = { "Ianuarie", "Februarie", "Martie", "Aprile", "Mai", "Iunie", "Iulie", "August", "Septembrie", "Octobrie", "Niembrie", "Decembrie" } local days = { "Sâmbătă", "Luni", "Marți", "Miercuri", "Joi", "Vineri", "Duminică" } local time = nil local ts = nil if timestamp then time = getRealTime( timestamp ) else time = getRealTime( ) end ts = ( tonumber( time.hour ) >= 12 and tostring( tonumber( time.hour ) - 12 ) or time.hour ) .. ":"..("%02d"):format(time.minute)..( tonumber( time.hour ) >= 12 and " PM" or " AM" ) if month then ts = months[ time.month + 1 ] .. " ".. time.monthday .. ", " .. ts end if day then ts = days[ time.weekday + 1 ].. ", " .. ts end return ts end addEvent( resourceName .. ":ad_create_fail", true ) addEventHandler( resourceName .. ":ad_create_fail", root, function() local window = { } --Store all of our window elements local width = 230 -- The width of our window local height = 110 -- The height of our window local x = SCREEN_X / 2 - width / 2 --Where on the screen our window will be located local y = SCREEN_Y / 2 - height / 2 window.window = guiCreateWindow( x, y, width, height, "Eroare de creatie", false ) --Create the window. window.errorLabel = guiCreateLabel( 10, 30, width - 20, 20, "A fost o eroare la introducere.", false, window.window ) window.closeButton = guiCreateButton( 10, 60, width - 20, 40, "Ieși", false, window.window ) addEventHandler( "onClientGUIClick", window.closeButton, function () guiSetVisible( window.window, false ) destroyElement( window.window ) window = { } end ) end ) function createAdvertisement( ) closePostAd() if window and window.window and isElement(window.window) then guiSetEnabled(window.window, false) end guiSetInputEnabled ( true ) local window = { } -- Store all of our window elements local width = 400 -- The width of our window local height = 440 -- The height of our window local x = SCREEN_X / 2 - width / 2 --Where on the screen our window will be located local y = SCREEN_Y / 2 - height / 2 postad.window = guiCreateWindow( x, y, width, height, "Crează Reclamă", false ) --Create the postad. postad.label = { } --This will hold our label elements local labels = { "Telefon", "Nume", "Adresă", "Expiră", "Secțiune", "Reclamă" } --This holds all of the labels we will create here local y = 35 --We'll set y to 30, which is the y coordinate of where our first label will go. for label = 1, #labels do postad.label[ label ] = guiCreateLabel( 10, y * label, 100, 30, labels[ label ], false, postad.window ) end postad.input = { } -- Will hold all of our input elements. y = 30 -- We'll start y off at 25 here to stay even with the inputs. postad.input[ 1 ] = guiCreateEdit( 100, y, width - 120, 30, "", false, postad.window ) --Phone input y = y + 35 postad.input[ 2 ] = guiCreateEdit( 100, y, width - 120, 30, "", false, postad.window ) --Name Input y = y + 35 postad.input[ 3 ] = guiCreateEdit( 100, y, width - 120, 30, "", false, postad.window ) --Address input y = y + 40 postad.input[ 4 ] = guiCreateComboBox( 100, y, width - 120, 95, "", false, postad.window ) --Expiry guiComboBoxAddItem( postad.input[ 4 ], "1 oră" ) guiComboBoxAddItem( postad.input[ 4 ], "2 ore" ) guiComboBoxAddItem( postad.input[ 4 ], "6 ore" ) guiComboBoxAddItem( postad.input[ 4 ], "O zi" ) y = y + 34 postad.input[ 5 ] = guiCreateComboBox( 100, y, width - 120, 125, "", false, postad.window ) --Section for i = 1, #sections do --Loop through each of the 6 advertisement sections. guiComboBoxAddItem( postad.input[ 5 ], sections[ i ] ) end postad.input[ 6 ] = guiCreateMemo( 10, y + 60, width - 20, 90, "", false, postad.window ) --Advertisement for i = 1, 6 do addEventHandler(getElementType( postad.input[i] ) == 'gui-combobox' and 'onClientGUIComboBoxAccepted' or 'onClientGUIChanged', postad.input[i], function( ) for i = 1, 6 do if getElementType( postad.input[i] ) == 'gui-combobox' then if guiComboBoxGetSelected( postad.input[i] ) == -1 then guiSetEnabled( postad.postButton, false ) return end else local text = ( guiGetText( postad.input[i] ) or '' ):gsub("\n", ''):gsub("\r", '') if #text == 0 then guiSetEnabled( postad.postButton, false ) return end end end guiSetEnabled( postad.postButton, true ) end, false ) end postad.postButton = guiCreateButton( 10, height - 100, width - 20, 40, "Postează Reclamă", false, postad.window ) guiSetEnabled( postad.postButton, false ) addEventHandler( "onClientGUIClick", postad.postButton, function () local phone = guiGetText( postad.input[ 1 ] ) or "" local name = guiGetText( postad.input[ 2 ] ) or "" local address = guiGetText( postad.input[ 3 ] ) or "" local advertisement = guiGetText( postad.input[ 6 ] ) local expirySelected = guiComboBoxGetSelected( postad.input[ 4 ] ) local expires = nil if expirySelected == -1 or expirySelected == 0 then expires = ONE_HOUR elseif expirySelected == 1 then expires = ONE_HOUR * 2 elseif expirySelected == 2 then expires = ONE_HOUR * 6 else expires = ONE_HOUR * 24 end local section = tostring( guiComboBoxGetSelected( postad.input[ 5 ] ) + 1 ) closePostAd() triggerServerEvent( resourceName .. ":create_advertisement", getLocalPlayer(), phone, name, address, advertisement, expires, section ) end , false ) postad.closeButton = guiCreateButton( 10, height - 50, width - 20, 40, "Ieși", false, postad.window ) addEventHandler( "onClientGUIClick", postad.closeButton, function () if source == postad.closeButton then closePostAd() end end , false ) end addCommandHandler( "postad", createAdvertisement, false, false ) function closePostAd() if postad and postad.window and isElement(postad.window) then guiSetInputEnabled ( false ) destroyElement( postad.window ) postad = { } if window and window.window and isElement(window.window) then guiSetEnabled(window.window, true) else showCursor( false, false ) end end end function viewAdvertisement( advertisement ) closeViewAd() if window and window.window and isElement(window.window) then guiSetEnabled(window.window, false) end guiSetInputEnabled ( false ) local window = { } local width = 400 local height = 530 local x = SCREEN_X / 2 - width / 2 local y = SCREEN_Y / 2 - height / 2 viewad.window = guiCreateWindow( x, y, width, height, "Vezi reclamă", false ) viewad.label = { } local labels = { "Telefon", "Nume", "Adresă", "Start", "Expiră", "Secțiune", "Reclamă" } local y = 35 for label = 1, #labels do viewad.label[ label ] = guiCreateLabel( 10, y * label, 100, 30, labels[ label ], false, viewad.window ) end viewad.input = { } y = 30 viewad.input[ 1 ] = guiCreateEdit( 100, y, width - 120, 30, advertisement.phone, false, viewad.window ) guiEditSetReadOnly( viewad.input[ 1 ], true ) y = y + 35 viewad.input[ 2 ] = guiCreateEdit( 100, y, width - 120, 30, advertisement.name, false, viewad.window ) guiEditSetReadOnly( viewad.input[ 2 ], true ) y = y + 35 viewad.input[ 3 ] = guiCreateEdit( 100, y, width - 120, 30, advertisement.address, false, viewad.window ) guiEditSetReadOnly( viewad.input[ 3 ], true ) y = y + 35 viewad.input[ 4 ] = guiCreateEdit( 100, y, width - 120, 30, getTime( true, true, advertisement.start ), false, viewad.window ) guiEditSetReadOnly( viewad.input[ 4 ], true ) y = y + 35 viewad.input[ 5 ] = guiCreateEdit( 100, y, width - 120, 30, getTime( true, true, advertisement.expiry ), false, viewad.window ) guiEditSetReadOnly( viewad.input[ 5 ], true ) y = y + 35 viewad.input[ 6 ] = guiCreateEdit( 100, y, width - 120, 30, sections[ tonumber( advertisement.section ) ], false, viewad.window ) guiEditSetReadOnly( viewad.input[ 6 ], true ) viewad.input[ 7 ] = guiCreateMemo( 10, y + 60, width - 20, 90, advertisement.advertisement, false, viewad.window ) guiMemoSetReadOnly( viewad.input[ 7 ], true ) if tonumber( getElementData( localPlayer, "dbid" ) ) == tonumber( advertisement.created_by ) or deleteAny then guiCreateLabel( 100, 245, 200, 25, "Creat de: " .. advertisement.author:gsub("_", " "), false, viewad.window ) viewad.pushButton = guiCreateButton( 10, height - 150, width - 20, 40, "Trimite reclama ($100)", false, viewad.window ) if tonumber( getElementData( localPlayer, "dbid" ) ) ~= tonumber( advertisement.created_by ) then guiSetProperty( viewad.pushButton, 'NormalTextColour', 'FFFF0000' ) end addEventHandler( "onClientGUIClick", viewad.pushButton, function () triggerServerEvent( resourceName .. ":push_advertisement", localPlayer, advertisement.id ) end , false ) end if tonumber( getElementData( localPlayer, "dbid" ) ) == tonumber( advertisement.created_by ) or deleteAny then viewad.deleteButton = guiCreateButton( 10, height - 100, width - 20, 40, "Șterge Reclamă", false, viewad.window ) if tonumber( getElementData( localPlayer, "dbid" ) ) ~= tonumber( advertisement.created_by ) then guiSetProperty( viewad.deleteButton, 'NormalTextColour', 'FFFF0000' ) end addEventHandler( "onClientGUIClick", viewad.deleteButton, function () closeViewAd() triggerServerEvent( resourceName .. ":delete_advertisement", localPlayer, advertisement.id ) end , false ) end viewad.closeButton = guiCreateButton( 10, height - 50, width - 20, 40, "Ieși", false, viewad.window ) addEventHandler( "onClientGUIClick", viewad.closeButton, function () if source == viewad.closeButton then closeViewAd() end end , false ) end function closeViewAd() if viewad and viewad.window and isElement(viewad.window) then guiSetInputEnabled ( false ) guiSetVisible( viewad.window, false ) destroyElement( viewad.window ) viewad = { } if window and window.window and isElement(window.window) then guiSetEnabled(window.window, true) else showCursor( false, false ) end end end addEvent( resourceName .. ":display_all", true ) addEventHandler( resourceName .. ":display_all", root, function( advertisements, canDeleteAnyAd ) closeAds() deleteAny = canDeleteAnyAd showCursor( true, true ) local width = 500 local height = 500 local x = SCREEN_X / 2 - width / 2 local y = SCREEN_Y / 2 - height / 2 window.window = guiCreateWindow( x, y, width, height, "Reclame", false ) window.closeButton = guiCreateButton( 10, 30, width - 20, 40, "Creează Reclamă", false, window.window ) addEventHandler( "onClientGUIClick", window.closeButton, function () createAdvertisement( ) end , false ) window.mainPanel = guiCreateTabPanel ( 10, 90, width - 15, height - 150, false, window.window ) window.tab = { } window.table = { } window.colPhone = { } window.colName = { } window.colAd = { } for i = 1, #sections do window.tab[ i ] = guiCreateTab( sections[ i ], window.mainPanel ) window.table[ i ] = guiCreateGridList ( 10, 10, width - 35, height - 190, false, window.tab[ i ] ) window.colPhone[ i ]= guiGridListAddColumn( window.table[ i ], "Telefon", 0.2 ) window.colName[ i ] = guiGridListAddColumn( window.table[ i ], "Nume", 0.2 ) window.colAd[ i ] = guiGridListAddColumn( window.table[ i ], "Reclamă", 0.5 ) for ad = 1, #advertisements do if tonumber( advertisements[ ad ].section ) == i then local row = guiGridListAddRow ( window.table[ i ] ) guiGridListSetItemText( window.table[ i ], row, window.colPhone[ i ], advertisements[ ad ].phone, false, false ) guiGridListSetItemText( window.table[ i ], row, window.colName[ i ], advertisements[ ad ].name, false, false ) guiGridListSetItemText( window.table[ i ], row, window.colAd[ i ], advertisements[ ad ].advertisement, false, false ) guiGridListSetItemData( window.table[ i ], row, window.colPhone[ i ], ad ) addEventHandler( "onClientGUIDoubleClick", window.table[ i ], function ( button, state ) if button == 'left' and state == 'up' and window and window.table then local selectedRow, selectedCol = guiGridListGetSelectedItem( window.table[ i ] ) local key = guiGridListGetItemData( window.table[ i ], selectedRow, window.colPhone[ i ] ) if advertisements[ key ] then viewAdvertisement( advertisements[ key ] ) end end end , false ) end end if guiGridListGetRowCount( window.table[ i ] ) == 0 then local row = guiGridListAddRow ( window.table[ i ] ) guiGridListSetItemText ( window.table[ i ], row, window.colPhone[ i ], "Nici-o reclamă", false, false ) end end window.closeButton = guiCreateButton( 10, height - 50, width - 20, 40, "Ieși", false, window.window ) addEventHandler( "onClientGUIClick", window.closeButton, function () if source == window.closeButton then closeAds() end end , false ) end ) function closeAds() if window and window.window and isElement(window.window) then showCursor( false, false ) destroyElement( window.window ) window = { } closePostAd() end end local SERVICES_SECTION = 1 --Places to offer services such as house cleaning or mechanics and whatnot local CARS_VEHICLES_SECTION = 2 --Offer to buy or sell a vehicle in this section local REAL_ESTATE_SECTION = 3 --Houses for sale go in this section local COMMUNITY_SECTION = 4 --Advertisements about communities can go here, for example, palomino creek. local JOBS_SECTION = 5 --Advertisements about hiring people or looking for work will go in this section local PERSONALS_SECTION = 6 --People looking for other people go in this section local COOLDOWN_MINUTES = 5 --Number of minutes between push alerts being sent by players local resourceName = getResourceName( getThisResource( ) ) local sections = { "Servicii", "Vehicule", "Proprietăți", "Communitate", "Slujbe", "Personal" } function escape( value ) return exports.mysql:escape_string( value ) end function now( ) return tonumber( getRealTime().timestamp ) end addEvent( resourceName .. ":create_advertisement", true ) addEventHandler( resourceName .. ":create_advertisement", root, function( phone, name, address, advertisement, expires, section ) --Check if all fields have been entered by the user. if not ( phone == nil or name == nil or address == nil or advertisement == nil ) then --Fetch the created by local createdBy = tostring( getElementData( source, "dbid" ) ) --Get the current server time to store as our start time local start = getRealTime().timestamp --Add the time until expiry to the start time to get the actual time it will expire. local expiry = start + expires --Check if our query went into the database successfully. if exports.mysql:insert( 'advertisements', { phone = phone, name = name, address = address, advertisement = advertisement, start = start, expiry = expiry, section = section, created_by = createdBy } ) then --We'll send something to the client side so they can close the add form and reopen the main advertisements form. --openAdvertisements( source, nil ) else --If the database query was unsucessful, alert the end user. outputChatBox( "SQL Error.", source ) triggerClientEvent( source, resourceName .. ":ad_create_fail", root ) end else --If all fields were not entered, alert the user. outputChatBox( "Field Error.", source ) triggerClientEvent( source, resourceName .. ":ad_create_fail", root ) end end ) local coolDown = {} addEvent( resourceName .. ":push_advertisement", true ) addEventHandler( resourceName .. ":push_advertisement", root, function( id ) local advertisement = exports.mysql:select_one( "advertisements", { id = id } ) advertisement.author = exports.mysql:select_one( "characters", { id = advertisement.created_by } ).charactername if not coolDown[ id ] or ( coolDown[ id ] < now() - ( 60 * COOLDOWN_MINUTES ) ) then if exports.bank:takeBankMoney( client, 100 ) then coolDown[ id ] = now() for i, k in pairs( getElementsByType( 'player' ) ) do if exports.integration:isPlayerTrialAdmin( k ) then outputChatBox( "ADVERT: " .. advertisement.advertisement .. " | Ph: " .. advertisement.phone .. " | Cat: " .. sections[ tonumber( advertisement.section ) ] .. " (( " .. advertisement.author:gsub("_", " ") .." )) .", k, 0, 255, 0 ) else outputChatBox( "ADVERT: " .. advertisement.advertisement .. " | Ph: " .. advertisement.phone .. " | Cat: " .. sections[ tonumber( advertisement.section ) ] .. ".", k, 0, 255, 0 ) end end else outputChatBox( "Nu ai destui bani în bancă să trimiți această reclamă.", client, 255, 155, 155 ) end else outputChatBox( "Poți trimite o reclamă o dată la " .. COOLDOWN_MINUTES .. " minute.", client, 255, 155, 155 ) end end ) function deleteAdvertisement( id ) return exports.mysql:delete('advertisements', {id = id}) end addEvent( "advertisements:delete_advertisement", true ) addEventHandler( "advertisements:delete_advertisement", getRootElement(), function( id ) if deleteAdvertisement( id ) then --openAdvertisements( source ) else outputChatBox( "An error occured with deleting that ad.", source, 255, 100, 100 ) end end ) function openAdvertisements( player, command ) local advertisements = { } --These will hold our advertisements to send to the client and populate our advertisement tables. if not player then player = source end for _, ad in ipairs( exports.mysql:select('advertisements') ) do if tonumber( ad.expiry ) >= tonumber( getRealTime().timestamp ) then --Check if the advertisement has expired, delete it if so. ad.author = exports.mysql:select_one( "characters", { id = ad.created_by } ).charactername table.insert( advertisements, ad ) else deleteAdvertisement( ad.id ) end end triggerClientEvent( player, resourceName .. ":display_all", root, advertisements, exports.integration:isPlayerAdmin( player ) ) --Send the advertisements to the client to create the GUI. end addCommandHandler( "advertisements", openAdvertisements, false, false ) addCommandHandler( "ads", openAdvertisements, false, false ) addCommandHandler( "classifieds", openAdvertisements, false, false ) addEvent( resourceName .. ":open_ads", true ) addEventHandler( resourceName .. ":open_ads", root, openAdvertisements ) Hello guys I just wanna know what I messed up in my script I'm facing this error for hours!! ERROR: advertisements\advertisements.Lua:187: call: failed to call 'mysql:select' [string "?"] ERROR: advertisements\advertisements.Lua:187: bad argument #1 to 'ipairs' (table expected, got boolean)
  5. redditing

    BindKey

    Is there a function similar to ToogleControl but with Binds? I mean, there is such a function attached to BindKey (under the "k" key), and I would like to press the "k" function just like in ToggleControl, where we clicked eg left mouse button to shoot
  6. The case looks like this, I have a variable (Let's call it Ammo) that IS TO be in the giveWeapon function (source, 22, Ammo, true) but the problem is that this Ammo variable has the script type "client" and the function is the server script type, so how can I make this variable in this function? If someone has not understood what is going on, there is still a code to simplify... -- Client side local Ammo = 60 local AmmoMarker = createMarker(0, 0, 1, "cylinder", 2.0) local WeaponMarker = createMarker(0, 0, 1, "cylinder", 2.0) addEventHandler("onClientMarkerHit", AmmoMarker, function() Ammo = Ammo + 1 end) addEventHandler("onClientMarkerHit", WeaponMarker, function() -- Here I get a weapon, the variable "Ammo" is the number of bullets end) -- Server Side --??? Problem with importing variable "Ammo"
  7. I would like to do a recoil system in such a way that a player who is hit by someone is thrown upwards simultaneously E <---- this is element X <---- point position example x x x x x E x
  8. I'm creating a server with minigames, and I'll probably use dimensions to split the maps, and my question is this. If I have a script for a given mini-game, then in every dimension does this script change in its own way ?. I give an example. I have two maps ... the first one is in the first dimension, the name is attached, the script is attached after the player teleports to him and plays with other players who are in the first dimension. But there is also a second dimension with the same script. And this is about whether there will be no undesirable consequences between these two dimensions. For example, with Equipment, at the end of the minigame and resetting it again, I will have to clear Equipment, and I do not know if I will clear the equipment of players who are in this dimension or all who are on the server in general. ; /
  9. table = {} function table.contains(table, element) for _, value in pairs(table) do if value == element then return true end end return false end function tablefind(tab,el) for index, value in pairs(tab) do if value == el then return index end end end function OnClientGuiButton() if not table.contains(BedwarsEQ, "P1") then table.insert(table, "P1") -- Insert to a table string "P1" (Player1) end if tablefind(table, "P1")==1 then -- check index, if is Item in index(1) then == true AdxItem1 = 255 -- dxDrawImage, drawing image to effect SLOT1 = SLOT1 + 1 -- type how many items is in P1 end if tablefind(table, "P1")==2 then -- if is Item in index(1) then check "if is Item in Index(2)" == true BdxItem1 = 255 --second dxDrawImage, drawing image to effect SLOT2 = SLOT2 + 1 --type how many items is in P1 end end addEvenetHandler("onClientGUIClick", button, OnClientGuiButton I will explain the problem. The problem is that when I press the button that gives me to the table "P1", it checks in which index it is. There is a problem that if I click on another button that gives me "P2", it doesn't prove that "P2" is in the table. Debugscript writes to me that the wrong first argument is given in the tableFind function, and that's strange because I checked twice and gave the right one. What's wrong with that?
  10. I would like to ask where I can find a guide on: createElement, ElementData, Shaders etc. I need it because soon I will be making radar and inventory system. It would be nice if you would share your knowledge on the things I gave
  11. setPedStat(getLocalPlayer(), 24, 650) setPedMaxHealth(getLocalPlayer()) These commands do not want to work, do not show any errors. But unfortunately it doesn't set my health at around 125 points, it just sets me to 100 HP Maybe bug? pls help
  12. سلام عليكم شباب اتمني تكونو بأحسن حال حاولت اسوي رتبة ادمن جديدة غير الرتب المعروفة في باك اب اول جيمنج حاولت اسوي رتبة Server founder وهذه اسماء الملفات اللي عدلت عليها integration --> functions_s if string.find(forumPerms, SERVERFOUNDER) then return exports.anticheat:changeProtectedElementDataEx(thePlayer, "admin_level", 8, true) end integration --> g_configs --MAXIME mysql = exports.mysql TESTER = 25 SCRIPTER = 32 LEADSCRIPTER = 79 COMMUNITYLEADER = 14 TRIALADMIN = 18 ADMIN = 17 SENIORADMIN = 64 SERVERFOUNDER = 88 -- رقم السماح بكتابة الاوامر في قاعدة البيانات LEADADMIN = 15 SUPPORTER = 30 VEHICLE_CONSULTATION_TEAM_LEADER = 39 VEHICLE_CONSULTATION_TEAM_MEMBER = 43 MAPPING_TEAM_LEADER = 44 MAPPING_TEAM_MEMBER = 28 STAFF_MEMBER = {32, 14, 18, 17, 64, 15, 30, 39, 43, 44, 28, 88} AUXILIARY_GROUPS = {32, 39, 43, 44, 28, 88} ADMIN_GROUPS = {14, 18, 17, 64, 15, 88} staffTitles = { [1] = { [0] = "Player", [1] = "Trial Administrator", [2] = "Administrator", [3] = "Senior Administrator", [4] = "Lead Administrator", [5] = "Server Managment", [6] = "-", [7] = "Vice Founder", [8] = "Server Founder", -- الفاوندر }, integration --> g_staff function isPlayerServerFounder(player) if not player or not isElement(player) or not getElementType(player) == "player" then return false end local adminLevel = getElementData(player, "admin_level") or 0 return (adminLevel >= 8) -- اللفل حق الادمن end admin-system --> Player --> s_player_commands حاولت اخلي الفاوندر بس هو اللي يسوي امر givemoney وهذا التغيير موجود في admin-system --> Player --> s_player_commands والامر اهو function giveMoney(thePlayer, commandName, target, money, ...) if exports["integration"]:isPlayerServerFounder(thePlayer) then if not (target) or not money or not (...) then outputChatBox("SYNTAX: /" .. commandName .. " [Partial Player Nick] [Money] [Reason]", thePlayer, 255, 194, 14) else local username = getPlayerName(thePlayer) local targetPlayer, targetPlayerName = exports.global:findPlayerByPartialNick(thePlayer, target) if targetPlayer then money = tonumber(money) or 0 if money and money > 500000 then outputChatBox("For security reason, you're only allowed to give a player less than $500,000 at once.", thePlayer, 255, 0, 0) return false end if not exports.global:giveMoney(targetPlayer, money) then outputChatBox("Could not give player that amount.", thePlayer, 255, 0, 0) return false end هذه التغييرات فقط اللي سويتها وما سويت شئ غيرها وهذا الخطأ اللي يظهرلي في debugscript ساعدوني رجاءً ملاحظة : SERVERFOUNDER عشان الكود دا function getAdminGroups() -- this is used in c_adminstats to correspond levels to forum usergroups return { SUPPORTER, TRIALADMIN, ADMIN, SENIORADMIN, LEADADMIN, SERVERFOUNDER } end
  13. executeSQLQuery("CREATE TABLE IF NOT EXISTS `player_stats` (`username` TEXT, `Thirst` INT, `Hunger` INT)") addEventHandler("onPlayerQuit", function (Player) local atsh = getElementData(source, "Thirst") local hungry = getElementData(source, "Hunger") local username = getAccountName(getPlayerAccount(thePlayer)) local result = executeSQLQuery("SELECT * FROM player_stats WHERE `username` = ?", username) if (#result > 1) then executeSQLQuery("UPDATE `player_stats` SET `Hunger` = ?, `Thirst` = ? WHERE `username` = ?", hungry, atsh, username) else executeSQLQuery("INSERT INTO health (username, Thirst, Hunger) VALUES (?, ?, ?)", username, atsh, hungry) end end) addEventHandler("onPlayerLogin", root, function(_, account) local accountName = getAccountName(account) local result = executeSQLQuery("SELECT * FROM player_stats WHERE username = ?", accountName) if (#result > 1) then setElementData(source, "Thirst", result[1].Thirst) setElementData(source, "Hunger", result[1].Hunger) end end) هذا عشان مود الجوع والعطش بحيث ان لو اللاعب سجل خروج وجوعه 50 لما يرجع يصير جوعه 50 ما يصير 100 من فضلكم ساعدوني ليش هذا السكريبت ما يشتغل ؟
  14. executeSQLQuery("CREATE TABLE IF NOT EXISTS `player_stats` (`username` TEXT, `Thirst` INT, `Hunger` INT)") addEventHandler("onPlayerQuit", function (Player) local atsh = getElementData(source, "Thirst") local hungry = getElementData(source, "Hunger") local username = getAccountName(getPlayerAccount(thePlayer)) local result = executeSQLQuery("SELECT * FROM player_stats WHERE `username` = ?", username) if (#result > 1) then executeSQLQuery("UPDATE `player_stats` SET `Hunger` = ?, `Thirst` = ? WHERE `username` = ?", hungry, atsh, username) else executeSQLQuery("INSERT INTO health (username, Thirst, Hunger) VALUES (?, ?, ?)", username, atsh, hungry) end end) addEventHandler("onPlayerLogin", root, function(_, account) local accountName = getAccountName(account) local result = executeSQLQuery("SELECT * FROM player_stats WHERE username = ?", accountName) if (#result > 1) then setElementData(source, "Thirst", result[1].Thirst) setElementData(source, "Hunger", result[1].Hunger) end end) it isn't working please help
  15. Hello, could someone tell me what commands I will need to make my crosshair (I mean this crosshair while holding AK-47, M4, SMG etc.)
  16. Anyone can send me a working yt mp3 converter API? Or how to create one, to play music from youtube on my server?
  17. redditing

    Inventory

    Hi, I would like to make an inventory system, could anyone give me commands to create this work? and I don't mean ready scripts or anything because I want to do it myself, I just don't know where to start here. I would like to ask for all the commands that I will definitely need.
  18. Hello, I would like to know how to set npc rotation towards the player (To NPC just look at the player) preferably using the command "getElementPosition" (client resource)
  19. I would like to know what commands I should use to create a custom radar
  20. I created a youtube player, and i want to remove the event handler, when the music ends, but i dont know how to get the song length from web browser... anyone can help?
  21. I've found six issues so far. Being alone, everything seemed fine; with players, these issues are visible. For the sake of organization and to avoid overwhelming, I'll be going through each issue (if possible), instead of throwing everything at once —unless asked otherwise—. First in the list is about client.Lua's 'outputChatBox' showing to everyone in the chatbox: I've got two scripts in this moment that are causing said inconvenient: a quick ATM system and a teleport system. The ATM is a simple marker that, when hit, gives you $500, and outputs that information. The teleports work the same way, but instead, the set the interior, position and rotation of the player, and output a message. ATM: Client: (this example's location is at LV's gas station, next to Four Dragon's Casino). atm1 = createMarker (2123.0048828125, 897.57653808594, 10.1796875, "cylinder", 1, 0, 100, 0, 170) function moneyLawn (hitPlayer, matchingDimension) if (source == atm1) and (isPedInVehicle(hitPlayer) == false) then triggerServerEvent ("givePlayerMoney", hitPlayer) outputChatBox ("#D2691E[#FF7F50INFO#D2691E]#FFFFFF: El servidor te regaló #006400$500.", 0, 0, 0, true) end end (translation: "The server gave you $500") Server: function giveToPlayer () givePlayerMoney (root, 500) end addEvent ("giveMoney", true) addEventHandler ("giveMoney", root, giveToPlayer) Because of its close relation, I'll also name another issue regarding this script. The money is being given to all players in the server, and it is being multiplied by each player. This means that is, for example, I have 3 players in my server, when any player touches the marker, each player will be given $500 x amountOfPlayers = $1500. Teleports: (I have a few other teleports, but they only change interior and position). Client: ------------------------- -- FOUR DRAGONS CASINO -- ------------------------- inFourD = createMarker (2019.76953125, 1007.0116577148, 9.7203125, "cylinder", 1, 255, 0, 0, 153) function inFourDragons (hitPlayer, matchingDimension) if (source == inFourD) and (isPedInVehicle(hitPlayer) == true) then outputChatBox("#D2691E[#FF7F50INFO#D2691E]#FFFFFF: No se permiten vehículos dentro.", 0, 0, 0, true) elseif (source == inFourD) and (isPedInVehicle(hitPlayer) == false) then outputChatBox("#D2691E[#FF7F50INFO#D2691E]#FFFFFF: Ingresaste al casino '#DD0000Four Dragons#FFFFFF'.", 0, 0, 0, true) setElementInterior (hitPlayer, 10) setElementPosition (hitPlayer, 2016.9376220703, 1017.0843505859, 996.875 ) setElementRotation (hitPlayer, 0, 0, 90) end end addEventHandler ("onClientMarkerHit", root, inFourDragons) outFourD = createMarker (2018.9376220703, 1017.0843505859, 995.875, "cylinder", 1, 255, 0, 0, 153) setElementInterior (outFourD, 10) function outFourDragons (hitPlayer, matchingDimension) if (source == outFourD) and (isPedInVehicle(hitPlayer) == true) then outputChatBox("#D2691E[#FF7F50INFO#D2691E]#FFFFFF: No se permiten vehículos dentro.", 0, 0, 0, true) elseif (source == outFourD) and (isPedInVehicle(hitPlayer) == false) then outputChatBox("#D2691E[#FF7F50INFO#D2691E]#FFFFFF: Te retiraste del casino '#DD0000Four Dragons#FFFFFF'.", 0, 0, 0, true) setElementInterior (hitPlayer, 0) setElementPosition (hitPlayer, 2021.76953125, 1007.0116577148, 10.7203125 ) setElementRotation (hitPlayer, 0, 0, 90) end end addEventHandler ("onClientMarkerHit", root, outFourDragons) [translation: (if player in veh) "No cars allowed". (if player not in veh) "You've entered/exited "Four Dragons" casino".] There is no server. This similar post, which I'm following, says that in client-side, the output is bound to be shown just for the player who triggered the event.
  22. Xwaw

    GuiEditor IMAGE

    I just want to know how you can import images into this "dxDrawImage" GUIEDITOR
  23. Sooo, how can I use (I think for you well known) dxDrawTextOnElement() (client-side function, MTA Wiki site: [click]) in server-side scripts? I tried to export, plus this code: addEventHandler("onPlayerChat", resourceRoot, function(message, type_) if(type_ == 0) then call(resourceRoot, "dxDrawTextOnElement", source, message, 1, 20, 255, 255, 255, 255, 1, "default-bold") end end) (export in meta.xml for proof): <meta> <info author="VaporZ" name="VaporZ's utility [PL]" description="(desc)" type="script" version="1.0.1"/> <script src="cars.Lua" type="server"/> <script src="bank.Lua" type="server"/> <script src="utility.Lua" type="server"/> <script src="utility-c.Lua" type="client"/> <script src="testy.Lua" type="server"/> <file src="bank/accounts.xml"/> <file src="bank/atms.xml"/> <file src="cars/saved.xml"/> <file src="cars/shops.xml"/> <export function="dxDrawTextOnElement" type="client"/> </meta> But this don't work. Any ideas? Okay, I got further, but still it's not good. Look at this one (console error): ERROR: systems\utility.Lua:108: call: failed to call 'systems:dxDrawTextOnElement'
  24. This, don't work. Idk why. Look: addEventHandler("onClientRender", resourceRoot, function() dxDrawTextOnElement(localPlayer, "P L A Y E R", 1, 20, 0, 0, 255, 255, 1, "pricedown") end) Ofcourse, I have dxDrawTextOnElement() function in my script and script is in type client.
  25. I want create a HUD with image progress bars. I think i need dxDrawImageSection, but i don't know how to use this for a progress bar. Anyone can give me a example of this progress bar with imagesection?
×
×
  • Create New...