-
Posts
6,097 -
Joined
-
Last visited
-
Days Won
218
Posts posted by IIYAMA
-
-
On 07/03/2025 at 20:35, XeroXipher said:
So instead of doing dxDrawText("Text", x*1210, y* 130... ) I could do dxDrawText("Text", x*20, y* 10.. )
There is also this useful function:
https://wiki.multitheftauto.com/wiki/GetScreenStartPositionFromBox
-
1
-
-
Thank you for your support to the community, it was an honor to have met you and I hope we meet again one day.
I wish you the best of luck!
-
1
-
-
7 hours ago, MrCode said:
Thanks IIYAMA, FindRotation3D worked for the getting rotation.
Did not achieve the desired result with a rocket projectile (19) though. Even after rotating it directly at point_B the projectile eventually starts heading out in a different direction, not exactly sure whats up with that. I think an easy way to fix that is using createObject along with moveObject and stuff, but in this case, what should I use to properly send projectiles from point A to point B since createProjectile only has starting position arguments to work with?Are you using this function?
https://wiki.multitheftauto.com/wiki/CreateProjectile
Attach a dummy vehicle to the object and set the vehicle as the creator of the projectile.
Because else your camera is used for the direction.
-
3 hours ago, MrCode said:
The problem is, or what I would really like achieve in this example snippet is, rotating our test object (AK-47) so that it is pointing directly at "Point_B".
See:
-
1
-
-
10 hours ago, XeroXipher said:
how do I freeze camera when in Menu's (like a Custom Menu on F2) or Radar Map on F11?
By showing the cursor: https://wiki.multitheftauto.com/wiki/ShowCursor
Though setCameraMatrix might also be possible, but you will have to reset the camera.
-
1
-
-
3 hours ago, XeroXipher said:
But how do I render the HUD without onClientRender()?
As Justn and me mentioned:
On 14/02/2025 at 18:34, IIYAMA said:Just a thing that can lead up to a crash:
- By putting dxCreateFont/dxCreateTexture/dxCreateScreenSource(everything with Create in it's name) inside of an onClientRender triggered function
Move this line to the top of your code:
16 hours ago, XeroXipher said:local Inventory = dxCreateTexture("Inventory.png")
Like this:
local sx,sy = guiGetScreenSize() local px,py = 1600,900 local x,y = (sx/px), (sy/py) local Inventory = dxCreateTexture("Inventory.png") -- just put it here and not inside of HUDDrawing. function HUDDrawing() --[[ ... ]]
-
15 hours ago, XeroXipher said:
I think that's why it is crashing.
Is there a better way to use dxDrawRect and dxDrawText then onClientRender?
The following functions shouldn't cause crashes:
https://wiki.multitheftauto.com/wiki/DxDrawRectangle
https://wiki.multitheftauto.com/wiki/DxDrawText
But you most likely did crash because of a memory leak. To find the reason I will need to look at your code for that.
Just a thing that can lead up to a crash:
- By putting dxCreateFont/dxCreateTexture/dxCreateScreenSource(everything with Create in it's name) inside of an onClientRender triggered function
-
setGlitchEnabled("quickreload", true)
https://wiki.multitheftauto.com/wiki/SetGlitchEnabled
You could the enable the quickreload glitch.
For testing:
/start runcode /srun setGlitchEnabled("quickreload", true) -
On 21/01/2025 at 19:10, MrCode said:
So perhaps fileExists being used onClientRender
I wouldn't run that function either in combination with onClientRender.
Since you are fetching the file from another resource, you could increase or decrease the download priority for either resource.
https://wiki.multitheftauto.com/wiki/Meta.xml
Or just wait a little bit longer before start rendering.
(I also recommend to convert the image into a texture before rendering) -
5 hours ago, Xavier Andaya said:
because my account i dont know anymore
Can't you better change the password?
https://wiki.multitheftauto.com/wiki/Server_Commands#chgpass
chgpass <accountname> <password>
(using the console)
Else:
https://wiki.multitheftauto.com/wiki/Server_Commands#delaccount
delaccount <accountname>
(using the console)
-
On 01/01/2025 at 05:08, bravura said:
but I don't know if you can put common resources and systems on it.
You could check out these files/resources:
https://github.com/gta191977649/MTA-VCS/tree/main/mods/deathmatch/resources/[vcs]Download able at root: https://github.com/gta191977649/MTA-VCS/tree/main
Though you have to verify yourself if this is a good source or not. I only Googled it for you.
-
27 minutes ago, bravura said:
Sorry, to be honest I don't know
14 hours ago, bravura said:from the console I can do everything
The Console has full access, so it might be possible that you currently have no access to begin with.
Steps to add the initial admin account (later on you can add more admins ingame using the User Interface):
-
Stop the server
-
Open the ACL file: MTA San Andreas 1.6\server\mods\deathmatch\acl.xml
-
Make a back up of this ACL file
-
Scroll to (in the original one):
<group name="Admin"> <acl name="Moderator"></acl> <acl name="SuperModerator"></acl> <acl name="Admin"></acl> <acl name="RPC"></acl> <object name="resource.admin"></object> <object name="resource.webadmin"></object> <object name="resource.acpanel"></object> </group>
-
Add an account looking like this:
<object name="user.example"></object>
Replace example with your username even if the account does not exist yet. (keep it simple)
And add it like this:<group name="Admin"> <acl name="Moderator"></acl> <acl name="SuperModerator"></acl> <acl name="Admin"></acl> <acl name="RPC"></acl> <object name="resource.admin"></object> <object name="resource.webadmin"></object> <object name="resource.acpanel"></object> <object name="user.example"></object> </group>
-
Save the file
-
Start the server again (if you broke the syntax of the file, the server will not start, that is why step 3 so you can start over)
-
Go ingame
- Add the account if not exist: /register <example username> <new password>
- /login <example username> <current password>
-
Stop the server
-
12 hours ago, bravura said:
from the console I can do everything
There is a difference in the panel and command access.
This is for example a part of the rights for Moderators.
<acl name="Moderator"> <right name="general.ModifyOtherObjects" access="false"></right> <right name="command.gamemode" access="true"></right> <right name="command.changemode" access="true"></right> <right name="command.changemap" access="true"></right> <right name="command.stopmode" access="true"></right> <right name="command.stopmap" access="true"></right> <right name="command.skipmap" access="true"></right> <right name="command.mute" access="true"></right> <right name="command.unmute" access="true"></right> <right name="command.whois" access="true"></right> <right name="command.whowas" access="true"></right> <right name="function.setPlayerMuted" access="true"></right> <right name="function.kickPlayer" access="true"></right> <right name="function.banPlayer" access="true"></right> <right name="function.getBans" access="true"></right> <right name="function.addBan" access="true"></right> <right name="function.startResource" access="true"></right> <right name="function.stopResource" access="true"></right> <right name="function.restartResource" access="true"></right> <right name="function.refreshResources" access="true"></right> <right name="function.redirectPlayer" access="true"></right> <right name="general.adminpanel" access="true"></right> <right name="general.tab_players" access="true"></right> <right name="general.tab_resources" access="false"></right> <right name="general.tab_maps" access="false"></right> <right name="general.tab_server" access="true"></right> <right name="general.tab_bans" access="false"></right> <right name="general.tab_adminchat" access="true"></right>
<right name="command.mute" access="true"></right> <right name="general.tab_bans" access="false"></right>
You can see that the moderator can mute a player using /mute, but does not have access to the ban tab.
How did you grand yourself access rights?
-
2 hours ago, Lus said:
Hello I'm new here
Hi Lus, good to have you!
It is recommended to read these guidelines, this information will help you in many ways to get the right answers for your questions.
-
Just a little details, it is actually the hidden argument 'warp' that is responsible for the cancellation. In the past this argument was not present and was applied by default.
-
12 minutes ago, Firespider said:
function tp(player, cmd, ID) if getElementData(player, "Player.AdminLevel") > 1 then local players = getElementsByType ( "player" ) if tonumber(ID) then for i, p in ipairs(players) do print(getElementData(p, "Player.ID")) if getElementData(p, "Player.ID") == tonumber(ID) then local x, y, z = getElementPosition(p) setElementPosition(player, x, y, z) else outputChatBox("#000000<#910e07Wise#ffffffRolePlay#000000> #ffffff Rossz ID-t adtál meg.", player, 255, 255, 255, true) end end end end end
---@param ID number ---@return player | nil function findPlayerByID(ID) local players = getElementsByType ( "player" ) for i, p in ipairs(players) do if getElementData(p, "Player.ID") == ID then return p end end end ---@param player element ---@param cmd string ---@param rawID string | nil function tp(player, cmd, rawID) -- Admin level check if getElementData(player, "Player.AdminLevel") <= 1 then return end local ID = tonumber(rawID) if type(ID) ~= "number" then outputChatBox("#000000<#910e07Wise#ffffffRolePlay#000000> #ffffff /gethere [ID]", player, 255, 255, 255, true) return end local targetPlayer = findPlayerByID(ID) if not targetPlayer then outputChatBox("#000000<#910e07Wise#ffffffRolePlay#000000> #ffffff Rossz ID-t adtál meg.", player, 255, 255, 255, true) return end local x, y, z = getElementPosition(targetPlayer) setElementPosition(player, x, y, z) end
-
41 minutes ago, Firespider said:
I using that
Oke, in that case please show me the code so that I can check if it is applied correctly.
-
1 minute ago, Firespider said:
but it always says 3 times that I entered the wrong ID
On 27/11/2024 at 21:41, Firespider said:if tonumber(ID) then
You should move this condition before the loop
and if it fails,
do the outputChatBox + return statement.
-
23 minutes ago, Firespider said:
Could you explain what this code does?
It inserts a row into the database and returns the generated primary key.
But most of it are just examples for you to apply in to your own code. (also not tested, I haven't combined insert + update with the multipleResults statement myself)
If something is unclear, please be specific in which part or function you do not understand. Then I will explain how that part/function works.
-
25 minutes ago, Firespider said:
MYSQL
In that case you can try to work with the following building blocks. (untested)
local userName = "root" local password = "root" local host = "127.0.0.1" local db = dbConnect( "mysql", host, userName, password, "multi_statements=1" -- optional ) -- ... local player -- = ??? local serial = 1234567890 if db then dbQuery(onRegisterPlayer, {player}, db, [[ INSERT INTO characters (serial) VALUES (?) ON DUPLICATE KEY UPDATE id=VALUES(id); ]], serial) end -- ... ---@param queryHandle userdata ---@param player userdata function onRegisterPlayer(queryHandle, player) if not isElement(player) then return end local multipleResults = true -- return the id of the inserted row local result = dbPoll(queryHandle, -1, multipleResults) if not result then --- Something went wrong error("Failed to register player") return end iprint("Table", result[1]) iprint("Affected rows", result[2]) iprint("Last insert id", result[3]) end
-
8 hours ago, Firespider said:
At each entry, you set a SetElementData for the value of the ID table
And at what point do you save the character?
After filling in info of some sort?
8 hours ago, Firespider said:local dq = dbQuery(db, "SELECT * FROM characters WHERE serial=?", serial)
Are you using SQLite or MySQL?
-
2 hours ago, Firespider said:
So I have the problem that every player gets an ID with setElementData when, for example, ID 1 appears based on the primary row of the SQL table But when the command is entered on the server, the system only works with a player with a specific ID, e.g. we can TP the player with a specific ID, etc.
So you mean the user case when no ID is assigned to a new player?
Based on what criteria are you assigning the ID?
-
1 hour ago, Firespider said:
Yes, but does it need a name argument? However, I would like to solve it with ID
It does indeed
In that case, could you explain the following with some more context?
3 hours ago, Firespider said:problem is that the players have an ID, but the system only detects the individual ID
It is unclear what an `individual ID` is in the current context.
-
6 minutes ago, Firespider said:
But that returns a name, doesn't it?
No, it returns a player<element> or nil
function getPlayerFromPartialName(name) local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil if name then for _, player in ipairs(getElementsByType("player")) do local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower() if name_:find(name, 1, true) then return player end end end end local name = "IIYAMA" local player = getPlayerFromPartialName ( name ) if player then -- Found else -- Not found end

Is there an easier way to be doing dxTextDraw?
in Scripting
Posted
Haha, I also updated it just for you XD