Investor
Members-
Posts
111 -
Joined
-
Last visited
Everything posted by Investor
-
You'll probably need to use base64Encode and base64Decode (this will inflate file size to about 133% [difference is higher with very small sizes like single character being inflated to 4 characters, 300% increase] of the original) for the files, as it appears the data is not tea-encrypted properly (somewhat known issue with teaEncode/teaDecode and encoding control characters 0-30 and others, so keep it to being strictly alphanumeric [base64 is a good candidate]); this in turn causes the function to interpret the input as a filepath rather than raw (decrypted) data. Another option is encodeString/decodeString; these functions have worked more reliably for me at least with non-alphanumeric content.
-
onClientPlayerQuit isn't called for the localPlayer. You should use onClientResourceStop (that will call when the resource is either stopped, or the client disconnects and the resource stops on his end).
-
If you're looking for the Z rotation (bearing, yaw) between two points: findRotation. If you need the local Y (pitch) it can be computed in a similar way to findRotation. The local X (roll) rotation is not defined, so to speak, when looking towards another 3D position (i.e. it can be anything) unless you introduce some additional reference point perhaps.
-
You can poll for data using the Java SDK. If you want to send unsolicited data, you'll probably need to use a fetchRemote or callRemote to a webserver and pipe that into your Java SDK (if that's possible, have never tried)
-
Months have variable length so I wouldn't advise using that. If you need to, use the average month length which is actually slightly >30 days, meaning 2592000 seconds (more more accurately, 30.44 days = 2630016 seconds) in a month. local years = math.floor(remaining_time / 31557600) local months = math.floor((remaining_time % 31557600) / 2592000) local days = math.floor((remaining_time % 2592000) / 86400) local hours = math.floor((remaining_time % 86400) / 3600) local mins = math.floor((remaining_time % 3600) / 60) local secs = math.floor(remaining_time % 60)
-
If you're asking for time remaining until a specific target timestamp, then local target = --[[ some timestamp ]] local current = getRealTime().timestamp local remaining_time = target - current local hours = math.floor((remaining_time % 86400) / 3600) local mins = math.floor((remaining_time % 3600) / 60) local secs = math.floor(remaining_time % 60)
-
Are they running the same version? I remember a while back MTA included extra protections on HTTP logins requiring an IP associated with an authorized serial, or a httppass being postfixed to a user password. Disabling login can be done via ACLs if you so wish, but this is a security risk. You may open up the webadmin or HTTP runcode to unauthorized users this way. Adding resource.vitaStream.http in Default ACL rights (with access="true" of course) will open up http://serverip:port/vitaStream/* (including vitaStream/call/functionName which can call exported functions with http="true") to anyone without login.
-
Are both servers running the same version with the same mtaserver.conf? The title mentions connection flood - that is related to httpdosthreshold and http_dos_exclude which limit how often an IP can make a request (to prevent denial of service attacks originating from one IP) - but the contents of the post make no mention of it, concentrating on logins; would be helpful if you clarified what exactly is the problem.
-
dxDrawImage on line 4 is rotated, but dxDrawRectangle on line 14 isn't (and cannot). This can be overcame by using another rendertarget, or by rotating the whole RT with radarareas in it, instead of just the map image. Former solution requires two RTs, latter solution will not look good without alphamasking or something. A third, possible solution would be to use dxDrawPrimitive or dxDrawMaterialPrimitive (not sure whether the first one fills or not) instead of rectangles. Then you just need to calculate the positions of the 4 vertices (not so complicated trigonometry) instead of trying to rotate them.
-
The main problem you're having is that the dx rectangle does not rotate. You need to to align with the map. The easiest way to do this is to render the map in a rendertarget (RT), and render radar areas directly onto that (without any width or height transformations), then render the RT with the correct rotation in the corner (perhaps alpha-masked via a shader as well), and above that, the blips.
-
I've heard some say that custom event triggers may be slower than element data when it comes to syncing up with clients unless you only do it when necessary rather than on each change. If you're intending on sharing the data on the server-side only, you should simply set the 4th argument to false in setElementData. Exported functions travel from one LuaVM through C/C++ into a different LuaVM and back to your resource via C/C++. This is slower than simply using element data which only goes from LuaVM to C/C++ and back to your LuaVM (LuaVM is an instance of Lua being run under the hood, separating Lua contexts between resources). As long as you don't sync set element data, it would provide better speed than custom system with exports. A custom system would probably run faster if you keep everything in one resource though, but that's at the price of modularity.
-
I was gonna say you could try dxDrawPrimitive for this, but it's no good if you want curved edges, so you probably want a mask shader, perhaps using dxDrawPrimitive to generate the part which follows the cursor. You'll need to use either trianglestrip or trianglefan.
-
Line 528 et seq if elementBackpack[source] then detachElementFromBone(elementBackpack[source]) destroyElement(elementBackpack[source]) end should be if elementBackpack[source] then detachElementFromBone(elementBackpack[source]) destroyElement(elementBackpack[source]) elementBackpack[source] = false end and that should fix it. Problem was removeAttachedOnDeath not marking the backpack as removed and the code trying to remove it again when it did not exist anymore.
-
Also don't just post the whole code but narrow in on the couple of lines that are relevant. Don't just state what the error is, state when it occurs, what happens and what was supposed to happen. We can easily solve the error message popping up by sort of suppressing it, but that doesn't solve the underlying issue (if there is any). If there's no problems at all, just error/warning spam, then say that. Don't just drop the code down here like its a mailbox. Easy fix: Remove line 88. No error anymore. But that's not helpful. Tell us what you want and we'll tell you how to do it. 'destroyElement' occurs 81 times in the shared code. How are we supposed to find the one you're talking about without line numbers? If you bothered reading the guidelines you'd had known adding code snipped tags will give us line numbers.
-
Well, the source code seems to suggest that that should work. It was added in 1.5.4 on February 22, 2017. Are you sure you're running the latest version of both client and server? You should probably check if it works on other servers or something, and if so, perhaps this needs to be reported as a bug.
-
local theTeam = "Thugs" local players = getPlayersInTeam(getTeamFromName(theTeam)) -- this part will break with debug error, getPlayersInTeam expecting team got nil, if a team under that name does not exist if (#players >= 5) then -- count (#) the values in the table outputChatBox("Thugs: There are already 5 of your members ",source) end
-
ACLs are uniform and convenient - and integrate very well between multiple resources (especially community resources), while custom permissions would likely require exports, and thus can become broken if the permissions resource isn't turned on in time, for example. If you use the default MTA account system, there's no reason not to use ACLs. If you have your own accounts system, it's entirely up to you, but ACL integration is useful, especially due to being separate from the database -- if someone makes unauthorised database changes, ACLs are unaffected, and vice versa, when ACLs are changed, the database remains unaffected.
-
How about setTimer( function() if not clearing_nonexisting_peds or coroutine.status (clearing_nonexisting_peds) == "dead" then clearing_nonexisting_peds = coroutine.create(forgetNonExistingPeds) end coroutine.resume(clearing_nonexisting_peds) end, 1000, 0 )
-
I need information. I want the information to be complete when you create the topic. I need information because I don't understand your topic. If you "need script because you don't understand mtawiki.com" then I'm afraid you're in the wrong place. If you want someone else to do it for them, you better pay, or go look on Facebook maybe you'll have more luck there.
-
I'm afraid I can't understand what you need. If possible, please try to rephrase the question, or seek support in your native language forum.
-
For me, this link directs to youtubeinmp3.com which is a nonexistent domain name as it "might be temporarily down or it may have moved permanently to a new web address. (ERR_NAME_RESOLUTION_FAILED)" You can try addEventHandler("onClientSoundStream", root, function(succ, length, streamN, err) if not succ then outputChatBox("Sound: "..streamN.." failed to start: "..err,100,0,0) end end ) to see the reason for the failure to download/stream it.
-
Trigger a custom event from A to B (e.g. "onRequestAccountDetails") B handles the event, and calculates a return Trigger a custom event back from B to A with the return value along it (e.g. "onReceiveAccountDetails") A handles this as if it were a callback function You can make your life easier by writing a wrapper that handles this as if it was proper callbacks, keeping a table that maps requests to callback functions, and calls them when the returning event comes, along with the return value. The other option is coroutines, which, while being a lot more complicated, allow you to pause ("yield") the execution of a script until the return value arrives from the other end, and returns the value as a return of a simple call. This imitates a blocking function, which pauses execution of the Lua script (doesn't freeze the whole client) until the return is available, as opposed to the traditional use of asynchronous functions that work via callbacks. This is because events are asynchronous, meaning it takes quite a bit of time for the data to travel from the client to the server or vice versa, longer than the execution of one instruction - so you either have to pause execution, or end the function at some point and continue on in a callback handler function when the return is ready.
- 1 reply
-
- 1
-
The variable "shaderElement" refers to a different shader element than the "shaderElement" you've applied to world texture. Thus, this statement is inaccurate Specifically, the shaderElement at engineRemoveShaderFromWorldTexture is a shader that has just been created on line 31, rather than the one created and applied in lines 11 and 15. If you keep a reference to the shader in a table (named 'shaders' in example below), and insert every created shader into that table under a key of the element who which you've applied it, you'll be able to refer to it later on in different parts of the code. local shaders = {} function applyShader ( element, table, _type) if shaders[elem] then outputDebugString("Attempted to call applyShader when a shader is already applied") return end -- this blocks applying two shaders on the same element for index, value in pairs ( table ) do if ( index == 1 ) then model = value elseif ( index == 2 ) then textureName = value elseif ( index == 3 ) then texturePath = value end end shaders[element] = dxCreateShader ( "shader/shader.fx", 0, 0, false, _type == "skin" and "ped" or "vehicle" or "object" ) local textureElement = dxCreateTexture ( _type.."/textures/"..texturePath ) if ( shaders[element] and textureElement ) then dxSetShaderValue ( shaders[element], "Tex0", textureElement ) engineApplyShaderToWorldTexture ( shaders[element], textureName, element ) end end addEvent("shaders.applyShader", true) addEventHandler("shaders.applyShader", root, applyShader) function removeShader ( element, table, _type) for index, value in pairs ( table ) do if ( index == 1 ) then model = value elseif ( index == 2 ) then textureName = value elseif ( index == 3 ) then texturePath = value end end if ( shaders[element] and textureElement ) then engineRemoveShaderFromWorldTexture ( shaders[element], textureName, element ) destroyElement(shaders[element]) -- don't forget to destroy the shader shaders[element] = nil end end addEvent("shaders.removeShader", true) addEventHandler("shaders.removeShader", root, removeShader) If you need this to handle multiple shaders, you'll probably need to change how they're stored in the table, as this one only allows one shader to be stored at a time, and I'll leave that as an exercise for yourself.
-
MTA doesn't destroy vehicles on disconnect, so it must be a script, and if you didn't write that in this resource than it's some other resource causing this.