Jump to content

Destroyer.-

Members
  • Posts

    103
  • Joined

  • Last visited

Everything posted by Destroyer.-

  1. I modified the argument localplayer , and I also pulls the warn, throws me nil in the second argument of the event. how could I fix it?
  2. Hi, I have a problem with creating a marker with a table, create the marker, but it gives me a warn to debug and not found local marker = {} function Test() marker[source] = createMarker(-1055.3283691406,-1679.3109130859,76,"cylinder",5.5,255,255,0,170 ) end addEvent("Test", true) addEventHandler("Test",root,Test) function TestMarker() exports.sidechat:outputSideChat ( "test", 255, 0, 0) end addEventHandler("onClientMarkerHit",marker[source],TestMarker)
  3. Hice eso pero a medida q la barra va pasando se queda abajo el texto function renderizar_progreso( ) progreso_barra = progreso_barra + 0.4 if progreso_barra >= 300 then removeEventHandler( "onClientRender", root, renderizar_barras ) removeEventHandler( "onClientRender", root, renderizar_progreso ) end end addEventHandler( "onClientRender", root, renderizar_progreso ) function renderizar_barras( ) dxDrawRectangle((screenW - 23) / 2-131, (screenH - 10) / 2, 300, 25, tocolor(0, 0, 0, 160), true) dxDrawRectangle((screenW - 23) / 2-131, (screenH - 10) / 2, progreso_barra, 25, tocolor(0, 255, 0, 255), true) dxDrawBorderedText ("Drogandose",(screenWidth - 15) / 2 -120, (screenHeight - 10) / 2, screenWidth, screenHeight, tocolor ( 0, 0, 0, 255 ), 2, "sans" ) dxDrawText ("Drogandose",(screenWidth - 15) / 2 -120, (screenHeight - 10) / 2, screenWidth, screenHeight, tocolor ( 255, 255, 255, 255 ), 2, "sans" ) end addEventHandler( "onClientRender", root, renderizar_barras ) Solucionado, gracias a los 2
  4. Aka Blue tu codigo me funciono, gracias, como podria que este texto se superponga a la barra progresando dxDrawText ("Drogandose",(screenWidth - 15) / 2 -120, (screenHeight - 10) / 2, screenWidth, screenHeight, tocolor ( 255, 255, 255, 255 ), 2, "sans" )
  5. Hola, tengo un problema con DXRectangle, estoy tratando de hacer una barra que vaya progresando, me tira error del tercer argumento local screenW, screenH = guiGetScreenSize() local i = 0 function render() i=i+0.4 if i >= 300 then removeEventHandler("onClientRender", root, drawing) end end addEventHandler("onClientRender", root, drawing) function drawing() dxDrawRectangle((screenW - 23) / 2-131, (screenH - 10) / 2, i, 25, tocolor(144, 3, 3, 255), true) dxDrawRectangle((screenW - 23) / 2-131, (screenH - 10) / 2, 300, 25, tocolor(0, 0, 0, 130), true) end Gracias a los que ayuden
  6. setAccountData https://wiki.multitheftauto.com/wiki/SetAccountData Ya lo solucione hace dias, Gracias igual
  7. Lo que quiero es que me vuelva al skin que esta en la database, osea, cuando elijo, y cancelo, me queda el skin elegido, pero yo no puse aceptar, nose si me entiende, de ultima lo hago con un ped si no me entendieron Ejemplo: Yo tomo el skin ID 250, y pongo aceptar -> me lo pone BIEN Yo tomo el skin ID 250, y pongo Salir -> me queda el skin tomado, pero yo no quise cambiarlo PD: Solucionado gracias a los que me ayudaron
  8. Aún asi no funciona, y no arroja ningun debug
  9. De nada , recuerda que cancelEvent no lleva argumentos en client
  10. function abortAllStealthKills(thePlayer) if ( getElementInterior(thePlayer) == 1 ) then cancelEvent() end end addEventHandler("onClientPlayerStealthKill", root, abortAllStealthKills)
  11. Esto te puede servir. https://forum.multitheftauto.com/viewtopic.php?f=148&t=38203
  12. emm function ComprarSkin(id) -- Al Comprar skin --> takePlayerMoney(source, 0) local account = getPlayerAccount(source) if ( not isGuestAccount( getPlayerAccount( source ) ) ) then skin = setElementModel(source, id) setAccountData(account,"Sking",id) outputChatBox("Skin Guardado Exitosamente.", source, 255, 20, 20, true) end end addEvent("skins",true) addEventHandler("skins", root, ComprarSkin) function removers() -- Al Cerrar Panel --> if not (isGuestAccount (getPlayerAccount (source))) then local acc = getPlayerAccount(source) local skinG = getAccountData (acc, "Sking") -- Cargar skin que habia seleccionado anteriormente outputChatBox ( "Test", source, 170, 0, 0, false ) setElementModel(source, skinG) -- setearle el skin anterior end end addEvent("remover",true) addEventHandler("remover", root, removers) Sking es un skin que uno elige al registrarse, o en el mismo skinshop, es como que al cambiar el skin en client , porque en realidad, si guarda el skin, pero no lo setea, si me cambio el skin con el panel de admin y me seteo el skin si guarda, pero el problema seria al setear el model en client, pero no se como repararlo , dejo el script completo, total es de la comunidad local marker = createMarker ( 2247.3356933594, -1664.8883056641, 14.4765625, "cylinder", 2, 0, 255, 0, 255 ) local marker2 = createMarker ( 1734.7803955078, -1861.1599121094, 12.577855110168, "cylinder", 2, 0, 255, 0, 255 ) blip = createBlip (2247.2526855469,-1664.8112792969,15.4765625, 45,2, 0, 0, 0,0,0,1000.0 ) function ComprarSkin(id) -- Al Comprar skin --> takePlayerMoney(source, 0) local account = getPlayerAccount(source) if ( not isGuestAccount( getPlayerAccount( source ) ) ) then skin = setElementModel(source, id) setAccountData(account,"Sking",id) outputChatBox("Skin Guardado Exitosamente.", source, 255, 20, 20, true) end end addEvent("skins",true) addEventHandler("skins", root, ComprarSkin) function removers() -- Al Cerrar Panel --> if not (isGuestAccount (getPlayerAccount (source))) then local acc = getPlayerAccount(source) local skinG = getAccountData (acc, "Sking") outputChatBox ( "Test", source, 170, 0, 0, false ) setElementModel(source, skinG) end end addEvent("remover",true) addEventHandler("remover", root, removers) function MarkerSkin(player) if (getElementType(player) =="player" and getPlayerTeam(player) and getTeamName (getPlayerTeam(player)) == "Criminal" or getTeamName (getPlayerTeam(player)) == "Desocupados") then triggerClientEvent (player,"marker_skines",getRootElement(),player) end end addEventHandler("onMarkerHit",marker,MarkerSkin) addEventHandler("onMarkerHit",marker2,MarkerSkin) Windows = guiCreateWindow ( 0.2, 0.2, 0.25, 0.5, "Skin Shop", true ) grid = guiCreateGridList(0.01, 0.2, 0.99, 0.5, true, Windows) guiGridListAddColumn(grid, "Skins", 0.85) guiSetAlpha( Windows, 1 ) button1 = guiCreateButton ( 0.5, 0.8, 0.45, 0.15, "Salir", true, Windows) button2 = guiCreateButton ( 0.02, 0.8, 0.45, 0.15, "Aceptar", true, Windows) label1 = guiCreateLabel ( 0.1, 0.1, 0.9, 0.1, "Skin PARA TODOS DE LA KRISTI", true, Windows ) showCursor(false) guiSetVisible( Windows, false ) guiWindowSetSizable( Windows, false ) guiWindowSetMovable( Windows, false ) skines = { {"CJ", 0}, {"Sweet", 270}, {"Ryder", 300}, {"Ryder 2", 301}, {"Big Smoke", 269}, {"Big Smoke 2", 311}, {"Truth", 1}, {"Wuzi Mu", 294}, {"Claude", 299}, {"Madd Dogg", 297}, {"Mike Toreno", 295}, {"Cesar", 292}, {"OG Loc", 293}, {"T-Bone", 307}, {"Joe Pesci", 258}, {"Pimp", 249}, {"White Dealer", 29}, {"Black Dealer", 28}, {"Hiker", 26}, {"Casino Bouncer 1", 163}, {"Casino Bouncer 2", 164}, {"Drug Worker 1", 144}, {"Drug Worker 2", 145}, {"Drug Worker 3", 146}, } function aceptar() -- Funcion para comprar skin if (source == button2) then local row, col = guiGridListGetSelectedItem(grid) if (row and col and row ~= -1 and col ~= -1) then local model = tonumber(guiGridListGetItemData(grid, row, 1)) if model ~= "" then triggerServerEvent("skins", localPlayer, model) --Trigger al tocar el boton Aceptar guiSetVisible(Windows,false) showCursor(false) end end end end addEventHandler("onClientGUIClick", button2, aceptar) function close1() -- Funcion para cerrar el panel if (source == button1) then triggerServerEvent("remover", localPlayer) -- Trigger al tocar el boton Cerrar guiSetVisible(Windows,false) showCursor(false) end end addEventHandler("onClientGUIClick", button1, close1) function MarkerSkines() -- Funcion al tocar el marker guiSetVisible(Windows,true) showCursor(true) guiGridListClear(grid) for i,sk in ipairs(skines) do row = guiGridListAddRow(grid) guiGridListSetItemText(grid, row, 1, tostring(sk[1]), false, false) guiGridListSetItemData(grid, row, 1, tostring(sk[2])) end end addEvent("marker_skines",true) addEventHandler("marker_skines", getRootElement(), MarkerSkines) function click1 () -- Funcion para tomar el skin seleccionado local item = guiGridListGetItemData( grid, guiGridListGetSelectedItem ( grid ), 1 ) if item then setElementModel ( localPlayer, item ) end end addEventHandler("onClientGUIClick", grid, click1)
  13. Si perdoname. ahí actualice el post para que se entienda mas, generalmente en lua nunca eh puesto comentarios, los pondre si posteo asi me entienden
  14. Hola tengo un problema con un "skin shop" es que, quiero que tenga una vista previa para ver el skin y ahi recien comprarlo, pero pasa que cuando quiero volver al skin anterior, osea al que tenia antes de q tome la vista previa, no me deja, aca dejo el : client skines = { {"CJ", 0}, {"Sweet", 270}, {"Ryder", 300}, {"Ryder 2", 301}, {"Big Smoke", 269}, {"Big Smoke 2", 311}, {"Truth", 1}, {"Wuzi Mu", 294}, {"Claude", 299}, {"Madd Dogg", 297}, {"Mike Toreno", 295}, {"Cesar", 292}, {"OG Loc", 293}, {"T-Bone", 307}, {"Joe Pesci", 258}, {"Pimp", 249}, {"White Dealer", 29}, {"Black Dealer", 28}, {"Hiker", 26}, {"Casino Bouncer 1", 163}, {"Casino Bouncer 2", 164}, {"Drug Worker 1", 144}, {"Drug Worker 2", 145}, {"Drug Worker 3", 146}, } function aceptar() -- Funcion para comprar skin if (source == button2) then local row, col = guiGridListGetSelectedItem(grid) if (row and col and row ~= -1 and col ~= -1) then local model = tonumber(guiGridListGetItemData(grid, row, 1)) if model ~= "" then triggerServerEvent("skins", localPlayer, model) --Trigger al tocar el boton Aceptar guiSetVisible(Windows,false) showCursor(false) end end end end addEventHandler("onClientGUIClick", button2, aceptar) function close1() -- Funcion para cerrar el panel if (source == button1) then triggerServerEvent("remover", localPlayer) -- Trigger al tocar el boton Cerrar guiSetVisible(Windows,false) showCursor(false) end end addEventHandler("onClientGUIClick", button1, close1) function MarkerSkines() -- Funcion al tocar el marker guiSetVisible(Windows,true) showCursor(true) guiGridListClear(grid) for i,sk in ipairs(skines) do row = guiGridListAddRow(grid) guiGridListSetItemText(grid, row, 1, tostring(sk[1]), false, false) guiGridListSetItemData(grid, row, 1, tostring(sk[2])) end end addEvent("marker_skines",true) addEventHandler("marker_skines", getRootElement(), MarkerSkines) function click1 () -- Funcion para tomar el skin seleccionado local item = guiGridListGetItemData( grid, guiGridListGetSelectedItem ( grid ), 1 ) if item then setElementModel ( localPlayer, item ) end end addEventHandler("onClientGUIClick", grid, click1) server function ComprarSkin(id) -- Al Comprar skin --> takePlayerMoney(source, 0) local account = getPlayerAccount(source) if ( not isGuestAccount( getPlayerAccount( source ) ) ) then skin = setElementModel(source, id) setAccountData(account,"Sking",id) outputChatBox("Skin Guardado Exitosamente.", source, 255, 20, 20, true) end end addEvent("skins",true) addEventHandler("skins", root, ComprarSkin) function removers() -- Al Cerrar Panel --> if not (isGuestAccount (getPlayerAccount (source))) then local acc = getPlayerAccount(source) local skinG = getAccountData (acc, "Sking") outputChatBox ( "Test", source, 170, 0, 0, false ) end end addEvent("remover",true) addEventHandler("remover", root, removers)
  15. Entonces ni es tanto que digamos, ya que los servidores de hoy en dia suelen tener mas de 2gb de RAM, por lo que 5 kbs no creo que sea algo significativo, aunque obvio, es mejor hacer todo de forma optima para hacer las cosas de la forma mejor posible
  16. Uno dice A, el otro dice Z, no entiendo que hacer, me confundieron e.e
  17. eh probado asi y no funciona local playerWeapons = { } addEventHandler ( "onPlayerWasted", root, function ( ) armadelolis = saveWeapons(source) setElementData(source,"armas",armadelolis) if ( not playerWeapons [ source ] ) then playerWeapons [ source ] = { } end for slot = 0, 12 do local weapon = getPedWeapon ( source, slot ) if ( weapon > 0 ) then local ammo = getPedTotalAmmo ( source, slot ) if ( ammo > 0 ) then playerWeapons [ source ] [ weapon ] = ammo end end end end ) function saveWeapons(player) tableWeapons = {} for i=0,12 do local weapon = getPedWeapon(player, i) local ammo = getPedTotalAmmo(player, i) tableWeapons[weapon] = ammo end return toJSON(tableWeapons) end addEventHandler ( "onPlayerSpawn", root, function ( ) if ( playerWeapons [ source ] ) then for weapon, ammo in pairs ( playerWeapons [ source ] ) do giveWeapon ( source, tonumber ( weapon ), tonumber ( ammo ) ) end end playerWeapons [ source ] = nil end ) addEventHandler("onPlayerQuit",root, function() if not isGuestAccount(getPlayerAccount(source)) then if isPedDead(source) then armadelolis = getElementData(source,"armas") account = getPlayerAccount(source) setAccountData(account,"armas",armadelolis) else armadelolis = saveWeapons(source) account = getPlayerAccount(source) setAccountData(account,"armas",armadelolis) end end end ) addEventHandler("onPlayerLogin",root, function () local account = getPlayerAccount(source) local datting = getAccountData(account,"armas") if datting then for i,v in pairs(fromJSON(datting)) do giveWeapon(source,i,v) end end end ) ni asi local playerWeapons = { } addEventHandler ( "onPlayerWasted", root, function ( ) if ( not playerWeapons [ source ] ) then playerWeapons [ source ] = { } end for slot = 0, 12 do local weapon = getPedWeapon ( source, slot ) if ( weapon > 0 ) then local ammo = getPedTotalAmmo ( source, slot ) if ( ammo > 0 ) then playerWeapons [ source ] [ weapon ] = ammo armadelolis = getElementData(source,"armas") account = getPlayerAccount(source) setAccountData(account,"armas",armadelolis) end end end end ) function saveWeapons(player) tableWeapons = {} for i=0,12 do local weapon = getPedWeapon(player, i) local ammo = getPedTotalAmmo(player, i) tableWeapons[weapon] = ammo end return toJSON(tableWeapons) end addEventHandler ( "onPlayerSpawn", root, function ( ) if ( playerWeapons [ source ] ) then for weapon, ammo in pairs ( playerWeapons [ source ] ) do giveWeapon ( source, tonumber ( weapon ), tonumber ( ammo ) ) end end playerWeapons [ source ] = nil end ) addEventHandler("onPlayerQuit",root, function() if not isGuestAccount(getPlayerAccount(source)) then if isPedDead(source) then armadelolis = getElementData(source,"armas") account = getPlayerAccount(source) setAccountData(account,"armas",armadelolis) else armadelolis = saveWeapons(source) account = getPlayerAccount(source) setAccountData(account,"armas",armadelolis) end end end ) addEventHandler("onPlayerLogin",root, function () local account = getPlayerAccount(source) local datting = getAccountData(account,"armas") if datting then for i,v in pairs(fromJSON(datting)) do giveWeapon(source,i,v) end end end )
  18. Hola, encontre en el foro algo que deberia guardar al morir, guarda, pero si estoy muerto y me desconecto, se me va todas las armas, nose como podria reparar esto aca dejo el codigo local playerWeapons = { } addEventHandler ( "onPlayerWasted", root, function ( ) if ( not playerWeapons [ source ] ) then playerWeapons [ source ] = { } end for slot = 0, 12 do local weapon = getPedWeapon ( source, slot ) if ( weapon > 0 ) then local ammo = getPedTotalAmmo ( source, slot ) if ( ammo > 0 ) then playerWeapons [ source ] [ weapon ] = ammo end end end end ) addEventHandler ( "onPlayerSpawn", root, function ( ) if ( playerWeapons [ source ] ) then for weapon, ammo in pairs ( playerWeapons [ source ] ) do giveWeapon ( source, tonumber ( weapon ), tonumber ( ammo ) ) end end playerWeapons [ source ] = nil end ) function saveWeapons(player, account) if player and account then for i=0,12 do local weapon = getPedWeapon(player, i) local ammo = getPedTotalAmmo(player, i) setAccountData(account,"w"..tonumber(i), weapon) setAccountData(account,"a"..tonumber(i), ammo) end takeAllWeapons(player) end end addEventHandler("onPlayerQuit",root,function () saveWeapons(source, getPlayerAccount(source)) end) addEventHandler("onPlayerWasted",root,function () saveWeapons(source, getPlayerAccount(source)) end) addEventHandler("onPlayerLogout",root,function(prev) saveWeapons(source, prev) end) addEventHandler("onPlayerLogin",root, function () local account = getPlayerAccount(source) if not account or isGuestAccount(account) then return end for i=0,12 do local weapon = getAccountData(account,"w"..tonumber(i)) local ammo = getAccountData(account,"a"..tonumber(i)) if weapon and ammo then setTimer(giveWeapon, 1000, 1, source, tonumber(weapon), tonumber(ammo), true) end end end)
  19. uff sorry, I was asleep when I made it. I'll open one in Spanish section, Close Please
  20. Hola, encontre en el foro algo que deberia guardar al morir, guarda, pero si estoy muerto y me desconecto, se me va todas las armas, nose como podria reparar esto aca dejo el codigo local playerWeapons = { } addEventHandler ( "onPlayerWasted", root, function ( ) if ( not playerWeapons [ source ] ) then playerWeapons [ source ] = { } end for slot = 0, 12 do local weapon = getPedWeapon ( source, slot ) if ( weapon > 0 ) then local ammo = getPedTotalAmmo ( source, slot ) if ( ammo > 0 ) then playerWeapons [ source ] [ weapon ] = ammo end end end end ) addEventHandler ( "onPlayerSpawn", root, function ( ) if ( playerWeapons [ source ] ) then for weapon, ammo in pairs ( playerWeapons [ source ] ) do giveWeapon ( source, tonumber ( weapon ), tonumber ( ammo ) ) end end playerWeapons [ source ] = nil end ) function saveWeapons(player, account) if player and account then for i=0,12 do local weapon = getPedWeapon(player, i) local ammo = getPedTotalAmmo(player, i) setAccountData(account,"w"..tonumber(i), weapon) setAccountData(account,"a"..tonumber(i), ammo) end takeAllWeapons(player) end end addEventHandler("onPlayerQuit",root,function () saveWeapons(source, getPlayerAccount(source)) end) addEventHandler("onPlayerWasted",root,function () saveWeapons(source, getPlayerAccount(source)) end) addEventHandler("onPlayerLogout",root,function(prev) saveWeapons(source, prev) end) addEventHandler("onPlayerLogin",root, function () local account = getPlayerAccount(source) if not account or isGuestAccount(account) then return end for i=0,12 do local weapon = getAccountData(account,"w"..tonumber(i)) local ammo = getAccountData(account,"a"..tonumber(i)) if weapon and ammo then setTimer(giveWeapon, 1000, 1, source, tonumber(weapon), tonumber(ammo), true) end end end)
  21. Ta, Gracias Tomas Saliendo del tema los ElementData comsumen muchos recursos? Si la respuesta es si, como podria Hacer de otra forma sin los element data? Si usas pocos elementData no pasaria nada Cuanto es "poco" o "mucho", porque para un robo grande uso aproximadamente 14 elements data
  22. Ta, Gracias Tomas Saliendo del tema los ElementData comsumen muchos recursos? Si la respuesta es si, como podria Hacer de otra forma sin los element data?
  23. Hola, estoy haciendo un mini cnr, y la verdad en la parte de los timers me quede ya que no puedo, hacer que los argumentos, me queden bien , setTimer ( function(p) local p = pl while type(p) == "userdata" do setElementFrozen(p, false) markerrobo[p] = createMarker(1141.8201904297,-1588.7235107422,12.609743118286,"cylinder",2,255,0,0,175 ) addEventHandler( "onMarkerHit", markerrobo[p], function ( hitElement ) outputChatBox("Plantando bomba...", hitElement, 255, 255, 0 ) setPedAnimation ( hitElement, "COP_AMBIENT", "Copbrowse_loop") setTimer ( function(hitElement) outputChatBox("bomba...", hitElement, 255, 255, 0 ) setPedAnimation ( hitElement, false) end, 10000, 1 ) end ) p = nil end end, 10000, 1 ) El bad argument me da en la linea setPedAnimation ( hitElement, false) WARNING: bankrob\server.lua:70: Bad argument @ 'setPedAnimation' [Expected element at argument 1, got nil] Gracias
×
×
  • Create New...