-
Posts
1,060 -
Joined
-
Last visited
-
Days Won
9
Everything posted by Addlibs
-
since Vehicle is a lua table, you can for-loop it and you'll get all the functions as values, and function names as keys. local funcnames = {} --set up a table to store the names of the functions for k, v in pairs(Vehicle) do --loop all of the methods in Vehicle table if type(v) == "function" then --make sure this is a function, not a variable table.insert(funcnames, k) --add the function name to the new table end end local list = table.concat(funcnames, ", ") --concatenate all of the names in the table into a comma seperated list local truncated = list:sub(1,100) --truncated so it doesn't exceed chatbox message limit outputChatBox(truncated)
-
You could just you just use triggerClientEvent(thePlayer, "addNotification", thePlayer, theMessage, theType) instead of an exported function.
- 15 replies
-
- notif
- notifacition
- (and 6 more)
-
Are you sure that's the correct syntax for the rangos_bejelentkezes resource's addNotification function? Could you show us that function from that resource?
- 15 replies
-
- notif
- notifacition
- (and 6 more)
-
We can help you, but we will not write the code ourselves. At least show us your attempt and we'll build on it. Also, this topic's title could be a little more descriptive if you want people to even visit this topic.
-
--serverside, line 4: local currentPlayerLevel = getElementData(player,"pLevel" or 0) --should be: local currentPlayerLevel = tonumber(getElementData(player,"pLevel")) or 0
-
I'm sure its possible to remove all lights with a shader (not so sure if exceptions are possible), and removeWorldModel can be used to remove all time-based alpha models of buildings' windows lights
-
createPed createVehicle warpPedIntoVehicle setPedControlState Should be enough to get you started.
-
You could try a for-loop on getAllAccounts() but with that many accounts it will probably freeze up your server and maybe even get aborted by MTA for taking too long to execute, so you should limit how many accounts it does every second or so.
-
To be honest, I'd suggest cancelEvent(true) onPlayerConnect instead of issuing bans... Your idea will surely spam the f- out of your banslist.
-
Looping through the vehicles returns only the last vehicle created
Addlibs replied to Dzsozi (h03)'s topic in Scripting
Lines 74 through to 76 are causing your problem. Set the variables before going into the for-loop instead, and in the loop only set when you find the vehicle you want. What happens in your code is, for example, there are 3 cars, and the 2nd one is in sight of the camera and everything. The script goes through from 1 to 3 as follows: At the end of this, as you can see, the 3rd vehicle changed the variable of our correct target vehicle. Instead, this should be as follows: -
Perhaps it could be the order of loading such models causing this problem. Are you sure you're loading in this order: COL, TXD, DFF?
-
cancelEvent(true, str) on onPlayerConnect will reject the connection with error message "Disconnected: server refused the connection" (or the reason specified as str)
-
Every entry in the database must have a row id primary key. It's mostly ignored on the Lua side, but internally, these IDs are used to associate account data with actual accounts. I don't think you can easily obtain the account ID unless you make your own account system. Besides, I don't really know why would you need it.
-
What @Bonsai recommended was removing 'local' on both lines within the loop. And he is right about the last row thing. What the code will do if you remove the 'local' is change the same variables over and over again, and what will be on these variables after the last loop, is what was set on the last iteration: the data from the last row of the query table.
- 4 replies
-
- dbquery
- for statement
-
(and 2 more)
Tagged with:
-
There doesn't appear to be any problem with the snippet you shown. Could you perhaps give a larger snippet, as it seems like you've probably got some if's or something which causes this problem.
-
When drawing to rendertarget, whatever falls outside of its size does not get drawn. This means you can draw text 20px-high text at Y position 10px lower than the render target's height, the bottom part will be cut off, because it's outside the render target. Think of it as if it was just an image on which you can draw with dxDraw* stuff.
-
dxDrawImage is just to draw that rendertarget as if were an image. For example, you have a render target of a size of 600 by 400 pixels. You draw a line across (0,300) to (400,300), which is a straight line across the middle of the screen height from 0 to 400 on the horizontal axis. You can then draw that rendertarget as if it was an image onto the screen position of (screenWidth/4, screenHeight/2), any size (keep in original 6:4 ratio to avoid stretching).
-
Everything you want to be drawn in your render target instead of the screen should be placed between dxSetRenderTarget(myRenderTarget, true) --render to myRenderTarget (2nd argument: clear the render target before setting it, if you're drawing per frame you'll usually want this set to true) -- your DX draws such as text dxSetRenderTarget() --render to no rendertarget, i.e. to the screen dxDrawImage(..., myRenderTarget, ...) --draw the render target on the screen (Remember that you must imagine the render target as a different screen with different screen size, you no longer use dxGetScreenSize but rather getMaterialSize of the render target)
-
onClientGUIChanged guiGetText string.gsub(string, "%W", "") and guiSetText
-
You need to render the text and stuff inside the render target and then draw the render target (dxDrawImage). Scrolling should move the individual parts in the render target, not the whole render target.
-
To make the marker invisible, you'd probably just want to set its alpha to 0. The marker itself won't be destroyed by itself when a player enters it, so you don't have to worry about that. What you want to do is attach an event handler to onMarkerHit attached to the marker element, then check whether hitElement is a vehicle or not and whether there is a driver (otherwise you can't charge him). The next thing would be to set a timer (store the variable in a table like timers[hitElement]) to a function which would fix the vehicle and charge the driver (make sure to check whether the car still has a driver after the timer elapses). As soon as onMarkerLeave it triggered on that market element, you'll want to killTimer(timers[leftElement]) (you'll probably want to check if it isTimer as elapsed timers give out warnings when you try to kill them).
-
I'm pretty sure you can easily calculate the northwest position taking into account negative lengths using standard math, so a collision rectangle should do the job.
-
You'd have to route the call to apply shaders through the server and broadcast it to all clients (and clients who join afterwards) Example: -- client triggerServerEvent("announceEnableShader", localPlayer, some_data) -- place this whereever you enable the shader instead of enabling it. This announces the client's intentions to the server and the server broadcasts this to all clients (including this client) and these clients all enable the shader on their end addEvent("broadcastEnableShader", true) -- allow remotely triggered (from server) addEventHandler("broadcastEnableShader", root, function(some_data) -- receive broadcast from the server -- engineApplyShaderToWorldTexture or whatever you want. Source of this event is the player who announced the shader (so you can know which element to apply a shader to, for example) end ) -- server addEvent("announceEnableShader", true) -- allow remotely triggered (from client) addEventHandler("announceEnableShader", root, function (some_data) -- receive announcement from client triggerClientEvent(root, "broadcastEnableShader", source, some_data) -- broadcast it to all clients (all children of root) end )