-
Posts
2,106 -
Joined
-
Last visited
-
Days Won
6
Everything posted by aka Blue
-
Buenas, mi duda es que quiero dibujar una imagen debajo o al lado del ratón del jugador, ¿Cómo sería esto posible? Básicamente porque quiero utilizar los valores relativos para dibujar los rectángulos o imágenes, tipo: local sx, sy = guiGetScreenSize( ) local sourceX, sourceY = 1366, 768 dxDrawText( "texto", (324/sourceX)*sx, (234/sourceY)*sy, ... )
-
[APORTE] Editor de archivo acl.xml | Con GUI DX
aka Blue replied to aka Blue's topic in Recursos y aportes
Si, es a propósito pero se puede poner donde quieras, editando jaja -
Una loop de la gridlist, pillando a todos los que hay dentro (?
-
Es que no sé de que lista me hablas. Deberías hacer en todo caso una tabla con todos los jugadores sacados de getElementsByType, enviarlos al lado cliente a una gridlist y al ser sacado alguno, quitarlo de dicha tabla y meterlo en otra gridlist. Y cuando tengas todo eso, pillar los datos de la gridlist y por el nombre o por lo que hayas metido los anteriores a la primera gridlist, enviarlo a tal dimensión.
-
Esa línea debe estar encima de todo el código. PD: Acabo de fijarme en algo. Al cargar el contenido de la tabla, Tomas ha puesto que se borre, no entiendo el motivo. Si se borra, ya no se podrá ejecutar nuevamente hasta que no se reinicie el script, no tiene sentido (? dbExec(db, "DROP TABLE IF EXISTS `position`")
-
El primer error te dice que la tabla no existe...
-
Optimized and i think should work local markers = { {1450, 1250, 10, "checkpoint", 10, 0, 0, 255, 255}, {1450, 1450, 10, "checkpoint", 10, 0, 0, 255, 255}, } local markers = { } addEventHandler( "onClientResourceStart", resourceRoot, function( ) for i=1, #markers do local v = markers[i] local marker = createMarker(v[1], v[2], v[3], v[4], v[5], v[6], v[7], v[8], v[9]) markers[marker] = marker addEventHandler( "onClientMarkerHit", getRootElement( ), markerHit ) end end ) function markerHit( player ) local vehicle = getPedOccupiedVehicle( player ) if vehicle then -- If is player in vehicle setElementPosition(player, 1500, 1250, 10) end end
-
Es que no sé de qué botón hablas. ¿Podrías aportar más información? No entendí lo que quieres hacer. ¿Con un botón quieres mandar a todos los jugadores a una dimensión? Para ello utiliza esto: function sendAllPlayersToDimension( dimension ) if tonumber( dimension ) then -- Si hay una dimensión asignada... local players = getElementsByType( 'player' ) for i=1, #players do local player = players[i] setElementDimension( player, dimension ) end end end
-
¿Quizás getElementsByType?
-
[APORTE] Editor de archivo acl.xml | Con GUI DX
aka Blue replied to aka Blue's topic in Recursos y aportes
Damn que error xd. Aquí está el video: -
Bueno, en esta ocasión vengo a aportar un script, bastante sencillo pero útil a la hora de manejar nuestro archivo acl.xml, en cuanto a refrescar, guardar o añadir nuevos elementos a un grupo ACL. Esta versión cuenta también con un panel DX personalizado el cual podremos modificar sin ningún problema, así también con animaciones de 'hover' y agrandamiento de texto cuando el ratón esté por encima de los botones. El comando para abrir el panel se puede modificar en el archivo meta.xml, así también tenemos la posibilidad de ver quién ha usado el comando y para qué, teniendo un almacenamiento interno en una tabla, que podremos ver su contenido con el comando /viewTasks Clickea aquí para ir a la descarga directa del archivo, con las imágenes y todo lo necesario para iniciarlo correctamente Código meta.xml <meta> <script src="server.lua" type="server"/> <script src="client.lua" type="client"/> <file src="files/logo.png"/> <settings> <setting name="command" value="acleditor"/> </settings> <!-- Dont touch this. Are the permissions to use this script. We need specific permissions to reload and set permissions to acl --> <aclrequest> <right name="general.ModifyOtherObjects" access="true" /> <right name="function.aclReload" access="true" /> <right name="function.aclSetRight" access="true" /> <right name="function.aclGroupAddObject" access="true" /> <right name="function.aclGroupRemoveObject" access="true" /> <right name="function.aclGetGroup" access="true" /> <right name="function.aclSave" access="true" /> </aclrequest> </meta> Código client.lua local sx, sy = guiGetScreenSize( ) local sourceX, sourceY = 1366, 768 local open function isMouseInPosition ( x, y, width, height ) if ( not isCursorShowing ( ) ) then return false end local sx, sy = guiGetScreenSize ( ) local cx, cy = getCursorPosition ( ) local cx, cy = ( cx * sx ), ( cy * sy ) if ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) then return true else return false end end function drawEdits ( ) playerAccount = guiCreateEdit((626/sourceX)*sx, (495/sourceY)*sy, (225/sourceX)*sx, (24/sourceY)*sy, "", false) playerPermission = guiCreateEdit((626/sourceX)*sx, (529/sourceY)*sy, (225/sourceX)*sx, (24/sourceY)*sy, "", false) end function drawPanel ( ) -- Principal drawing: dxDrawRectangle((616/sourceX)*sx, (230/sourceY)*sy, (398/sourceX)*sx, (380/sourceY)*sy, tocolor(249, 115, 7, 45), false) -- Main window dxDrawImage((616/sourceX)*sx, (230/sourceY)*sy, (98/sourceX)*sx, (90/sourceY)*sy, ":acleditor/files/logo.png", 0, 0, 0, tocolor(255, 255, 255, 128), false) -- Script logo.png dxDrawText("ACL Editor | ACL manager tool\nEdit here your acl.xml file without\ncommands", (712/sourceX)*sx, (236/sourceY)*sy, (1014/sourceX)*sx, (320/sourceY)*sy, tocolor(255, 255, 255, 255), (sy/sourceY) * 0.39, "bankgothic", "center", "center", false, false, false, false, false) -- Button: reloadAcl if isMouseInPosition( (621/sourceX)*sx, (330/sourceY)*sy, (91/sourceX)*sx, (40/sourceY)*sy ) then dxDrawRectangle((621/sourceX)*sx, (330/sourceY)*sy, (91/sourceX)*sx, (40/sourceY)*sy, tocolor(249, 115, 70, 111), false) dxDrawText("Reload ACL", (621/sourceX)*sx, (331/sourceY)*sy, (712/sourceX)*sx, (370/sourceY)*sy, tocolor(255, 255, 255, 255), (sy/sourceY) * 0.32, "bankgothic", "center", "center", false, false, false, false, false) else dxDrawRectangle((621/sourceX)*sx, (330/sourceY)*sy, (91/sourceX)*sx, (40/sourceY)*sy, tocolor(249, 115, 7, 111), false) dxDrawText("Reload ACL", (621/sourceX)*sx, (331/sourceY)*sy, (712/sourceX)*sx, (370/sourceY)*sy, tocolor(255, 255, 255, 255), (sy/sourceY) * 0.29, "bankgothic", "center", "center", false, false, false, false, false) end -- Button: saveACL if isMouseInPosition( (621/sourceX)*sx, (389/sourceY)*sy, (91/sourceX)*sx, (40/sourceY)*sy ) then dxDrawRectangle((621/sourceX)*sx, (389/sourceY)*sy, (91/sourceX)*sx, (40/sourceY)*sy, tocolor(249, 115, 70, 111), false) dxDrawText("Save ACL", (621/sourceX)*sx, (390/sourceY)*sy, (712/sourceX)*sx, (429/sourceY)*sy, tocolor(255, 255, 255, 255), (sy/sourceY) * 0.32, "bankgothic", "center", "center", false, false, false, false, false) else dxDrawRectangle((621/sourceX)*sx, (389/sourceY)*sy, (91/sourceX)*sx, (40/sourceY)*sy, tocolor(249, 115, 7, 111), false) dxDrawText("Save ACL", (621/sourceX)*sx, (390/sourceY)*sy, (712/sourceX)*sx, (429/sourceY)*sy, tocolor(255, 255, 255, 255), (sy/sourceY) * 0.29, "bankgothic", "center", "center", false, false, false, false, false) end -- Button: addaclpermission if isMouseInPosition( (850/sourceX)*sx, (450/sourceY)*sy, (159/sourceX)*sx, (39/sourceY)*sy ) then dxDrawRectangle((850/sourceX)*sx, (450/sourceY)*sy, (159/sourceX)*sx, (39/sourceY)*sy, tocolor(249, 115, 70, 111), false) dxDrawText("Add acl group", (882/sourceX)*sx, (450/sourceY)*sy, (973/sourceX)*sx, (489/sourceY)*sy, tocolor(255, 255, 255, 255), (sy/sourceY) * 0.32, "bankgothic", "center", "center", false, false, false, false, false) else dxDrawRectangle((850/sourceX)*sx, (450/sourceY)*sy, (159/sourceX)*sx, (39/sourceY)*sy, tocolor(249, 115, 7, 111), false) dxDrawText("Add acl group", (882/sourceX)*sx, (450/sourceY)*sy, (973/sourceX)*sx, (489/sourceY)*sy, tocolor(255, 255, 255, 255), (sy/sourceY) * 0.29, "bankgothic", "center", "center", false, false, false, false, false) end -- Button: removeaclpermission if isMouseInPosition( (626/sourceX)*sx, (450/sourceY)*sy, (159/sourceX)*sx, (39/sourceY)*sy ) then dxDrawRectangle((626/sourceX)*sx, (450/sourceY)*sy, (159/sourceX)*sx, (39/sourceY)*sy, tocolor(249, 115, 70, 111), false) dxDrawText("Remove acl group", (660/sourceX)*sx, (450/sourceY)*sy, (751/sourceX)*sx, (489/sourceY)*sy, tocolor(255, 255, 255, 255), (sy/sourceY) * 0.32, "bankgothic", "center", "center", false, false, false, false, false) else dxDrawRectangle((626/sourceX)*sx, (450/sourceY)*sy, (159/sourceX)*sx, (39/sourceY)*sy, tocolor(249, 115, 7, 111), false) dxDrawText("Remove acl group", (660/sourceX)*sx, (450/sourceY)*sy, (751/sourceX)*sx, (489/sourceY)*sy, tocolor(255, 255, 255, 255), (sy/sourceY) * 0.29, "bankgothic", "center", "center", false, false, false, false, false) end -- Button: close panel if isMouseInPosition( (765/sourceX)*sx, (559/sourceY)*sy, (91/sourceX)*sx, (40/sourceY)*sy ) then dxDrawRectangle((765/sourceX)*sx, (559/sourceY)*sy, (91/sourceX)*sx, (40/sourceY)*sy, tocolor(249, 115, 70, 111), false) dxDrawText("Close panel", (907/sourceX)*sx, (730/sourceY)*sy, (712/sourceX)*sx, (432/sourceY)*sy, tocolor(255, 255, 255, 255), (sy/sourceY) * 0.35, "bankgothic", "center", "center", false, false, false, false, false) else dxDrawRectangle((765/sourceX)*sx, (559/sourceY)*sy, (91/sourceX)*sx, (40/sourceY)*sy, tocolor(249, 115, 7, 111), false) dxDrawText("Close panel", (907/sourceX)*sx, (730/sourceY)*sy, (712/sourceX)*sx, (432/sourceY)*sy, tocolor(255, 255, 255, 255), (sy/sourceY) * 0.35, "bankgothic", "center", "center", false, false, false, false, false) end -- Info dxDrawText("Account", (856/sourceX)*sx, (495/sourceY)*sy, (1009/sourceX)*sx, (516/sourceY)*sy, tocolor(255, 255, 255, 255), (sy/sourceY) * 0.59, "bankgothic", "center", "center", false, false, false, false, false) dxDrawText("ACL Group", (856/sourceX)*sx, (529/sourceY)*sy, (1009/sourceX)*sx, (550/sourceY)*sy, tocolor(255, 255, 255, 255), (sy/sourceY) * 0.59, "bankgothic", "center", "center", false, false, false, false, false) dxDrawText("Using this button you can reload your acl\nto add the new permissions inside the file", (715/sourceX)*sx, (330/sourceY)*sy, (1014/sourceX)*sx, (370/sourceY)*sy, tocolor(255, 255, 255, 255), (sy/sourceY) * 0.29, "bankgothic", "center", "center", false, false, false, false, false) dxDrawText("Using this button you can save your acl\nfile ingame", (715/sourceX)*sx, (389/sourceY)*sy, (1014/sourceX)*sx, (429/sourceY)*sy, tocolor(255, 255, 255, 255), (sy/sourceY) * 0.29, "bankgothic", "center", "center", false, false, false, false, false) end function closeAll( ) if isElement(playerAccount) then destroyElement( playerAccount ) end if isElement(playerPermission) then destroyElement( playerPermission ) end removeEventHandler( "onClientRender", getRootElement( ), drawPanel ) open = nil showCursor( false ) end addEventHandler( "onClientClick", getRootElement( ), function( button, state ) if button == "left" and state == "down" and open == true then local boton_reloadACL = isMouseInPosition( (621/sourceX)*sx, (330/sourceY)*sy, (91/sourceX)*sx, (40/sourceY)*sy ) local boton_saveACL = isMouseInPosition( (621/sourceX)*sx, (389/sourceY)*sy, (91/sourceX)*sx, (40/sourceY)*sy ) local boton_close = isMouseInPosition( (765/sourceX)*sx, (559/sourceY)*sy, (91/sourceX)*sx, (40/sourceY)*sy ) local boton_addAcl = isMouseInPosition( (850/sourceX)*sx, (450/sourceY)*sy, (159/sourceX)*sx, (39/sourceY)*sy ) local boton_removeAcl = isMouseInPosition( (626/sourceX)*sx, (450/sourceY)*sy, (159/sourceX)*sx, (39/sourceY)*sy ) -- Edits local account_name = guiGetText( playerAccount ) local group_name = guiGetText( playerPermission ) if boton_reloadACL then triggerServerEvent( "acleditor:reloadACL", getLocalPlayer( ), getLocalPlayer( ) ) elseif boton_saveACL then triggerServerEvent( "acleditor:saveACL", getLocalPlayer( ), getLocalPlayer( ) ) elseif boton_addAcl then if #account_name > 1 then if #group_name > 0 then triggerServerEvent( "acleditor:givePermission", getLocalPlayer( ), getLocalPlayer( ), account_name, group_name ) else outputChatBox( "You need to add the name of the group you wanna add", 255, 145, 0 ) end else outputChatBox( "Add the account name you need to set", 255, 145, 0 ) end elseif boton_removeAcl then if #account_name > 1 then if #group_name > 0 then triggerServerEvent( "acleditor:removePermission", getLocalPlayer( ), getLocalPlayer( ), account_name, group_name ) else outputChatBox( "You need to add the name of the group you wanna remove from", 255, 145, 0 ) end else outputChatBox( "Add the account name you need to remove", 255, 145, 0 ) end elseif boton_close then closeAll( ) end end end ) addEvent( "acleditor:openPanel", true ) addEventHandler( "acleditor:openPanel", getRootElement( ), function( ) if open == nil then drawEdits( ) addEventHandler( "onClientRender", getRootElement( ), drawPanel ) open = true showCursor( true ) end end ) bindKey( "m", "down", function( ) if isCursorShowing( ) then showCursor( false ) else showCursor( true ) end end ) Código server.lua local _aclRequestTimer = { } local _aclTasks = { } local commandName = get( "command" ) -- This gets the commandName setting from meta.xml addCommandHandler( commandName, function( player ) local account = getPlayerAccount( player ) local permission = isObjectInACLGroup( "user."..getAccountName(account), aclGetGroup( "Admin" ) ) if account then if permission then triggerClientEvent( player, "acleditor:openPanel", player ) table.insert( _aclTasks, { task = "ACLOpen", name = getPlayerName( player ) } ) end else outputChatBox( "Fatal error, you dont have an account on this server.", player, 255, 145, 0 ) end end ) addCommandHandler( "viewTasks", function( player ) local tasks = _aclTasks local havePermissions = hasObjectPermissionTo( player, "command.viewTasks" ) or isObjectInACLGroup( "user."..getAccountName( player ), aclGetGroup( "Admin" ) ) if havePermissions then outputChatBox( "Tasks: ", player, 255, 255, 255 ) for i=1, #tasks do local data = tasks[i] outputChatBox( "• Task: "..data.task.." | Player: "..data.name, player, 255, 145, 0 ) end end end ) addEvent( "acleditor:givePermission", true ) addEventHandler( "acleditor:givePermission", getRootElement( ), function( player, accountName, groupName ) local accountName = table.concat( { accountName }, " " ) local groupName = table.concat( { groupName }, " " ) if accountName and groupName then local exists = aclGetGroup( groupName ) if exists then local is_in_group = isObjectInACLGroup( "user."..accountName, exists ) if is_in_group then outputChatBox( "• The account is currently in the ACL", player, 0, 255, 0 ) else outputChatBox( "• Added user."..accountName.." to group "..groupName.." succefully.", player, 0, 255, 0 ) aclGroupAddObject( exists, "user."..accountName ) table.insert( _aclTasks, { task = "ACLAdd", name = getPlayerName( player ) } ) end else outputChatBox( "• The specified group dont exists in your acl.xml", player, 255, 145, 0 ) end end end ) addEvent( "acleditor:removePermission", true ) addEventHandler( "acleditor:removePermission", getRootElement( ), function( player, accountName, groupName ) local accountName = table.concat( { accountName }, " " ) local groupName = table.concat( { groupName }, " " ) if accountName and groupName then local exists = aclGetGroup( groupName ) if exists then local is_in_group = isObjectInACLGroup( "user."..accountName, exists ) if is_in_group then aclGroupRemoveObject( exists, "user."..accountName ) outputChatBox( "• Removed user."..accountName.." from group "..groupName.." succefully.", player, 0, 255, 0 ) table.insert( _aclTasks, { task = "ACLRemove", name = getPlayerName( player ) } ) else outputChatBox( "• The account user."..accountName.." is not in the specified group.", player, 255, 145, 0 ) end else outputChatBox( "• The specified group dont exists in your acl.xml", player, 255, 145, 0 ) end end end ) addEvent( "acleditor:reloadACL", true ) addEventHandler( "acleditor:reloadACL", getRootElement( ), function( player ) local name = getPlayerName( player ) local success = aclReload( ) if success then if _aclRequestTimer[ player ] == nil then outputChatBox( "Reloaded acl.xml file succefully.", player, 255, 145, 0 ) _aclRequestTimer[ player ] = setTimer( function( ) _aclRequestTimer[ player ] = nil end, 2000, 1 ) table.insert( _aclTasks, { task = "Reload", name = name } ) else outputChatBox( "Do not flood the button, please. Wait "..math.floor(getTimerDetails( _aclRequestTimer[ player ] )/1000).." seconds.", player, 255, 145, 0 ) end else outputChatBox( "An error ocurred. Check if the acl.xml file exists", player, 255, 145, 0 ) end end ) addEvent( "acleditor:saveACL", true ) addEventHandler( "acleditor:saveACL", getRootElement( ), function( player ) local name = getPlayerName( player ) local success = aclSave() if success then if _aclRequestTimer[ player ] == nil then outputChatBox( "Saved acl.xml file succefully.", player, 255, 145, 0 ) _aclRequestTimer[ player ] = setTimer( function( ) _aclRequestTimer[ player ] = nil end, 2000, 1 ) table.insert( _aclTasks, { task = "Save", name = name } ) else outputChatBox( "Do not flood the button, please. Wait "..math.floor(getTimerDetails( _aclRequestTimer[ player ] )/1000).." seconds.", player, 255, 145, 0 ) end else outputChatBox( "An error ocurred. Check if the acl.xml file exists", player, 255, 145, 0 ) end end )
-
Very good work, i love it. I will change the white color, but, its good.
- 84 replies
-
- mtasa
- forum stuff
-
(and 5 more)
Tagged with:
-
Ni idea , pero cualquier cosa, supongo que tienes el mío privado, así que pregunta por ahi.
-
¿How can i get the text of the edit?...
-
Nunca entendí muy bien esto del sqlite, pensé que estaba bien eso pero parece que no. Entonces, seria así como tengo que hacer el update: dbQuery("UPDATE position WHERE 'x' =".. X) ? No. Debes crear un row que sea, igual que modelID (que sea INT) pero haciendo referencia al index o ID. De ahí ya cuando vayas haciendo update haces: WHERE ID = ..id. Así es como se hace correctamente.
-
Borra la carpeta 'parasite' de Resources. Para el desban, entra en la base de datos, wcf1_user y ahí en tu ban pones 0. Ya en el banlist.xml que se encuentra en la carpeta deathmatch del servidor, borras tus datos. Si necesitas más ayuda, blue.pie3 es mi skype.
-
Lo estoy revisando y el código está fatal. Cuando tu usas un UPDATE debe haber un WHERE donde diga el objeto o ID en cuestión que estás modificado, en tu caso, no hay nada de eso. El INSERT TO, te debe devolver el Index o 'k' del nuevo objeto insertado en la tabla, el cual, debes almacenar en una tabla IG con index el objeto. Es algo difícil de explicar si no tienes mucha idea. Si tengo tiempo y ganas después, te paso el codigo hecho.
-
¿Pero se guardan en la base de datos, has visto si se almacenan? Si se almacenan y no se crean es que no los cargas correctamente. Esto es lo más chapucero que he hecho por el momento, pero espero que te puedas hacer una idea... Algo así pero más complicado usaba mi sistema de muebles Roleplay: local muebles = { } local mueblesID = { } function crearNuevaID( ) if #muebles > 0 then -- Si la longitud de la tabla es mayor a 1, es decir, hay alguna id... return #muebles + 1 else return 1 -- En caso contrario, la ID sería 1 end end function crearObjeto( ) local nuevaid = crearNuevaID( ) local objeto = createObject... muebles[ nuevaid ] = objeto mueblesID[ objeto ] = nuevaid end Luego esto lo almacenas en la base de datos y lo cargas, haciendo un loop del result e introduciendo todo en la tabla muebles y mueblesID con su respectiva id, etc.
-
outputChatBox ("Cargando objetos...", soure, 255, 255, 255) ¿Soure? ¿Guat? Hazlo por tablas, dios. Es un maldito lío el que te estás montando y en verdad es una tontería. Cuando se cree el objeto que se inserte en una tabla, después loopeas y guardas los objetos guardados en dicha tabla, así tienes el objeto por tabla y su k o index en otra...
-
En ningún momento dije que la borres, sólo que la pases por aquí, porque no todos manejamos el freeroam
-
Lo que te indica es que en la línea 230, se espera un valor positivo, en cambio, hay uno negativo, el cual, en futuras versiones se transformará en un error. Entra en el archivo fr_server.lua y pasa la línea 230.
-
So nice, i love it. ¿There are any server with that gamemode or...?
-
A lo mejor puedes entender algo con estas imagenes, aparte con lo que te dijo zorro, de lo que servían las funciones.
-
¿Vehicle col? ¿What? You can check if the entered element is a player in vehicle and destroy his wheels...