-
Posts
283 -
Joined
-
Last visited
Posts posted by Buffalo
-
-
It solved the issue indeed.
Many thanks.
-
Thanks ccw.
Here's the pastebin https://pastebin.mtasa.com/447242767
-
One of my players reported strange bug that happens for them in all the servers.
The mouse keeps going down when ever starting to aim the weapon.
Happens only in MTA application.
There's no additional mices or controllers connected.
Any ideas?
-
So when you are not using render targets you are drawing to the screen.
Using a render target is like drawing on canvas, which then can be drawn on screen like any image.
Steps:
-create a render target
-set render target to draw on
-draw with standart dx functions
-reset render target to screen
-draw your target on screen
Example from wiki:
addEventHandler("onClientResourceStart", resourceRoot, function() myRenderTarget = dxCreateRenderTarget( 80, 100 ) -- Create a render target texture which is 80 x 100 pixels end ) addEventHandler( "onClientRender", root, function() if myRenderTarget then dxSetRenderTarget( myRenderTarget ) -- Start drawing on myRenderTarget dxDrawText ( "Hello", 10, 20 ) -- Draw a message dxSetRenderTarget() -- Stop drawing on myRenderTarget dxDrawImage( 50, 50, 100, 100, myRenderTarget ) -- Now use myRenderTarget as a material and draw it lots of times dxDrawImage( 150, 350, 150, 100, myRenderTarget ) dxDrawImage( 250, 250, 100, 150, myRenderTarget ) dxDrawImage( 350, 30, 150, 150, myRenderTarget ) end end )
Render targets are great for optimizing
Standart scoreboard resource calls hundreds dx functions per frame decreasing fps
But with render targets you can draw many times only once per second on the target and render that target with only one dx function saving fps
Also you can capture screen and draw it later on, see resource speedcams.
-
You should check out hedit resource.
Getting specified field in table is table["field"]
So in this case
getVehicleHanding(theVehicle)['maxVelocity']
See wiki getVehicleHandling for all the field.
-
Hello,
Did anyone try get user account name who authenticated on web? Theres an example on wiki, but all I get is "undefined" instead of name. Is this even possible?
<* local accName = getAccountName(user) if not accName then return end httpSetResponseCookie("userName",accName) *> <!DOCTYPE html> <html> <body onLoad="getAcc();"> Your Account Name is: <span id="accnam"></span> <script> //getCookie function from w3schools.com function getCookie(c_name){ var i,x,y,ARRcookies=document.cookie.split(";"); for (i=0;i<ARRcookies.length;i++){ x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("=")); y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1); x=x.replace(/^\s+|\s+$/g,""); if (x==c_name) return unescape(y); } } function getAcc(){ var acc = document.getElementById("accnam"); var name = getCookie("userName"); if(!name || name!="") acc.innerHTML = name; else acc.innerHTML = "Could not get your account name!"; } </script> </body> </html>
Solved!
<* httpWrite( "<script> var userName = '"..getAccountName(user).."';</script>" ) *>
-
Same here! After changing my HDD im now using windows 8 the only difference from windows 7.
Game runs at 60fps (server fixed fps), everyone is faster than me. Even my char is slow.
It's the feeling like my handling.cfg would use slow settings. Like I would be playing with 25fps or so.
Same processor brand, little faster clocked at 3.5.
-
No. Except you can replace other cars and set their handling to infernus handling, so you will have 5 infernus-handling modded cars.
-
-
createWeapon is client side, you must create turret for every client by syncing position using serverside triggering. Store positions in serverside array. Update newly joined clients where turrets are placed and their state.
Sync turret state among all clients using triggering. You also can sync without triggering but detecting clientside colshape hits when other players enetrs them. Tho target changing might be less tricky doing serverside syncing what turret is targeting.
You can not send client side elements to server! Instead send what is current turret target.
-
Noone is able to help you, it's only a fragment code that tells us nothing. Post more code how ttt is called and how you want it to work
-
There are numerous problems with ped using weapons, as I was trying to use them in early 2013, I don't think its fixed. I would suggest you using simple createWeapon instead of a ped with a weapon, it won't change your concept and also should work as you intended.
-
Use your 1 pixel image and draw it on whole screen
Example:
local screenX,screenW = guiGetScreenSize() addEventHandler('onClientRender',getRootElement(),function() dxDrawImage( 0,0,screenX,screenW,"my1pximage.png") end)
-
There is shader example https://wiki.multitheftauto.com/wiki/Shader_examples
Also try using search in community.multitheftauto.com I'm sure you'll find great example resources.
-
Not sure whats asked.
local varText = "Hello guys,\nHow are you today ?\nYes i am fine and you ?\nYes"
This will show the text wrapped in new lines using dxDrawText
-
local player = getLocalPlayer() local counter = 0 local starttick local currenttick addEventHandler("onClientRender",root, function() if not starttick then starttick = getTickCount() end counter = counter + 1 currenttick = getTickCount() if currenttick - starttick >= 1000 then setElementData(player,"FPS",counter) counter = 0 starttick = false end end )
-
-
Try
string.gsub('Lucky Lottery numbers: 12, 53, 55!','%d+','/n%1')
> Lucky Lottery numbers: /n12, /n53, /n55!
-
That needs a bit more expertise.
Tho this piece should work
local str = "Lucky number 2569!" local e1,e2 = string.find(str,"%d+") str = string.sub(str,0,e1-1)..'/n'..string.sub(str,e1,string.len(str))
> "Lucky number /n2569!"
-
wrong parameters for onPlayerClick
function onClientPlayerWeaponFireFunc(player) showCursor(player,true,false) addEventHandler("onPlayerClick",player,explosion) end addCommandHandler("ilovetoburn",onClientPlayerWeaponFireFunc) function explosion (button,state,element,x,y,z) if (button == "left" and state == "down") then createExplosion (x,y,z,1) showCursor(source,false,false) end end
-
Why would you want that?
Create an invisible edit box ( guiSetAlpha ) at ,0y,50x,50y and make it visible if its clicked with event onClientGUIClicked.
-
Actually you can do this trick, depending on the purpose you need, it might work (if you only need to detect alphabedic characters):
addEventHandler('onClientCharacter',getRootElement(),function(key) if string.byte(key) > 40 and string.byte(key) < 91 then -- pressed an alphabedical symbol with CAPS LOCK ON! --do something when character with caps lock on entered elseif if string.byte(key) > 96 and string.byte(key) < 123 then -- pressed a symbol with CAPS LOCK OFF! --do something when character with caps lock off entered end end)
-
local sound setTimer(function() local vehicle = getPedOccupiedVehicle(localPlayer) if vehicle and getElementModel(vehicle) ~= 476 then local vx,vy,vz = getElementVelocity(vehicle) if vx+vy+vz == 0 then if sound then setSoundPaused(sound,true) end else if not sound then sound = playSound("sounds/sound.mp3") setSoundVolume(sound, 0.1) else setSoundPaused(sound,false) end end elseif sound then setSoundPaused(sound,true) end end,1000,0) --anonymous function attached to you addEventHandler("onClientPlayerWasted", localPlayer, function() if isElement(sound) then setSoundPaused(sound, true) end end)
-
Wow man, simple rules:
-Try never use events and functions with same name
-Use global constants carefully
This should work for you:
function vehicleExplodeRented() if getElementData(source,'rented') then destroyElement(source) end end addEventHandler("onVehicleExplode", getRootElement(), vehicleExplodeRented) local Cash = 500000 function rentVehicle () if ( getPlayerMoney ( source ) < Cash ) then outputChatBox("You need 300,000$ to rent this vehicle.", source, 255,0,0) else takePlayerMoney(source, Cash) if (getElementZoneName(source) == "Los Santos International") then local Vehicle = createVehicle(425, 1924.5841064453, -2291.1552734375, 13.5) warpPedIntoVehicle(source, Vehicle) setElementData(Vehicle,'rented',true,false) else local Vehicle = createVehicle (425,1485.49, 1231.93, 10.82,0,0,180) warpPedIntoVehicle(source, Vehicle) setElementData(Vehicle,'rented',true,false) end end end addEvent ("rentV", true) addEventHandler ("rentV", root, rentVehicle)
Client craches joining ZHP server
in Client
Posted
Hi all,
After patching everything to 1.5.6 MTA client craches when ever I join the specific ZHP server. If I to join any other server first and join back, then it's golden. It crashes once mods loading percentage starts filling up. Could you please try help me triage the issue.
Crash dumps https://ufile.io/2o707
Is there no attachment option on posts