Jump to content

FlorinSzasz

Members
  • Posts

    142
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by FlorinSzasz

  1. In schimb tu ai ceva proiecte realizate, eu lucrez la un server de prin 2019 și nici acum nu e gata :))) tot perioade de revenire și plecare și tot așa sper doar sa il termin.
  2. Hi, i want to translate some pages from wiki to Romanian language so we can have functions and events translated to our language. And i was saving a page and i got this: This user is currently blocked. The latest block log entry is provided below for reference: 17:16, 16 March 2023 Abuse filter talk contribs blocked FlorinSzasz talk contribs with an expiration time of indefinite (account creation disabled, cannot edit own talk page) (Automatically blocked by abuse filter. Description of matched rule: Spam bot detection) I want to know where i was wrong or where i did something wrong?
  3. no, u write it how big u want the radius to be for the collision sphere. also use this client side to see how big is your ColSphere so u can adjust it. setDevelopmentMode (true) addCommandHandler ("devdebug", function () showCol (not isShowCollisionsEnabled()) end)
  4. float -- e un numar real ce poate sa aiba sau nu zecimale poate sa fie sau nu negativ Asta am vrut să adaug doar. Good Work Man.
  5. Hi, did u wrote this code client side right? (in client script) Check your meta.xml to see if your script is client side or server side. If is type server then replace server with type="client" like in the example i wrote below. <meta> <script src="mecanico_c.lua" type="client" /> </meta>
  6. Good, i am glad u managed to do it ?
  7. Is the same like the one i wrote you but u replace in my example with your factions data or what data you use. I dont know what u use there so i just gave you a basic idea. I can help u but i have to see your faction script or what u use to add a player in a faction.
  8. Ați mai pățit să vă apucați de o resursă să lucrați serios la ea și după câteva zile ai scris la cod de nu mai ai chef să faci nimic decât să iei o pauză de la scripting :)) LET`S SHARE OPINIONS nu sunt singurul care a pățit asta sunt sigur, dar am vrut să fac un topic pe chestia asta.
  9. Well u can try something like this 1.) U can create a function for notification in your cop / departament resource and export the function and use it in rob resource. 2.) if u had used setElementData in your cop/ departament resource then u can do somehting like this loop through all players in your rob resource and outputChatBox only for those who have "cop data" or "departament data". addCommandHandler("rob",function(thePlayer,commandName) if thePlayer then if getElementData(thePlayer,"cop_data") == true or getElementData(thePlayer,"departament_data") == true then outputChatBox("[ROB] You are part of departament or cop team u cant rob",thePlayer,255,50,50) else local x,y,z = getElementPosition(thePlayer) for id,player in ipairs(getElementsByType("player")) do if getElementData(player,"cop_data") == true or getElementData(player,"departament_data") == true then local zone = getZoneName(x,y,z) outputChatBox("[ROB] Someone robbed a shop or ATM in "..zone.." area!!!",player,255,50,50) end end end end end)
  10. E super keep up the good work man! ? Jocul ala e legendar, ma faci curios de cum o sa fie varianta finala
  11. Well i think it should look something like this local alpha = 255 bindKey ( "aim_weapon", "both", function ( _, state ) if getPedWeaponSlot ( localPlayer ) == 6 then if ( state == "down" ) then alpha = 0 elseif ( state == "up" ) then alpha = 255 end for _, v in ipairs ( getElementsByType ( "object", root, true )) do if isElementAttached ( v ) then local id = getElementModel ( v ) if ( id == 2584 ) then setElementAlpha ( v, alpha ) end end end end end )
  12. Well if u dont use the bone_attach resource i think u should replace isElementAttachedToBone() --- with this isElementAttached() https://wiki.multitheftauto.com/wiki/IsElementAttached Also u dont need to change the dimension of the object u cant just set the alpha to 0 and it should be enough.
  13. Interesant, mult succes cu proiectul cine stie poate o sa iasa ceva cool.
  14. FlorinSzasz

    GridList

    You can use GUI gridlist then it will look like this -> https://wiki.multitheftauto.com/wiki/GuiCreateGridList If u want it to look like in the picture u showed than u need dxDrawRectangle dxDrawText Here is an example how data is inserted in gridlist from database on a basic skin saving system ->
  15. Fixed I had to increase my 2200g allocated video memory from 64 to 512mb i had no FreeVideoMemoryForMTA, i tought MTA will use as much memory as it needs i have in BIOS 64mb but any game will take as much as it needs even if limit is 64 so when i dont play a game i dont waste ram as video memory. Well at least i have 16 GB of ram so ram wont be a problem.
  16. Well the font is the right extension and is in the same folder as the scripts. Here is a picture! https://drive.google.com/file/d/1GdXLMYHo7q4_TVtT0LbQfn_6EjvjriTf/view?usp=sharing
  17. So i want to add for my own drift resource a custom font i have done this thing in other resources long time ago but now it doesnt work and i dont know why? Also the font is installed on windows. <meta> <script src="drift_C.lua" type="client"/> <script src="drift_s.lua" type="server"/> <map src="drift.map" dimension="2"></map> <file src="oceanicdrift.ttf"></file> </meta> Client Side local font = guiCreateFont("oceanicdrift.ttf",20) driftlabel = guiCreateLabel(511, 859, 320, 81,"[ DRIFT: "..drift.." X "..counter.." ]", false) guiSetFont(driftlabel,font) guiLabelSetHorizontalAlign(driftlabel, "center", false) guiLabelSetVerticalAlign(driftlabel, "center") Errors [2023-03-08 22:01:25] WARNING: drift\drift_C.lua:25: Error creating font @ 'guiCreateFont' [oceanicdrift.ttf] [2023-03-08 22:01:25] WARNING: drift\drift_C.lua:28: Bad argument @ 'guiSetFont' [Expected gui-font at argument 2, got boolean]
  18. Well i dont know if this might help you but if u mean something like this i can give u some ideas i think, also i used dxDrawImage() dxDrawRectangle() https://drive.google.com/drive/folders/1vF7AlP8S1ggWoi7DZa60vZRxWRLnzDlQ?usp=sharing
  19. Got it fixed! Somehow i replaced your image draw with a button for test! Also dont forget to put your picture back on client side part. Server side function desligarGeradorS( player, generatorID ) local id = getElementData(markers[generatorID], "generatorID") if id == generatorID then setElementData(markers[generatorID], "state", false) end end addEvent( "desligarGerador", true ) addEventHandler( "desligarGerador", root, desligarGeradorS ) function ligarGeradorS( player, generatorID ) local id = getElementData(markers[generatorID], "generatorID") if id == generatorID then setElementData(markers[generatorID], "state", true) end end addEvent( "ligarGerador", true ) addEventHandler( "ligarGerador", root, ligarGeradorS ) Client Side local data = {} -- or u name it the way u want local screenW, screenH = guiGetScreenSize() function AbrirGeradorM( generatorID, currentFuelLevel, fuelLevel, maxFuelLevel, state, x, y, z ) data["id"] = generatorID data["currentFuelLevel"] = currentFuelLevel data["fuelLevel"] = fuelLevel data["maxFuelLevel"] = maxFuelLevel data["state"] = state data["x"] = x data["y"] = y data["z"] = z setElementData( localPlayer, "AbrirGerador", true ) end addEvent( "AbrirGerador", true ) addEventHandler( "AbrirGerador", root, AbrirGeradorM ) addEventHandler("onClientRender", root, function() if getElementData( localPlayer, "AbrirGerador" ) == true then -- if a == 0 then -- a = 1 local generatorID = data["id"] local currentFuelLevel = data["currentFuelLevel"] local fuelLevel = data["fuelLevel"] local maxFuelLevel = data["maxFuelLevel"] if fuelLevel then -- showCursor(true,true) -- test = guiCreateButton(310, 359, 98, 50, "test", false) -- addEventHandler("onClientGUIClick",test,aaa,false) -- replace back with your picture i took here one random for testing dxDrawImage(screenW * 0.4103, screenH * 0.4401, screenW * 0.0235, screenH * 0.2734, "cube.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawText("Combustivel:", 412, 459, 548, 491, tocolor(255, 255, 255, 255), 1.00, "default", "right", "bottom", false, false, false, false, false) --progress gasolina local imageWidth = screenW * 0.0147 local maxHeight = screenH * 0.2617 local imageHeight = maxHeight * fuelLevel / maxFuelLevel dxDrawImage(screenW * 0.4147, screenH * 0.4453 + maxHeight - imageHeight, imageWidth, imageHeight, "cube.png", 0, 0, 0, tocolor(195, 181, 32, 206), false) if data["state"] == true then r,g,b = 74, 255, 80 dxDrawText("Desligar", screenW * 0.3206, screenH * 0.6602, screenW * 0.3963, screenH * 0.7018, tocolor(255, 255, 255, 255), 1.00, "arial", "center", "center", false, false, false, false, false) dxDrawImage(screenW * 0.3132, screenH * 0.6471, screenW * 0.0941, screenH * 0.0664, "cube.png", 0, 0, 0, tocolor(r, g, b, 217), false) elseif data["state"] == false then r,g,b = 147, 74, 60 dxDrawText("Ligar", screenW * 0.3206, screenH * 0.6602, screenW * 0.3963, screenH * 0.7018, tocolor(255, 255, 255, 255), 1.00, "arial", "center", "center", false, false, false, false, false) dxDrawImage(screenW * 0.3132, screenH * 0.6471, screenW * 0.0941, screenH * 0.0664, "cube.png", 0, 0, 0, tocolor(r, g, b, 217), false) end end end end) addEventHandler( "onClientClick", root, function (button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedWorld) if button == "left" then if state == "down" then if getElementData( localPlayer, "AbrirGerador" ) == true then if isCursorOnElement(screenW * 0.3206, screenH * 0.6602, screenW * 0.3963, screenH * 0.7018) then local state = data["state"] local x = data["x"] local y = data["y"] local z = data["z"] local id = data["id"] if data["id"] and data["state"] == true then triggerServerEvent( "desligarGerador", resourceRoot, localPlayer, data["id"] ) elseif data["id"] and data["state"] == false then playSound3D( "start.mp3", x, y, z ) triggerServerEvent( "ligarGerador", resourceRoot, localPlayer, data["id"] ) end end end end end end)
  20. Server side u have to do this! local markers = {} local geradores = { {id = 1, fuelLevel = 50, maxFuelLevel = 200, state = false, position = {2397.336, -2472.24, 12.8}}, {id = 2, fuelLevel = 50, maxFuelLevel = 200, state = false, position = {150, 250, 10}}, {id = 3, fuelLevel = 50, maxFuelLevel = 200, state = false, position = {200, 300, 10}}, } -- Crie os marcadores para cada gerador na tabela for key, gerador in ipairs(geradores) do local marker = createMarker(gerador.position[1], gerador.position[2], gerador.position[3], "cylinder", 1, 255, 0, 0, 20) local markers[key] = marker setElementData(markers[key], "generatorID", gerador.id) setElementData(markers[key], "fuelLevel", gerador.fuelLevel) setElementData(markers[key], "maxFuelLevel", gerador.maxFuelLevel) setElementData(markers[key], "state", gerador.state) end addEventHandler("onPlayerMarkerHit", root, function (markerHit, matchingDimension) for k,v in ipairs(markers) do if markerHit == markers[k] then local generatorID = getElementData(markers[k], "generatorID") local fuelLevel = getElementData(markers[k], "fuelLevel") local maxFuelLevel = getElementData(markers[k], "maxFuelLevel") local state = getElementData(markers[k], "state") local x,y,z = getElementPosition( markers[k] ) triggerClientEvent(source, "AbrirGerador", root, generatorID, currentFuelLevel, fuelLevel, maxFuelLevel, state, x, y, z ) end end end) addEventHandler("onPlayerMarkerLeave", root, function (markerLeft, matchingDimension) for k,v in ipairs(markers) do if markerLeft == markers[k] then local generatorID = getElementData(markers[k], "generatorID") triggerClientEvent(source, "fecharGerador", root, generatorID) end end end) function desligarGeradorS( player, generatorID ) for i, marker in ipairs(markers) do local id = getElementData(markers[i], "generatorID") if id == generatorID then setElementData(markers[i], "state", false) end end end addEvent( "desligarGerador", true ) addEventHandler( "desligarGerador", root, desligarGeradorS ) function ligarGeradorS( player, generatorID ) for i, marker in ipairs(markers) do local id = getElementData(markers[i], "generatorID") if id == generatorID then setElementData(markers[i], "state", true) end end end addEvent( "ligarGerador", true ) addEventHandler( "ligarGerador", root, ligarGeradorS ) I just edited your code so you wont have a bug with the markers because u made the marker hit event to work for any marker u hit not only those 3 markers! Also client side u can do this here! local data = {} -- or u name it the way u want function AbrirGeradorM( generatorID, currentFuelLevel, fuelLevel, maxFuelLevel, state, x, y, z ) data["id"] = generatorID data["currentFuelLevel"] = currentFuelLevel data["fuelLevel"] = fuelLevel data["maxFuelLevel"] = maxFuelLevel data["state"] = state data["x"] = x data["y"] = y data["z"] = z setElementData( localPlayer, "AbrirGerador", true ) end addEvent( "AbrirGerador", true ) addEventHandler( "AbrirGerador", root, AbrirGeradorM ) I think this should fix the problem. And on client side u can use data from the table all over the script u dont need to setElementData to localPlayer
  21. eu zic ca e cel mai bine sa pui ce ai in fisierul s_gas_station.lua aici sa vedem exact care e problema ca altfel nu am nici macar un pic de context fata de ce ai acolo si nu stiu unde iti este buba in fisier.
  22. pff trebuie sa ai prin script un fel de functie dbConnect si la aia trebuie sa fie o variabila gen local connection = dbConnect("sqlite","gas_stations.db") -- sau ceva asemanator daca nu vad script-ul nu imi pot da seama -- si tu in dbQuery trebuie sa ai ceva asa sau asemanator local query = dbQuery(connection,"") -- intre ghilimele se va gasi ce cuprinde interogarea din script-ul pe care il folosesti -- nu stiu ce date cauta interogarea dar presupun ca sunt niste coordonate sau asa .
  23. So here is the code Server Side local connection = dbConnect("sqlite","skins.db") -- we create the db our is called skins.db u can call it any way u want if connection then -- check for connection outputDebugString("Connection with SKIN database was established") else outputDebugString("Connection with SKIN database was not established somehting went wrong") end function db_table() -- create the table in db dbExec(connection,"CREATE TABLE IF NOT EXISTS skins (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,username TEXT,skin INTEGER)") end addEventHandler("onResourceStart",getResourceRootElement(),db_table) -- skin cost -- local cost = 1000 ---- ----- addCommandHandler("buyskin",function(thePlayer,commandName,model) if thePlayer then -- check for player local acc = getPlayerAccount( thePlayer ) -- get his account name local acc_name = getAccountName( acc ) -- get his account name if model and tonumber(model) >= 0 and tonumber(model) <= 84 then -- i choose to allow to buy the skins from model 0 to 84 u can change it the way u want also if u dont provide a model u get an message local q = dbQuery(connection,"SELECT username,skin FROM skins WHERE username=? AND skin=? LIMIT 1",tostring(acc_name),tonumber(model)) -- we select the data from to see if we have this skin already local rezult = dbPoll(q,-1) if #rezult > 0 then --- if we have rezult then we loop throgh rezult and check for key,value in ipairs(rezult) do -- loop if tonumber(value.skin) == tonumber(model) then -- check if we have this skin outputChatBox("[SKIN_SYSTEM] You have this skin already",thePlayer) end end else if getPlayerMoney(thePlayer) >= cost then dbExec(connection,"INSERT INTO skins (username,skin) VALUES (?,?)",tostring(acc_name),tonumber(model)) -- if player has more money or enough then we buy the skin and insert the data in db and take his money takePlayerMoney(thePlayer,cost) outputChatBox("[SKIN SYSTEM] You bought a new skin!",thePlayer,104,255,104) elseif getPlayerMoney(thePlayer) < cost then outputChatBox("[SKIN SYSTEM] You don have enough money to buy the skin",thePlayer) end end else outputChatBox("[SKIN_SYSTEM] Please provide the model u want to buy!",thePlayer) -- provide model message end end end) function myskins(thePlayer,commandName) if thePlayer then --- again check for player local acc = getPlayerAccount( thePlayer ) local acc_name = getAccountName( acc ) local q = dbQuery(connection,"SELECT username,skin FROM skins WHERE username=?",tostring(acc_name)) -- we select the data from db, by data i mean his skins and then send the table on client local rezult = dbPoll(q,-1) if #rezult > 0 then for key,value in ipairs(rezult) do triggerClientEvent(thePlayer,"skin_inventory",thePlayer,rezult) -- if we have rezult then we call client event skin_inventory!! end end end end addCommandHandler("myskins",myskins,false,false) Client Side function centerWindow (center_window) --- a function to put the window in the center of the screen local screenW, screenH = guiGetScreenSize() local windowW, windowH = guiGetSize(center_window, false) local x, y = (screenW - windowW) /2,(screenH - windowH) /2 return guiSetPosition(center_window, x, y, false) end addEvent("skin_inventory",true) -- we add the skin_inventory event client side so we can call it from server side function skin_inventory_gui(rezult) -- here we have our table sent from server to client skin_list = guiCreateWindow(329, 246, 465, 381, "MY SKINS", false) centerWindow(skin_list) guiWindowSetMovable(skin_list, false) guiWindowSetSizable(skin_list, false) skins = guiCreateGridList(9, 20, 376, 351, false, skin_list) guiGridListAddColumn(skins, "Description", 0.5) guiGridListAddColumn(skins, "Model/Skin Owned", 0.5) close = guiCreateButton(389, 20, 66, 21, "X", false, skin_list) guiSetProperty(close, "NormalTextColour", "FFAAAAAA") showCursor(true) for key, value in ipairs(rezult) do -- we loop through table local row = guiGridListAddRow(skins) -- so for each result we get we insert a row with guiGridListSetItemText (skins, row, 1, "Skin Model ->", false, true) -- this value guiGridListSetItemText (skins, row, 2, value.skin, false, true) --- and skin model / id end addEventHandler ( "onClientGUIClick", close, closeinventory,false) -- event for close function and button!!! end addEventHandler("skin_inventory",root,skin_inventory_gui) closeinventory = function(button,state) --- function to close the gui window if (button == "left") and (state == "up") then showCursor (false) guiSetVisible(skin_list,false) end end So this is enough to get you started!
  24. Well u have a gamemode who needs a Mysql server to run if i am not wrong so you need to install a mysql server or u can install XAMPP in your computer.
  25. Well first of all u need a place so save data u can use setAccountData or dbConnect() dbExec() if u want to go for setAccountData u dont need the others but if u know how to use a database than u can go for the other ones. I will show u later an example if u need i am at work now
×
×
  • Create New...