Jump to content

CobbTheWarriorsRPG

Members
  • Posts

    111
  • Joined

  • Last visited

Everything posted by CobbTheWarriorsRPG

  1. Wow, i understand A LOT of things now!, Really thanks @Investor!!!!, and what do you think about my way to trigger and save the Seller user? i dont know if it is the best way to sync the players. i do it attaching the seller to a marker and later ask if isElementAttachedTo, i dont know how to sync 2 or more users. For example, in the server event "onPlayerDamage" i got 2 users, the source(the guy who gets the damage) and the attacker, i want to know if is a best way to make the way to sync seller and buyer or my way is a good idea !, Thank you very much for the explanation, really really appreciate it!
  2. Hello everyone, I am trying to design a script for selling drugs, I have 6 types of drugs, which have names in Spanish, they are saved through the setElementData and setAccountData of each user. To make my drug sales system, the buyer attaches himself to the marker, so he can reference it later when calling other events and get all his information, then when the buyer hits the marker he obtains the information of the seller through the getElementData of the marker and the buyer obtain the seller who is attached to the marker. At the moment I only made the sale of a drug, the "Bareta" (Weed), it works the first time you make a purchase, then when you click again the following error appears on lines 26-31, which is where you get the numbers from the buyer's panel, and you can not sell more drugs. https://i.imgur.com/YNAguMT.jpg I'm a bit overwhelmed, it's my first script that manages to synchronize two users. With all my heart, I would really appreciate the help, thank you very much! Heres the scripts --setup_c.lua (client: when the seller sets the price and the ammount to sell whit the command /venderdroga (selldrug) and stop whit /pararventa) UIEditor = { label = {} } addEventHandler("onClientResourceStart", resourceRoot, function() sellDrugsWin = guiCreateWindow(527, 250, 339, 322, "Vender Drogas", false) guiWindowSetSizable(sellDrugsWin, false) wLabel = guiCreateLabel(27, 54, 63, 17, "Bareta:", false, sellDrugsWin) GUIEditor.label[1] = guiCreateLabel(92, 26, 74, 18, "Cantidad", false, sellDrugsWin) GUIEditor.label[2] = guiCreateLabel(198, 26, 80, 16, "Precio/unidad", false, sellDrugsWin) bQty = guiCreateEdit(90, 54, 72, 17, "0", false, sellDrugsWin) bPrice = guiCreateEdit(196, 54, 72, 17, "0", false, sellDrugsWin) GUIEditor.label[3] = guiCreateLabel(27, 86, 63, 17, "Popper:", false, sellDrugsWin) popperQty = guiCreateEdit(90, 86, 72, 17, "0", false, sellDrugsWin) popperPrice = guiCreateEdit(196, 86, 72, 17, "0", false, sellDrugsWin) GUIEditor.label[4] = guiCreateLabel(27, 118, 63, 17, "Perica:", false, sellDrugsWin) pericaQty = guiCreateEdit(90, 118, 72, 17, "0", false, sellDrugsWin) pericaPrice = guiCreateEdit(196, 118, 72, 17, "0", false, sellDrugsWin) GUIEditor.label[5] = guiCreateLabel(27, 149, 63, 17, "LSD:", false, sellDrugsWin) lsdQty = guiCreateEdit(90, 149, 72, 17, "0", false, sellDrugsWin) lsdPrice = guiCreateEdit(196, 149, 72, 17, "0", false, sellDrugsWin) GUIEditor.label[6] = guiCreateLabel(27, 181, 63, 17, "Bazuko:", false, sellDrugsWin) GUIEditor.label[7] = guiCreateLabel(27, 213, 63, 17, "Heroina:", false, sellDrugsWin) bazukoQty = guiCreateEdit(90, 181, 72, 17, "0", false, sellDrugsWin) heroinaQty = guiCreateEdit(90, 213, 72, 17, "0", false, sellDrugsWin) heroinaPrice = guiCreateEdit(196, 213, 72, 17, "0", false, sellDrugsWin) bazukoPrice = guiCreateEdit(196, 181, 72, 17, "0", false, sellDrugsWin) sellBtn = guiCreateButton(39, 264, 123, 32, "Vender", false, sellDrugsWin) cancelBtn = guiCreateButton(196, 264, 123, 32, "Cerrar", false, sellDrugsWin) guiSetVisible(sellDrugsWin, false) addEventHandler ( "onClientGUIClick", cancelBtn, closeWindow, false ) addEventHandler ( "onClientGUIClick", sellBtn, startSell, false ) end ) function startSell() dbaretaPrice = tonumber(guiGetText(bPrice)) dpopperPrice = tonumber(guiGetText(popperPrice)) dpericaPrice = tonumber(guiGetText(pericaPrice)) dlsdPrice = tonumber(guiGetText(lsdPrice)) dbazukoPrice = tonumber(guiGetText(bazukoPrice)) dheroinaPrice = tonumber(guiGetText(heroinaPrice)) dbaretaQty = tonumber(guiGetText(bQty)) dpopperQty = tonumber(guiGetText(popperQty)) dpericaQty = tonumber(guiGetText(pericaQty)) dlsdQty = tonumber(guiGetText(lsdQty)) dbazukoQty = tonumber(guiGetText(bazukoQty)) dheroinaQty = tonumber(guiGetText(heroinaQty)) if type(dbaretaPrice) =="number" and type(dpopperPrice) =="number" and type(dpericaPrice) =="number" and type(dlsdPrice) =="number" and type(dbazukoPrice) =="number" and type(dheroinaPrice) =="number" and type(dbaretaQty) =="number" and type(dpopperQty) =="number" and type(dpericaQty) =="number" and type(dlsdQty) =="number" and type(dbazukoQty) =="number" and type(dheroinaQty) =="number" then if dbaretaPrice < 0 or dpopperPrice < 0 or dpericaPrice < 0 or dlsdPrice < 0 or dbazukoPrice < 0 or dheroinaPrice < 0 or dbaretaQty < 0 or dpopperQty < 0 or dpericaQty < 0 or dlsdQty < 0 or dbazukoQty < 0 or dheroinaQty < 0 then return outputChatBox("Ingrese solo numeros positivos") else setElementData(getLocalPlayer(), "bPrice",dbaretaPrice) setElementData(getLocalPlayer(), "popperPrice",dpopperPrice) setElementData(getLocalPlayer(), "pericaPrice",dpericaPrice) setElementData(getLocalPlayer(), "lsdPrice",dlsdPrice) setElementData(getLocalPlayer(), "bazukoPrice",dbazukoPrice) setElementData(getLocalPlayer(), "heroinaPrice",dheroinaPrice) setElementData(getLocalPlayer(), "bQty",dbaretaQty) setElementData(getLocalPlayer(), "popperQty",dpopperQty) setElementData(getLocalPlayer(), "pericaQty",dpericaQty) setElementData(getLocalPlayer(), "lsdQty",dlsdQty) setElementData(getLocalPlayer(), "bazukoQty",dbazukoQty) setElementData(getLocalPlayer(), "heroinaQty",dheroinaQty) setElementData(getLocalPlayer(),"sellingDrugs", true) guiSetVisible(sellDrugsWin,false) triggerServerEvent("startSellingDrugs",getLocalPlayer()) end else return outputChatBox("Ingrese solo numeros") end end function stopSell() showCursor(false) setElementData(getLocalPlayer(),"sellingDrugs", false) triggerServerEvent("stopSellingDrugs",getLocalPlayer()) end addCommandHandler("pararventa", stopSell ) function venderDroga( localPlayer ) if guiGetVisible(sellDrugsWin) == false then guiSetVisible ( sellDrugsWin, true) showCursor ( true ) end end addCommandHandler("venderdroga", venderDroga ) function closeWindow(localPlayer) guiSetVisible(sellDrugsWin, false) showCursor(false) end --buy_c.lua (client triggers when the buyer hits the marker handled and created in the serverside) GUIEditor = { label = {}, memo = {} } addEventHandler("onClientResourceStart", resourceRoot, function() buyWin = guiCreateWindow(567, 316, 226, 289, "Comprar Drogas", false) guiWindowSetSizable(buyWin, false) baretaLabel = guiCreateLabel(24, 36, 63, 15, "Bareta (0)$", false, buyWin) popperLabel = guiCreateLabel(24, 65, 77, 16, "Popper (0)$", false, buyWin) pericaLabel = guiCreateLabel(24, 95, 63, 15, "Perica (0)$", false, buyWin) lsdLabel = guiCreateLabel(24, 126, 63, 15, "Lsd (0)$", false, buyWin) bazukoLabel = guiCreateLabel(24, 159, 69, 15, "Bazuko (0)$", false, buyWin) heroinaLabel = guiCreateLabel(24, 191, 75, 15, "Heroina (0)$", false, buyWin) baretaEdit = guiCreateEdit(120, 36, 52, 19, "0", false, buyWin) popperEdit = guiCreateEdit(120, 62, 52, 19, "0", false, buyWin) pericaEdit = guiCreateEdit(120, 91, 52, 19, "0", false, buyWin) lsdEdit = guiCreateEdit(120, 122, 52, 19, "0", false, buyWin) bazukoEdit = guiCreateEdit(120, 155, 52, 19, "0", false, buyWin) heroinaEdit = guiCreateEdit(120, 187, 52, 19, "0", false, buyWin) buyBtn = guiCreateButton(21, 246, 82, 27, "Comprar", false, buyWin) closeBuyBtn = guiCreateButton(120, 246, 82, 27, "Cerrar", false, buyWin) totalLabel = guiCreateLabel(59, 216, 99, 15, "Total: 0 $", false, buyWin) guiSetVisible(buyWin,false) addEventHandler ( "onClientGUIClick", closeBuyBtn, closeBuyWindow, false ) addEventHandler ( "onClientGUIClick", buyBtn, buyDrugs, false ) end ) function buyDrugs() baretaEdit = tonumber(guiGetText(baretaEdit)) popperEdit = tonumber(guiGetText(popperEdit)) pericaEdit = tonumber(guiGetText(pericaEdit)) lsdEdit = tonumber(guiGetText(lsdEdit)) bazukoEdit = tonumber(guiGetText(bazukoEdit)) heroinaEdit = tonumber(guiGetText(heroinaEdit)) if type(baretaEdit) =="number" and type(baretaEdit) =="number" and type(baretaEdit) =="number" and type(baretaEdit) =="number" and type(baretaEdit) =="number" and type(baretaEdit) =="number" then if baretaEdit < 0 or popperEdit < 0 or pericaEdit < 0 or lsdEdit < 0 or bazukoEdit < 0 or heroinaEdit < 0 then return outputChatbox("Ingrese solo numeros positivos") else setElementData(getLocalPlayer(),"baretaBuyQty", baretaEdit) setElementData(getLocalPlayer(),"popperBuyQty", popperEdit) setElementData(getLocalPlayer(),"pericaBuyQty", pericaEdit) setElementData(getLocalPlayer(),"lsdBuyQty", lsdEdit) setElementData(getLocalPlayer(),"bazukoBuyQty", bazukoEdit) setElementData(getLocalPlayer(),"heroinaBuyQty", heroinaEdit) triggerServerEvent("sBuyDrugs",getLocalPlayer()) end else return outputChatBox("Ingrese solo numeros") end end function closeBuyWindow() if guiGetVisible(buyWin) then guiSetVisible(buyWin,false) showCursor(false) end end function clientOpenBuyWin(seller) local sellerBPrice = tonumber(getElementData(seller,"bPrice")) local sellerPopperPrice = tonumber(getElementData(seller,"popperPrice")) local sellerPericaPrice = tonumber(getElementData(seller,"pericaPrice")) local sellerLsdPrice = tonumber(getElementData(seller,"lsdPrice")) local sellerBazukoPrice = tonumber(getElementData(seller,"bazukoPrice")) local sellerHeroinaPrice = tonumber(getElementData(seller,"heroinaPrice")) guiSetVisible(buyWin, true) showCursor(true) guiSetText(baretaLabel, "Bareta ("..tostring(sellerBPrice)..")$") guiSetText(popperLabel, "Popper ("..tostring(sellerPopperPrice)..")$") guiSetText(pericaLabel, "Perica ("..tostring(sellerPericaPrice)..")$") guiSetText(lsdLabel, "Lsd ("..tostring(sellerLsdPrice)..")$") guiSetText(bazukoLabel, "Bazuko ("..tostring(sellerBazukoPrice)..")$") guiSetText(heroinaLabel, "Heroina ("..tostring(sellerHeroinaPrice)..")$") setElementData(localPlayer,"seller",seller) end addEvent( "onServerMarkerHit", true ) addEventHandler( "onServerMarkerHit", localPlayer, clientOpenBuyWin ) --server.lua function serverStartSellingDrugs() local x, y, z = getElementPosition ( client) local marker = createMarker ( x, y, z-1, "cylinder", 1.5, 255, 255, 0, 170 ) setElementData(marker, "owner", client) attachElementToElement( client, marker) end addEvent( "startSellingDrugs", true ) addEventHandler("startSellingDrugs", root , serverStartSellingDrugs) function serverStopSellingDrugs() local attached = getElementAttachedTo ( client ) if ( attached ) then destroyElement(attached) end end addEvent( "stopSellingDrugs", true ) addEventHandler("stopSellingDrugs", root , serverStopSellingDrugs) function buyerMarkerHit( hitElement, matchingDimension ) -- define MarkerHit function for the handler if getElementData(source, "owner") ~= nil and getElementData(source,"owner") ~= false then if getPlayerName(hitElement) ~= getPlayerName( getElementData(source, "owner")) then triggerClientEvent ( hitElement, "onServerMarkerHit", hitElement, getElementData(source,"owner") ) end end end addEventHandler( "onMarkerHit", root, buyerMarkerHit ) function serverBuyDrugs() local sellerPointer = getElementData(client, "seller") if tonumber(getElementData(sellerPointer, "bQty")) >= tonumber(getElementData(client,"baretaBuyQty")) then setElementData(sellerPointer,"bQty", tonumber(getElementData(sellerPointer,"bQty"))-tonumber(getElementData(client,"baretaBuyQty"))) setElementData(client,"Weed",tonumber(getElementData(client,"Weed"))+tonumber(getElementData(client,"baretaBuyQty"))) givePlayerMoney(sellerPointer, tonumber(getElementData(sellerPointer,"bPrice"))*tonumber(getElementData(client,"baretaBuyQty"))) setPlayerMoney(client, getPlayerMoney(client) - tonumber(getElementData(sellerPointer,"bPrice"))*tonumber(getElementData(client,"baretaBuyQty"))) else return outputChatBox("El usuario no posee tal cantidad de bareta",client) end end addEvent( "sBuyDrugs", true ) addEventHandler("sBuyDrugs", root , serverBuyDrugs) many thanks!
  3. Good morning everyone, I'm trying to make a script to sell drugs, the drugs are stored in the account Data and elements Data of each player, I want to define a marker that when the other user (Buyer) enters the marker, he opens the window of purchases and see the prices that the seller previously defined, I do not know how to synchronize this interaction with two users, buyer and seller, many thanks! Server Side: function drug( ) local x, y, z = getElementPosition ( source ) marker = createMarker ( x, y, z-1, "cylinder", 1.5, 255, 255, 0, 170 ) end addEvent( "onClick", true ) addEventHandler("onClick", root , drug) function destroyMarker( ) if isElement( marker) then destroyElement(marker) end end addEvent( "onClick2", true ) addEventHandler("onClick2", root , destroyMarker) function asignarValoresCripa(source, valorCripa) setAccountData( source,"valorCripa", valorCripa) end addEvent( "addCripaCost", true ) addEventHandler("addCripaCost", root , asignarValoresCripa) function darValoresCripa (p) getAccountData(p,"valorCripa") end addEvent( "valorCripa", true ) addEventHandler("valorCripa", root , darValoresCripa) Client GUIEditor = { label = {} } addEventHandler("onClientResourceStart", resourceRoot, function() ventanaCompra = guiCreateWindow(222, 119, 395, 349, "Comprar Drogas a usuario", false) guiWindowSetSizable(ventanaCompra, false) cerrarCompra = guiCreateButton(46, 293, 93, 46, "Cerrar", false, ventanaCompra) cantidadCripa = guiCreateEdit(248, 46, 43, 31, "", false, ventanaCompra) cantidadRuedas = guiCreateEdit(248, 87, 43, 31, "", false, ventanaCompra) cantidadPerica = guiCreateEdit(248, 128, 43, 31, "", false, ventanaCompra) cantidadLsd = guiCreateEdit(248, 169, 43, 31, "", false, ventanaCompra) cantidadHeroina = guiCreateEdit(248, 210, 43, 31, "", false, ventanaCompra) cantidadRivotril = guiCreateEdit(248, 251, 43, 31, "", false, ventanaCompra) precioCripa = guiCreateEdit(149, 46, 86, 31, "", false, ventanaCompra) guiEditSetReadOnly(precioCripa, true) precioRuedas = guiCreateEdit(149, 87, 86, 31, "", false, ventanaCompra) guiEditSetReadOnly(precioRuedas, true) precioPerica = guiCreateEdit(149, 128, 86, 31, "", false, ventanaCompra) guiEditSetReadOnly(precioPerica, true) precioLsd = guiCreateEdit(149, 169, 86, 31, "", false, ventanaCompra) guiEditSetReadOnly(precioLsd, true) precioHeroina = guiCreateEdit(149, 210, 86, 31, "", false, ventanaCompra) guiEditSetReadOnly(precioHeroina, true) precioRivotril = guiCreateEdit(149, 251, 86, 31, "", false, ventanaCompra) guiEditSetReadOnly(precioRivotril, true) GUIEditor.label[1] = guiCreateLabel(15, 47, 124, 236, "Cripa Precio\n\n\nRuedas Precio\n\n\nPerica Precio\n\n\nLsd Precio\n\n\nHeroina Precio\n\n\nRivotril Precio", false, ventanaCompra) GUIEditor.label[2] = guiCreateLabel(241, 23, 50, 13, "Cantidad", false, ventanaCompra) comprarCripa = guiCreateButton(310, 46, 68, 31, "Comprar", false, ventanaCompra) comprarRuedas = guiCreateButton(310, 87, 68, 31, "Comprar", false, ventanaCompra) comprarPerica = guiCreateButton(310, 128, 68, 31, "Comprar", false, ventanaCompra) comprarLsd = guiCreateButton(310, 169, 68, 31, "Comprar", false, ventanaCompra) comprarHeroina = guiCreateButton(310, 210, 68, 31, "Comprar", false, ventanaCompra) comprarRivotril = guiCreateButton(310, 251, 68, 31, "Comprar", false, ventanaCompra) --ventana Sell panelSell = guiCreateWindow(251, 207, 294, 319, "Venta de drogas", false) guiWindowSetSizable(panelSell, false) priceWeed = guiCreateEdit(147, 30, 53, 29, "", false, panelSell) priceRuedas = guiCreateEdit(147, 59, 53, 29, "", false, panelSell) pricePerica = guiCreateEdit(147, 88, 53, 29, "", false, panelSell) priceLsd = guiCreateEdit(147, 117, 53, 29, "", false, panelSell) priceEsteroides = guiCreateEdit(147, 146, 53, 29, "", false, panelSell) priceRivotril = guiCreateEdit(147, 175, 53, 29, "", false, panelSell) stopSell = guiCreateButton(29, 234, 100, 48, "Parar de vender", false, panelSell) GUIEditor.label[1] = guiCreateLabel(29, 40, 94, 16, "Cripa", false, panelSell) GUIEditor.label[2] = guiCreateLabel(29, 66, 94, 16, "Ruedas", false, panelSell) GUIEditor.label[3] = guiCreateLabel(29, 92, 94, 16, "Perica", false, panelSell) GUIEditor.label[4] = guiCreateLabel(29, 120, 94, 16, "LSD", false, panelSell) GUIEditor.label[5] = guiCreateLabel(29, 149, 94, 16, "Esteroides", false, panelSell) GUIEditor.label[6] = guiCreateLabel(29, 178, 94, 16, "Rivortril", false, panelSell) GUIEditor.label[7] = guiCreateLabel(145, 210, 45, 14, "Precios", false, panelSell) guardaCripa = guiCreateButton(219, 33, 65, 26, "Guardar", false, panelSell) guardaRuedas = guiCreateButton(220, 62, 64, 26, "Guardar", false, panelSell) guardaPerica = guiCreateButton(220, 91, 64, 26, "Guardar", false, panelSell) guardaLsd = guiCreateButton(220, 120, 60, 26, "Guardar", false, panelSell) guardaEsteroides = guiCreateButton(220, 149, 60, 26, "Guardar", false, panelSell) guardaRivotril = guiCreateButton(220, 178, 60, 26, "Guardar", false, panelSell) guiSetVisible ( panelSell, false) guiSetVisible ( ventanaCompra, false) addEventHandler ( "onClientGUIClick", cerrarCompra, cerrarCompraEvent, false ) addEventHandler ( "onClientGUIClick", stopSell, cerrarVentaEvent, false ) addEventHandler ( "onClientGUIClick", guardaCripa, addPrecioCripa, false ) end ) --Window Shop --Funciones para vendedor function venderDroga( localPlayer ) triggerServerEvent ( "onClick", getLocalPlayer() ) guiSetVisible ( panelSell, true) showCursor ( true ) end addCommandHandler("venderdroga", venderDroga ) function addPrecioCripa (localPlayer) local valorCripa = guiGetText ( priceWeed ) if ( tonumber(valorCripa) > 0 ) then triggerServerEvent ( "addCripaCost", getLocalPlayer(), source ) outputChatBox("has puesto un precio a la cripa de "..valorCripa.."") else outputChatBox("Coloca un valor mayor a 0") end end function cerrarVentaEvent ( localPlayer ) triggerServerEvent ( "onClick2", getLocalPlayer() ) guiSetVisible ( panelSell, false) showCursor ( false ) end --Funciones comprador function MarkerHit ( p, matchingDimension ) local priceCripa = triggerServerEvent ( "valorCripa", getLocalPlayer() ) if p == localPlayer then guiSetVisible ( ventanaCompra, true) showCursor ( true ) guiSetText(precioCripa, "..priceCripa..") end end addEventHandler ( "onClientMarkerHit", getRootElement(marker), MarkerHit ) function cerrarCompraEvent ( localPlayer ) guiSetVisible ( ventanaCompra, false) showCursor ( false ) end
  4. @Callum, it happends in FreeRoam, and i change my skin in the Admin panel, some help? thanks!
  5. I think it doesnt work because the markers got created when you click on a gui and it trigger to server see the code function serverStartBank(p,character) model = getElementModel(p) setTimer( function() fadeCamera ( p, false, 1.0, 0, 0, 0 ) setTimer ( fadeCameraDelayed, 1000, 1, p ) setTimer( function() setElementPosition(p, 388.89999389648, 173.5, 1008.4000244141) setElementModel ( p, character ) setElementDimension(p, 200) setElementInterior(p, 3) doorBank = createObject(2951, 371.70001220703, 166.5, 1007.4000244141) setElementInterior(doorBank, 3) setElementDimension(doorBank, 200) bankCol = createColCuboid(344.32071, 157.6675, 1013.6558, 6, 8.75, 2) setElementInterior(bankCol, 3) setElementDimension(bankCol, 200) --Marker of safe local markers = { {345.52288818359, 165.7333984375, 1014.1875,"bankCash1"}, {347.29931640625, 165.44149780273, 1014.1875,"bankCash2"}, {349.47421264648, 165.72450256348, 1014.1875,"bankCash3"}, {349.45764160156, 162.66996765137, 1014.1875,"bankCash4"}, {348.2170715332, 160.21328735352, 1014.1875,"bankCash5"}, {345.10858154297, 162.65562438965, 1014.1875,"bankCash6"}, {349.04412841797, 167.09187316895, 1014.1875,"bankCash7"} } for index, val in ipairs(markers) do local marker = createMarker(val[1], val[2], val[3]-1, "cylinder", 1.5, 255, 255, 0, 150) setElementInterior(marker, 3) setElementDimension(marker, 200) addEventHandler("onMarkerHit",marker,onMarkerHit) end end, 1000, 1) end ,6000,1) end addEvent( "serverStartBank", true ) addEventHandler("serverStartBank", root , serverStartBank) function onMarkerHit(hitPlayer, dim) if not dim then return end if getElementType ( hitPlayer ) == 'player' then for index, val in ipairs(markers) do outputChatBox("You are in the".. tostring(val[4]) .." !",hitPlayer,255,0,0) end end end
  6. bad argument #1 to ipairs ( table expected, got nil)
  7. So, i can call it when i define the function whit the event handler onMarkerHit? like function exampleFunction() outputChatBox("You are in the Marker1") addEventHandler("onMarkerHit", Marker1, exampleFunction Thanks!
  8. Oh thanks! but if someone hit for example the first marker how can i define it for destroy only these marker? really thanks carim
  9. Good Day to all, im trying to make a loop for a markers,these markers are in a table, but only appears 1... see my code, a lot of thanks markers = { createMarker(345.52288818359, 165.7333984375, 1014.1875, "cylinder", 1.5, 255, 255, 0, 150), createMarker(347.45263671875, 167.09187316895, 1007.3828125, "cylinder", 1.5, 255, 255, 0, 150), createMarker(349.38757324219, 167.09187316895, 1007.3828125, "cylinder", 1.5, 255, 255, 0, 150), createMarker(349.40020751953, 167.09187316895, 1007.3828125, "cylinder", 1.5, 255, 255, 0, 150), createMarker(347.81915283203, 167.09187316895, 1007.3828125, "cylinder", 1.5, 255, 255, 0, 150), createMarker(345.10681152344, 167.09187316895, 1007.3828125, "cylinder", 1.5, 255, 255, 0, 150), createMarker(349.04412841797, 167.09187316895, 1007.3828125, "cylinder", 1.5, 255, 255, 0, 150)} for i, marker in ipairs( markers ) do setElementDimension(marker, 200) setElementInterior(marker, 3) end
  10. Wel, its simply. Im ussing setElementModel for change a player skin, but when it change the model i lose all my weapons, how can i fix this error? a lot of thanks!
  11. function storeLastPage() lastPage = getBrowserURL ( brow1 ) outputChatBox(""..lastPage.."") end addEventHandler("onClientBrowserNavigate", brow1, storeLastPage) It works but when it wants and when i navigate it gives to me 3 times the web page in debug https://www.google.com.co/?gfe_rd=cr&ei ... gws_rd=ssl https://www.google.com.co/?gfe_rd=cr&ei ... gws_rd=ssl https://www.google.com.co/?gfe_rd=cr&ei ... gws_rd=ssl
  12. Something like this? function SpawnPicks ( ) if ( not pickup ) then pickup = createPickup(x,y,z,3,id,3) addEventHandler ( "onPickupHit", pickup, onPickupHit ) end end addEventHandler ( "onResourceStart", resourceRoot, SpawnPicks ) function onPickupHit ( ) if isElement ( pickup ) then destroyElement ( pickup ) setTimer ( function() SpawnPicks() outputChatBox ( "Pickup created" ) end, 5000, 1 ) end pickup = nil end
  13. Well, i am making a browser, i want to do the back button, store the last page in a variable and when you click the back button return to the last page, see the code it doesnt work function storeLastPage() lastPage = getBrowserURL ( brow1 ) function returnLast() loadBrowserURL(brow1, lastPage) end addEventHandler("onClientGUIClick", backBtn, returnLast, false) end addEventHandler("onClientBrowserNavigate", brow1, storeLastPage)
  14. Try to give to them a Shotgun or an m4 and you will see hahaha
  15. Well, bot its not an element, but you can create a ped like this https://wiki.multitheftauto.com/wiki/CreatePed function cash () local bot = createPed ( 0, 0, 0, 0)--Create a Cj in the 0,0,0 coord local cash = getElementData(bot, "cash") --This return false, because the bot doesnt have "cash" outputChatBox("BOT have "..cash.."$ !", getRootElement(), 255, 0, 0, true) end addCommandHandler("xxx", cash) function cash2 () --You cant operate booleans whit numbers so cash = getElementData(bot,"cash") if (cash == false) then --You cant operate booleans whit numbers so setElementData(bot,"cash", 0 ) setElementData(bot, "cash", (getElementData(bot, "cash") + 5000) --Now you can use the comand xxx outputChatBox("BOT +5000$ !", getRootElement(), 255, 0, 0, true) end end addCommandHandler("xx", cash2)
  16. Yes!, whit this resource you can do it its called "slothbot" https://community.multitheftauto.com/in ... ils&id=672 And see how to use it here http://wiki.multitheftauto.com/wiki/Slothman/Slothbot
  17. Yeah, but if i put eg: facebook.com the web page will be in blank, some help? thanks
  18. Hello all, i am using an example of the wiki, my question is, why if i change the loadBrowserURL it doesnt work?, just work on youtube, thanks! --In order to render the browser on the full screen, we need to know the dimensions. local screenWidth, screenHeight = guiGetScreenSize() --Let's create a new browser in remote mode. local window = guiCreateWindow(0, 0, screenWidth, screenHeight, "Webbrowser", false) local browser = guiCreateBrowser(0, 0, 800, 600, false, false, false, window) -- The event onClientBrowserCreated will be triggered, after the browser has been initialized. -- After this event has been triggered, we will be able to load our URL local theBrowser = guiGetBrowser(browser) -- Get the browser element from gui-browser addEventHandler("onClientBrowserCreated", theBrowser, function() -- After the browser has been initialized, we can load [url=https://www.youtube.com]www.youtube.com[/url] loadBrowserURL(source, "https://www.youtube.com")--Here, when i change the url to [url=http://www.google.com]http://www.google.com[/url] it doesnt work end )
  19. Hi, I'm trying to make a resource to check if you are admin you can give values to the account of a player, but not work for me, I need help! thank you very much --Server Side: addCommandHandler("rechargemp", function (player, cmd, torecharge, ammount) local tocargaAccount = getAccountPlayer ( torecharge ) local accountname = getPlayerAccount ( player ) if isObjectInACLGroup ( "user.".. accountname, aclGetGroup ( "Admin" ) ) then --If you are admin you can give medalloPoints To the player account outputChatBox("You give "..ammount.." to "..torecharge.."") setAccountData( acc, "medalloPoints", tonumber(ammount)) setElementData( source, "medalloPoints", tonumber(ammount)) else outputChatBox("You are not admin") end end )
×
×
  • Create New...