Search the Community

Showing results for tags 'scripting'.



More search options

  • 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
  • Archive
  • Private Bugtracker

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


Gang


Location


Occupation


Interests

Found 332 results

  1. I would like to know how I could get ElementData from server to client and vice versa -- server side marker = createMarker(0, 0, 1.5, "cylinder", 2, 255, 0, 0) setElementData(marker, "Item", 5) addEvent("GetItem", true) addEventHandler("GetItem", root, function() ClientMarker = marker ItemOfClientMarker = getElementData(marker, "Item") end) addEventHandler("onMarkerHit", marker, function(hp) triggerClientEvent("Element", resourceRoot) setElementData(hp, "ItemTwo", ElementVariable+getElementData(marker, "Item")) end) -- client side function dxDrawTextOnElement(TheElement,text,height,distance,R,G,B,alpha,size,font,...) local x, y, z = getElementPosition(TheElement) local x2, y2, z2 = getCameraMatrix() local distance = distance or 20 local height = height or 1 if (isLineOfSightClear(x, y, z+2, x2, y2, z2, ...)) then local sx, sy = getScreenFromWorldPosition(x, y, z+height) if(sx) and (sy) then local distanceBetweenPoints = getDistanceBetweenPoints3D(x, y, z, x2, y2, z2) if(distanceBetweenPoints < distance) then dxDrawText(text, sx+2, sy+2, sx, sy, tocolor(R or 255, G or 255, B or 255, alpha or 255), (size or 1)-(distanceBetweenPoints / distance), font or "arial", "center", "center") end end end end setElementData(getLocalPlayer(), "ItemTwo", 0) addEvent("Element", true) addEventHandler("Element", root, function() ElementVariable = getElementData(getLocalPlayer() , "ItemTwo") end) addEventHandler("onClientRender", root, function() triggerServerEvent("GetItem", root) dxDrawTextOnElement(ClientMarker, tostring(ItemOfClientMarker), 2, 50, 255, 255, 0, 3, "arial") end) Does it have a chance to work? because that's something I imagine...
  2. -- server side cylinder = createMarker(-712.09100, 967.01917, 12.33547-1, "cylinder", 1.5, 255, 50, 0, 255) setElementData(cylinder, "BoxWithPoints", 0) function TIMER() if getElementData(cylinder, "BoxWithPoints") >= 8 then setElementData(cylinder, "BoxWithPoints", 8) else setElementData(cylinder, "BoxWithPoints", getElementData(cylinder, "BoxWithPoints")+1) end if isElementWithinMarker(source, cylinder) then triggerServerEvent("givePointsToServer", root) PointsServer = getElementData(source, "points") BoxPoints = getElementData(cylinder, "BoxWithPoints") setElementData(source, "points", PointsServer + BoxPoints) setElementData(cylinder, "BoxWithPoints", 0) end end setTimer(TIMER, 3000, 0) -- client side setElementData(getLocalPlayer(), "points", 0) addCommandHandler("ShowMyPoints", function() outputChatBox(tostring(getElementData(getLocalPlayer(), "points")), 255, 255, 0) end) addEvent("givePointsToServer", true) addEventHandler("givePointsToServer", root, function(player) local player = client setElementData(player, "points", getElementData(player, "points")) end) The problem is with the ruler where isElementWithinMarker (source, cylinder) shows me the error that argument 1 got nil, I don't know what to think about it because I checked meta.xml and server side and client side is the correct type, could someone explain why is this happening?
  3. what server-side getLocalPlayer looks like?
  4. I would like to know something about ElementData, the most about these two commands {getElementData, setElementData}, could someone help me understand these two things. For example, write a guide that would help me a lot and give me a heart ❤️
  5. So I have a question, I have a model to import but I would like this object was only visible in a specific dimension. How can I do this?
  6. I have another question if it can be done so that people from the red team can shoot other players in the head (in the sense that it would kill other players) -- server side red = createTeam("RED", 255, 0 ,0) blue = createTeam("BLUE" , 0, 255, 0) -- client side function RedTeamHeadShotDamage(player, valuedamage, bodypart) if bodypart==9 then killPed(getLocalPlayer()) else cancelEvent() end end function SetRedTeamHeadShotOnly() local redPlayers = getTeamFromName("BLUE") local teamRed = getPlayersInTeam(redPlayers) for i, v in pairs(teamRed) do addEventHandler("onClientPlayerDamage", v, RedTeamHeadShotDamage) end end SetRedTeamHeadShotOnly() Something I mean, can it work?
  7. I have a problem with this script will someone help me? function Resource() local res = getResourceFromName("ResourceTest", true) startResource(res) end addCommandHandler("res", Resource)
  8. Hola hago este mensaje para ver si alguien me puede ayudar pasandome o vendiendome un resource de creacion de bases para un servidor de DayZ de mta desde ya muchas gracias
  9. 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
  10. 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
  11. 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)
  12. 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
  13. 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
  14. 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"
  15. Map loader This is a map loader, which can let specific players download a map of choice. Maps will be generated clientside and the resource is capable of loading extreme large maps. Loading the map will be done with a speed the pc can handle. The code execution time will be reduced to circa 10 ms. Which is the frame time of a player with 100 fps. So technically when you have 100 fps you still have 98/100 fps when this resource is loading a map. But this is based on running only this resource and based on predictions/knowledge. Which you can't trust... The .map files are unloaded afterwards reading them. But the resource will keep a buffer of the processed data until no more players are using that map. This will speed up the resource when it is used for multiply players. The resource can be managed with the following functions (serverside): loadMapForTarget() Require: element player/root, string mapName Returns: boolean success, string message unloadMapForTarget() Require: element player/root, string mapName Returns: boolean success, string message getPlayerDownloadProgress() Require: element player Returns: int percentages or boolean false Version 1.0.1 or higher getPlayerMapStatus() Require: element player, string mapName Returns: string status or boolean false Status list: string "DOWNLOADING" -- Player is downloading the map. string "LOADING" -- Player is generating/loading the map string "LOADED" -- Player has loaded the map. boolean false -- Player variable is invalid or the player hasn't started downloading this map. Events(serverside): "onPlayerLoadedMap" Source: element player Parameters: string mapName int loadTime "onPlayerUnloadedMap" Source: element player Arguments: string mapName Version 1.0.1 or higher "onPlayerCancelMapDownload" Source: element player Arguments: string mapName Events(clientside): "onClientPlayerLoadedMap" Source: element localPlayer Arguments: string mapName, int loadTime "onClientPlayerUnloadedMap" Source: element localPlayer Arguments: string mapName The same information about the functions and the events can be found inside the meta.xml Element types that are supported: objects, peds, vehicles, markers and pickups If you found any bugs, which might be in there. Don't be shy and let me know, I will exterminate them. And don't forget, this resource require some rights in order to read map files from other resources: DOWNLOAD 1.0.2 For developers a quick source code preview: Server Client
  16. After I finished the first version of my character customization system i just realized its such a piece of crap, so i started writing a new version with a whole new concept. The first version worked with CJ skin and i just attached some custom head models to it. Conversely the new version is running with shaders and the skin is a custom dff. Here is a video of the head customization. The clothing is in progress yet, it takes a lot of time because i have to make custom cloth models. Hope you like it. Please don't ask for the source code, this script will never be released. Sorry.
  17. 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. ; /
  18. 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?
  19. TPF is bringing opportunities for those players who don't know scripting but wants to learn. We ( TPF staff ) offers free courses in various languages, as well as designing, for totally free. Languages we can teach you? We can teach you Lua, HTML, CSS ,PHP and MYSQL What can we teach you in designing ? Creating logos, creating banners ,posters , web design and MORE !!!(Using Photoshop cs6) Our contact: Contact DiGiTal#2028 or join our discord server : https://discord.gg/BxkW65z For more information and tutorials visit our website : https://tutoplayfun.ml/
  20. 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
  21. 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
  22. 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 من فضلكم ساعدوني ليش هذا السكريبت ما يشتغل ؟
  23. Alguém pode me ajudar criar um script de ativar vip para uma pessoa Ex: /ativar id ou nick da pessoa nome do vip, dinheiro e tempo do vip se alguém poder criar pra mim eu agradeço muito não sei muito sobre script por isso estou tentando aprender
  24. سلام عليكم شباب اتمني تكونو بأحسن حال حاولت اسوي رتبة ادمن جديدة غير الرتب المعروفة في باك اب اول جيمنج حاولت اسوي رتبة 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
  25. 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