cheez3d
Members-
Posts
290 -
Joined
-
Last visited
Everything posted by cheez3d
-
That is a slot machine.
-
local Timer = nil; Timer = setTimer(function() killTimer(Timer); end,1000,1);
-
The bug was resolved.
-
Shouldn't this function also work with GUI elements alpha? I set the alpha of a static image to 0.5 and then I parented another static image to it and it's alpha also became 0.5 even tough I used setElementCallPropagationEnabled. When I try to output the child's alpha using guiGetAlpha I somehow get 1. local Parent = guiCreateStaticImage(0,0,100,100,"Image1.png",false); setElementCallPropagationEnabled(Parent,false); guiSetAlpha(Parent,0.5); outputChatBox(guiGetAlpha(Parent)); --> 0.5; local Child = guiCreateStaticImage(1,1,98,98,"Image2.png",false,Parent); outputChatBox(guiGetAlpha(Child)); --> 1; it returns 1 even tough visually it's alpha is 0.5;
-
outputChatBox is a shared function.
-
https://wiki.multitheftauto.com/wiki/Sc ... troduction You're welcome.
-
local SquareRoot = math.sqrt; local GetSpeed = function(element) local Velocity = {getElementVelocity(element)}; return SquareRoot(Velocity[1]^2+Velocity[2]^2+Velocity[3]^2)*100; end; local ScreenSizeX,ScreenSizeY = guiGetScreenSize(); local Vehicles = {}; local ProgressBar = guiCreateProgressBar((ScreenSizeX-300)/2,(ScreenSizeY-20)/2,300,20,false); addEventHandler("onClientPlayerVehicleEnter",root,function(vehicle) if getElementModel(vehicle) == 531 then Vehicles[vehicle] = function() if GetSpeed(vehicle)>0 then local Progress = guiProgressBarGetProgress(ProgressBar); guiProgressBarSetProgress(ProgressBar,Progress+1); if Progress>=100 then removeEventHandler("onClientRender",root,Vehicles[vehicle]); end; end; end; addEventHandler("onClientRender",root,Vehicles[vehicle]); end; end); addEventHandler("onClientPlayerVehicleExit",root,function(vehicle) if Vehicles[vehicle] then removeEventHandler("onClientRender",root,Vehicles[vehicle]); end; end);
-
print(("CHEEZ"):lower()); --> cheez print(("cheez"):upper()); --> CHEEZ
-
Are you competent enough to make it yourself?
-
There is nothing to reverse-engineer. The play resource is open-source.
-
local SquareRoot = math.sqrt; local GetSpeed = function(element) local Velocity = {getElementVelocity(element)}; return SquareRoot(Velocity[1]^2+Velocity[2]^2+Velocity[3]^2)*180; end; addCommandHandler("speed",function() local Vehicle = getPedOccupiedVehicle(localPlayer); if Vehicle and GetSpeed(Vehicle)<=0 then local Timer,StartTick = nil,nil; Timer = setTimer(function() if GetSpeed(Vehicle)>0 then killTimer(Timer); StartTick = getTickCount(); Timer = setTimer(function() if GetSpeed(Vehicle)>=100 then killTimer(Timer); outputChatBox("Test successful! Time elapsed - "..((getTickCount()-StartTick)/1000).." seconds;",255,0,0); end; end,50,0); outputChatBox("The speed test started!",0,255,0); end; end,50,0); outputChatBox("Start accelerating when you wish to begin!",0,255,0); else outputChatBox("You firstly have to enter a vehicle and not move!",255,0,0); end; end); You just call the command /speed when you are in a vehicle.
-
I guess I'm going to use the weak values then. Thank you for your responses.
-
The idea is I can't set the pointer to nil. I'd do so if I could. That's why I needed the metamethod.
-
Does Lua 5.1 support the __gc metamethod for tables? I looked on the internet and found out that Lua 5.2 supports it. I tried to see if it works on MTA, but unfortunately it doesn't . The version of Lua MTA uses is 5.1.
-
Use local variables. Replace destroyElement(veh) with if isElement(veh) then destroyElement(veh); end; .
-
if not ("Cheez"):find("[^%w%d\\|@#~!\"%$%%%^&/%(%)%[%]=%?%+%*%-%.']") then outputChatBox("Valid nickname!"); end;
-
Inseamna ca materialele sunt compilate cu un alt algoritm decat cel oferit de MTA. Daca nu ai source code-ul nu le vei mai putea utiliza cand conpilarea cu luac.multitheftauto.com va fi obligatorie (pe la mijlocul verii).
-
This function checks if the last completed event was cancelled.
-
local HospitalPositions = { ["Los Santos 1"] = {1183.291015625,-1323.033203125,13.577140808105}, ["Los Santos 2"] = {2034.080078125,-1404.7314453125,17.251882553101}, Montgomery = {1371.830078125,405.94140625,19.7578125}, Blueberry = {207.50390625,-62.701171875,1.5977957248688}; }; addEventHandler("onPlayerWasted",root,function() local PlayerPosition,Distances = {getElementPosition(source)},{}; for _,v in pairs(HospitalPositions) do table.insert(Distances,{ Position = v, Distance = getDistanceBetweenPoints3D(PlayerPosition[1],PlayerPosition[2],PlayerPosition[3],v[1],v[2],v[3]); }); end; table.sort(Distances,function(a,b) return a.Distance end); local NearestHospital = {unpack(Distances[1].Position)}; spawnPlayer(source,NearestHospital[1],NearestHospital[2],NearestHospital[3]); end);
-
https://wiki.multitheftauto.com/wiki/Ge ... tCollision
-
addEventHandler("onPlayerChat",root,function(message) local Pattern = "[mtasa://]?%d%d?%d?%.%d%d?%d?%.%d%d?%d?%.%d%d?%d?[:%d%d%d%d%d?]?"; -- simple pattern for detecting an IP address; if message:find(Pattern) then -- if the message contains an IP address; cancelEvent(); -- cancel the chat event; local Result,Matches = message:gsub(Pattern,""); -- remove the IPs, no need to ban the player for a simple IP, maybe he wrote it by mistake; outputServerLog("WARNING! - "..tostring(Matches).." IPs detected in chat message \""..message.."\". Removing them."); outputChatBox(Result,root); -- output the new message with no IPs to the chatbox; end end);
-
You're not going to get any help if you don't post the errors from your debugging log.