-
Posts
113 -
Joined
-
Last visited
Everything posted by Revolt
-
function detektor () for _, player in ipairs(getElementsByType("player")) do if (not isPedDead(player)) then local pingus = getPlayerPing(player) if (pingus >= 100) then outputChatBox(getPlayerName(player):gsub("#%x%x%x%x%x%x","").." #CFECEC lagging his ping: #ff0000:"..tostring(pingus),root, 255, 96, 96, true) end end end end setTimer(detektor, 1000, 0) I'm not sure what the issue is, I double checked the code and couldn't find what causes your error. I doubt this is it, but maybe you have to convert the ping with tostring(..) before concatenating.
-
https://community.multitheftauto.com/in ... ls&id=1365 https://community.multitheftauto.com/in ... ls&id=9552 https://community.multitheftauto.com/in ... s&id=10483 This is what I found on the Community (community.multitheftauto.com).
-
function detektor () for _, player in ipairs(getElementsByType("player")) do if (not isPedDead(player)) then local pingus = getPlayerPing(player) if (pingus >= 100) then outputChatBox(getPlayerName(player):gsub("#%x%x%x%x%x%x","").." #CFECEC lagging his ping: #ff0000:"..pingus,root, 255, 96, 96, true) end end end end setTimer(detektor, 1000, 0)
-
local orientation = -1 -- left is -1, right is 1 local veh = getPedOccupiedVehicle(getLocalPlayer()) local x, y, z = getElementPosition(veh) local _, _, r = getElementRotation(veh) x = x + 4 * math.cos(math.rad(r)) * orientation y = y + 4 * math.sin(math.rad(r)) * orientation createProjectile(veh, 19, x, y, z, 1, nil, 0, 0, 180 - 90 * orientation, math.cos(math.rad(r)) * orientation, math.sin(math.rad(r)) * orientation) Here.
-
Velocity is speed with a direction (a vector).
-
These are some of the screenshots I took. It looks legit, but not quite as high-quality as you would expect from a script that's for sale. Wanted system and police job seem not work. And there are not so many jobs to begin with.
-
No problem. I didn't know that they implemented the 'split' function, but nice to know for future reference.
-
table.insert(carPartsTable, carPartName .. "," .. carPartPrice .. "," .. carPartID) Then split it into a table in client side. function string:split( inSplitPattern, outResults ) if not outResults then outResults = { } end local theStart = 1 local theSplitStart, theSplitEnd = string.find( self, inSplitPattern, theStart ) while theSplitStart do table.insert( outResults, string.sub( self, theStart, theSplitStart-1 ) ) theStart = theSplitEnd + 1 theSplitStart, theSplitEnd = string.find( self, inSplitPattern, theStart ) end table.insert( outResults, string.sub( self, theStart ) ) return outResults end
-
I don't think you can pass a table with tables inside of it through triggerClientEvent.
-
function render() local vehicle = getPedOccupiedVehicle(getLocalPlayer()) for _, occupant in pairs(getVehicleOccupants(vehicle)) do local cnt = 0 if (occupant and getElementType(occupant) == "player") then cnt = cnt + 1 end local PlayerName = getPlayerName(getLocalPlayer()) local VehicleName = getVehicleName (vehicle) end dxDrawText(" #FF0000PASSAGEIROS: #FFFFFF" .. tostring(cnt) .. "/" .. tostring(getVehicleMaxPassengers(vehicle)), x*870, y*640, x*716, y*351, tocolor(255, 255, 255), x*1.7, "default-bold", "center", "top", false, false, false, true) end addEventHandler("onClientRender", root, render) Is this what you're looking for?
-
You won't upload pictures or videos, and you claim your server doesn't work... I call bullsh*t on this one.
-
You cannot pass elements to PHP, and frankly, I don't think you need to. Remove the player argument from your function, and use source instead.
-
Type 'start mapmanager' in your console.
-
I guess that's not the same because in the previous case the function can call itself from within itself, yet in the other one it cannot (since it is being declared at the time the function is being declared).
-
Maybe use callRemote and reformat the page in JSON.
-
It is actually the same. You can think of a function as just a variable when executed ( helloWorld() ), will cause something to happen. By declaring helloWorld local, you're automatically setting your function to be local as well, since it doesn't exist outside the helloWorld variable. -- file1.lua local abc = function () print("hello world") end hello = abc -- file2.lua hello() -- you'll be able to use 'hello', but not 'abc' local secondVariable = hello -- you will not be able to use 'secondVariable' in file1
-
string.format("#%.2X%.2X%.2X%.2X", a, r, g, b) If integer is smaller than 15, then rather use this one.
-
First hide the chat, then output a bunch of blank messages, and cancel out 'onPlayerChat' event.
-
Vector is an array of numbers (V2 has two variables, V3 has three and so on). Vector examples: (1, 2, 3) ; (4, 5) Vector addition: (4, 5, 6) + (1, 2, 3) = (5, 7, 9) Vector subtraction: (4, 5, 6) - (1, 2, 3) = (3, 3, 3) Vector multiplication: (4, 5, 6) * (1, 2, 3) = (4, 10, 18) Vector division: (4, 5, 6) / (1, 2, 3) = (4, 2.5, 2) Scalar vector multiplication: 2 * (1, 2, 3) = (2, 4, 6) Vectors are a type of matrices, but they're one dimensional. Matrices are actually multi-dimensional. Example: Addition: Scalar multiplication: For multiplication and division, matrices do not have to the same size. Search 'matrices' on Google for more info.
-
Local function can only be used inside the file it was declared it (and so can any other local variable that has been declared outside of functions).
-
Not really related to CPU architecture (by your theory, a table would occupy 16777216 TB of RAM in x64), yet it is related to available (assigned) memory. The program running Lua, in this case MTA, has a specific amount of RAM it can address to. Table is then given the maximum space it can write to (upon creation), then when the end of memory is reached, the unused table is automatically cleared (or overlaps with the previous one).
-
There is a limit of how high in the memory can the processor write. For 32 bit applications it is 0xFFFFFFFF (well, theoretically at least). Those values (around 70) overlap because you declared the table local, therefore, when they're no longer needed they get destroyed automatically.
-
If you're referring for applying rainbow color to teams, then just use setTeamColor (..) instead of setVehicleColor (..) with the same arguments for R, G and B.
-
onClientRender may be better (although it might cause lags, since we don't know how much impact on the CPU will the setVehicleColor ( .. ) cause. Thumbs up for the interpolateBetween (..) method, though.