Jump to content

_SAXI_

Members
  • Posts

    80
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by _SAXI_

  1. Sería algo así... local puerta=createObject(...) local abierto=false addCommandHandler("abrir",function(jug,_) if not(abierto)then local x,y,z=getElementPosition(puerta) moveObject(puerta,1500,x,y,z-30) abierto=true end end) addCommandHandler("cerrar",function(jug,_) if(abierto)then local x,y,z=getElementPosition(puerta) moveObject(puerta,1500,x,y,z+30) abierto=false end end)
  2. You could try something like this: local elementFocus=createPed(...) function setMissionHandler(player) bindKey(player,"mouse1","down",function(src) if(getPedTarget(src)==elementFocus)then outputChatBox("You've taken a photo",src,255,255,0) end end,player) end
  3. Try this: function showTeamFunction(source) local playerTeam = getPlayerTeam ( source ) if ( playerTeam ) then local players = getPlayersInTeam ( playerTeam ) for playerKey, playerValue in ipairs ( players ) do outputChatBox ( getPlayerName(playerValue) ) end end end addCommandHandler ( "showTeam", showTeamFunction )
  4. function addPlayerToACLGroup(player,groupName) local account=getPlayerAccount(player); local group=aclGetGroup(groupName); if not(isGuestAccount(account))then if(group)then return aclGroupAddObject(group,"user."..getAccountName(account)); end end return false end function removePlayerFromACLGroup(player,groupName) local account=getPlayerAccount(player); local group=aclGetGroup(groupName); if not(isGuestAccount(account))and(group)then local accountName=getAccountName(account); if(isObjectInACLGroup("user"..accountName,group))then return aclGroupRemoveObject(group,"user."..accountName); end end return false end addCommandHandler("givePolice",function(admin,_,playerName) if(hasObjectPermissionTo(admin,"general.ModifyOtherObjects"))then local player=getPlayerFromName(playerName); if(player)then addPlayerToACLGroup(player,"police"); end end end); addCommandHandler("removePolice",function(admin,_,playerName) if(hasObjectPermissionTo(admin,"general.ModifyOtherObjects"))then local player=getPlayerFromName(playerName); if(player)then removePlayerFromACLGroup(player,"police"); end end end); addCommandHandler("give",function(admin,_,groupName,playerName) if(hasObjectPermissionTo(admin,"general.ModifyOtherObjects"))then local group=aclGetGroup(groupName); local player=getPlayerFromName(playerName); if(group)and(player)then addPlayerToACLGroup(player,group); end end end); addCommandHandler("remove",function(admin,_,groupName,playerName) if(hasObjectPermissionTo(admin,"general.ModifyOtherObjects"))then local group=aclGetGroup(groupName); local player=getPlayerFromName(playerName); if(group)and(player)then removePlayerFromACLGroup(player,group); end end end); I haven't tried this, but it should work. By default it is made for administrators who can assign groups in the acl, by default it would be for the "Admin" group
  5. Your error is not using the "state" parameter. Try this: function Panel:loginClick(button, state) if state == "down" then if self.show and self.hovered == 'buttons' and self.selectedbutton == 1 then for key, value in pairs(self.loginGuis) do if value.text == '' then if clickTick + (5000) > getTickCount() then return end exports.ml_notification:addNotification('All fields are required!', 'warning') destroyAnimation() break else triggerServerEvent('loginaccount', localPlayer, localPlayer, self.loginGuis[1].text, self.loginGuis[2].text) destroyAnimation() end end elseif self.show and self.hovered == 'buttons' and self.selectedbutton == 2 then for key, value in ipairs(self.registerGuis) do if value.text == '' then if clickTick + (5000) > getTickCount() then return end exports.notification:addNotification('All fields are required!', 'warning') break else if self.registerGuis[2].text == self.registerGuis[3].text then if isValidMail(self.registerGuis[4].text) then outputChatBox(self.registerGuis[1].text) triggerServerEvent("registeraccount", localPlayer, localPlayer, self.registerGuis[1].text, self.registerGuis[2].text, self.registerGuis[4].text) break else exports.notification:addNotification('Wrong email!', 'warning') break end else exports.notification:addNotification('The passwords do not match!', 'warning') break end end end end end end
  6. Try this: addEventHandler("onClientElementColShapeLeave",root,function(col,dim) if(source==localPlayer)then if(col==TheSensor)or(col==TheSensor1)then GateMenu=false end end end)
  7. _SAXI_

    [HELP] bindkey

    local swidth,sheight=guiGetScreenSize() local w,h=300,400 local myWindow function createPanel() myWindow = guiCreateWindow(swidth/2-w/2,sheight/2-h/2,w,h,"My Window",false) --... end bindKey("f6","down",function() if not(myWindow)then createPanel() else destroyElement(myWindow) myWindow = nil end end)
  8. replace: triggerServerEvent("afk", getLocalPlayer()) triggerServerEvent("notafk", getLocalPlayer())
  9. function Kamshodan() setTimer(function() for _,thePlayer in ipairs(getElementsByType("player"))do setPedStat(thePlayer, 23, getPedStat(thePlayer, 23) - 2) setPedStat(thePlayer, 22, getPedStat(thePlayer, 22) + 2) end end,3600,1) end addEventHandler('onResourceStart', getResourceRootElement(getThisResource()), Kamshodan)
  10. The creation components in DGS are not to be used by the "onClientRender" event. If you want to remove the components you must use the destroyElement function
  11. Explícate un poco, con la descripción que das es un poco difícil poder ayudarte
  12. La verdad no sé si sea posible crear un anti-kick con los eventos de mta. Lo que podrías hacer es modificar la función kickPlayer para establecer tus necesidades, pero eso sólo cubriría a ese único script.
  13. _SAXI_

    GridList

    You can try something like this dxGridList = { x = 0, y = 0, width = 300, height = 200, columns = {}, rows = {} } addColumn = function(name,size) table.insert(dxGridList.columns,{name,size}); end addRow = function(col,value) table.insert(dxGridList.rows,{col,value}); end local sx,sy = guiGetScreenSize(); addEventHandler("onClientRender",root,function() local x,y = sx/2-dxGridList.width/2,sy/2-dxGridList.height/2; local w,h = dxGridList.width,dxGridList.height; dxDrawRectangle(x,y,w,h,tocolor(70,70,70)); local colx = x; dxDrawRectangle(x,y,w,25,tocolor(10,10,10)) for i,col in ipairs(dxGridList.columns)do local cw = col[2]*w; dxDrawText(col[1],colx,y+4,100,20,tocolor(255,255,255),1,"default"); local ry = y+20; for j,row in ipairs(dxGridList.rows)do if(row[1] == i)then dxDrawRectangle(colx,ry,cw,20,tocolor(120,120,120)) dxDrawText(row[2],colx,ry,100,20,tocolor(255,255,255),1,"default"); ry = ry + 20; end end colx = colx+cw; end end); addColumn("Col 1",.1); addColumn("Col 2",.7); addColumn("Col 3",.2); for i=1,20 do addRow(math.random(1,3)," "..tostring(i)); end
  14. Aquí tienes un ejemplo de como hacerlo. ES UN ARCHIVO DE TIPO CLIENTE -- Escondes o muestras el chat local chatState = true; bindKey("0",function() chatState = not chatState; showChat(chatState); end); -- Escondes o muestras el HUD local hudState = true; bindKey("9",function() hudState = not hudState; setPlayerHudComponentVisible("all",hudState); end);
  15. function hola(jugador,_) if(isPedDead(jugador))then outputChatBox("¡Estás muerto!",jugador,255,0,0) else outputChatBox("¡Estás vivo!",jugador,0,255,0) end end addCommandHandler("meme",hola)
  16. The problem may be that you are using the player serial as the table index. Try this: local serials = {} function getSerialIndex(str) local index; if(str)then for i,serial in pairs(serials)do if(str == serial)then index = i; end end if not(index)then table.insert(serials,str); end return #serials; end return index; end function updateValue(player, key, value) if not (player == nil) then local p = getSerialIndex(getPlayerSerial(player)) if players[p] == nil then players[p] = {} end players[p][key] = value end end This would work as long as the script is not stopped... If you use this option, I recommend you complement it with a database
  17. Hola @jeblaje, creo entender lo que dices. Sería algo así: Server-side local mydb = dbConnect(...); function my_func(tipo,...) local qh; if(mydb)then if(tipo == 1)then qh = mydb:exec("UPDATE Cuentas SET Nombre=? WHERE Nombre=?",arg[1],arg[2]); elseif(tipo == 2)then qh = mydb:exec("UPDATE Cuentas SET Rango=? WHERE Nombre=?",arg[1],arg[2]); --... end end if(qh)then triggerClientEvent(client,"clientExecutedQuery",resourceRoot,tipo); end end addEvent("clientExecDB",true); addEventHandler("clientExecDB",root,my_func); Client-side function sendQuery(tipo,...) triggerServerEvent("clientExec",localPlayer,tipo,...); end function onSendQuery(tipo) outputChatBox("Proceso "..tostring(tipo).." Ejecutado correctamente"); end addEvent("clientExecutedQuery",true); addEventHandler("clientExecutedQuery",root,onSendQuery); addEventHandler("onClientResourceStart",resourceRoot,function() sendQuery(1,"NuevoNombre","MiNombre"); sendQuery(2,"Admin","NuevoNombre"); end); Espero haber ayudado, si no es esto lo que necesitas, orientanos un poco más para tratar de resolver tu duda
  18. Usa setElementDimension setElementInterior
  19. function mostrarMensaje(jugador,_,...) local arg = {...}; local mensaje = table.concat(arg,' '); outputChatBox(getPlayerName(jugador)..': '..mensaje); end addCommandHandler('mensaje',mostrarMensaje); Ahí te dejo un ejemplo de como puedes hacerlo
  20. Intenta con esto. Hice unas correcciones en tú código: addCommandHandler("motor", function(player) if not notIsGuest(player) then local veh = player:getOccupiedVehicle() local seat = player:getOccupiedVehicleSeat() if veh and seat == 0 then local model = veh:getModel() -- Obtenemos el modelo del vehiculo if getElementData(player, "Roleplay:trabajo") == "Basurero" and model == 408 then local gas = getElementData(veh, "Fuel") or 0 if gas >= 1 then if not player:getData("EnGasolinera") then if veh:getHealth() >= 300 then if veh:getData('Motor') == 'apagado' then MensajeRol(player, " esta encendiendo el motor del vehículo") setTimer(function(player, veh) veh:setEngineState(true) veh:setData('Motor','encendido',false) veh:setFrozen(false) end, 2000, 1, player, veh) for i,v in ipairs(getPlayersOverArea(player,13)) do triggerEvent('SonidoEncenderVeh',v,'auto') end else MensajeRol(player, " apago el motor del vehículo") setTimer(function(player, veh) veh:setEngineState(false) -- veh:setFrozen(true) veh:setData('Motor','apagado') end, 200, 1, player, veh) end end end end end end end end)
  21. Here is an idea of how to do it : local rutas = { [1] = { {x,y,z}, {x,y,z} ... }, [2] = { {x,y,z}, {x,y,z} ... } }; local ruta_markers = {}; addEventHandler('onResourceStart',resourceRoot,function() for i,ruta in pairs(rutas)do ruta_markers[i] = {}; for num,data in pairs(ruta)do local m = createMarker(data[1],data[2],data[3],'cylinder',...); ruta_markers[i][num] = m; end end end) function setPlayerRoute(player,ruta) setElementData(player,"Ruta",ruta); end addEventHandler('onMarkerHit',root,function(player) local ruta = getElementData(player,'Ruta'); if(ruta_markers[ruta])then ... end end)
  22. if(getElementData(element,"Wolf.marker") == #markers)then -- your end code end
  23. Puedes mostrar el cliente de tu código donde hace el trigger?
  24. Disculpa, me equivoqué en la creación del vehículo, faltó agregar el id de éste. vehicle = createVehicle(id,x,y,z, 0, 0, rot)
  25. Hola, con esto debería bastar addEvent("SpawnMyVehicle", true) addEventHandler("SpawnMyVehicle", root, function(id) if not playerVehicles[source] then playerVehicles[source] = {} end if #playerVehicles[source] >= 1 then exports.Script_Textos:createNewDxMessage("Solo Puedes Spawnear Un Vehiculos a La Vez", source, 255, 85, 0, true) return end local data = dbPoll(dbQuery(db, "SELECT * FROM VehicleList WHERE Account = ? AND ID = ?", getAccountName(getPlayerAccount(source)), id), -1) if type(data) == "table" and #data ~= 0 then if getVehicleByID(id) then exports.Script_Textos:createNewDxMessage("Su Vehiculo Ha Sido Spawneado", source, 255, 85, 0, true) else local color = split(data[1]["Colors"], ',') r1 = color[1] or 255 g1 = color[2] or 255 b1 = color[3] or 255 r2 = color[4] or 255 g2 = color[5] or 255 b2 = color[6] or 255 -- AQUI ESTÁ LA MODIFICACIÓN -- local x,y,z = getElementPosition(client) -- Obtenemos la ubicación del jugador local _,_,rot = getElementRotation(client) -- Obtenemos la rotación vehicle = createVehicle(x,y,z, 0, 0, rot) -- Creamos el vehículo en la posición del jugador warpPedIntoVehicle(client,vehicle) -- Ponemos al jugador dentro del vehículo para que este no nos aplaste al crearse setElementData(vehicle, "ID", id) table.insert(playerVehicles[source],vehicle) local fuelnu = data[1]["fuel"] or 100 local tune = fromJSON(data[1]["handling"]) -- outputChatBox(data[1]["handling"],source,255,0,0) --outputChatBox(tostring(tune),source,255,0,255) setElementData(vehicle, "vehicleFuel", fuelnu) local upd = split(tostring(data[1]["Upgrades"]), ',') for i, upgrade in ipairs(upd) do addVehicleUpgrade(vehicle, upgrade) end local Paintjob = data[1]["Paintjob"] or 3 setVehiclePaintjob(vehicle, Paintjob) setVehicleColor(vehicle, r1, g1, b1, r2, g2, b2) if data[1]["HP"] <= 255.5 then data[1]["HP"] = 255 end setElementHealth(vehicle, data[1]["HP"]) setElementData(vehicle, "Owner", source) vv[vehicle] = setTimer(function(source) if not isElement(source) then killTimer(vv[source]) vv[source] = nil end if isElement(source) and getElementHealth(source) <= 255 then setElementHealth(source, 255.5) -- setVehicleDamageProof(source, true) setVehicleEngineState(source, false) end end, 50, 0, vehicle) addEventHandler("onVehicleDamage", vehicle, function(loss) local account = getAccountName(getPlayerAccount(getElementData(source, "Owner"))) setTimer(function(source) if isElement(source) then dbExec(db, "UPDATE VehicleList SET HP = ? WHERE Account = ? AND Model = ?", getElementHealth(source), account, getElementModel(source)) updateVehicleInfo(getElementData(source, "Owner")) end end, 100, 1, source) end) addEventHandler("onVehicleEnter", vehicle, function(player) if getElementHealth(source) <= 255.5 then setVehicleEngineState(source, false) else if isVehicleDamageProof(source) then setVehicleDamageProof(source, false) end end end) exports.Script_Textos:createNewDxMessage("Tu Vehiculo Ha Sido Spawneado", source, 255, 85, 0, true) cur = getElementData(source,"spawnedcars") or {} table.insert(cur,getVehicleNameFromModel(data[1]["Model"])) setElementData(source,"spawnedcars",cur) end else exports.Script_Textos:createNewDxMessage("Ocurrio Un Error", source, 255, 85, 0, true) end end)
×
×
  • Create New...