-
Posts
2,973 -
Joined
-
Last visited
-
Days Won
3
Posts posted by 50p
-
-
Use this instead:
triggerClientEvent ( "showRedWinImage", getRootElement() )
And don't use this in for loop because that's just slower.
-
I'm 100% sure this will help you: https://forum.multitheftauto.com/viewtop ... 91&t=25032
-
...
The error message is:
attempt to concatenate a nil value...
-
The reason why it doesn't work is probably this:
-
....
It's anyway fully working, dunno why 50p didn't put this into this topic?
Because there are people like you who know how to use "Search" feature! lol
-
Don't define positions in scripts, use map files, that's the point of them.
===================================================================
Besides, your ped model ID is located at index 5 not 4.
-
what programm i need?
You can try MTA:Script Editor and help to improve it by reporting bugs.
-
Extended from mapmanager example:
function loadMap(startedMap) mapRoot = getResourceRootElement(startedMap) local mapVehicles = getElementsByType ( "vehicle", mapRoot ) --start at Map Root Element, we're not interested in other vehicles possibly existing for _, veh in pairs ( mapVehicles ) do toggleVehicleRespawn ( veh, true ) setVehicleRespawnDelay ( veh, 30000 ) --delay in milliseconds, this is 30 seconds end end addEventHandler("onGamemodeMapStart", getRootElement(), loadMap)Either toggleVehicleRespawn or setVehicleRespawnDelay doesn't work properly.
The best way to respawn vehicle after it explodes is to set a timer which will respawn the vehicle in onVehicleExplode event.
https://wiki.multitheftauto.com/wiki/RespawnVehicle (the example shows exactly what I described)
-
Shout it, when you've finished scripted it and good luck

Join FREESTATEPROJECT server and you'll get drunk.. also driving cars is harder, not to mention flying helis.
-
I will probably let users to add their own extensions in the future but for now I'll stay with .lua and .xml.
I made the "profiles" feature so that user can change colours to his liking not for other extensions. It doesn't work yet as many other options in options window.
-
yes, but i think there isnt a solution to use more colors in one textitem isnt it?
No.
-
I've been trying to reproduce what causes the glitch inability-to-save glitch.
So far; I've noticed:
- Saving does not work if the file isn't part of a resource. Nor does it show in the SW info bar.
- It occured after trying to change my profile settings.
- A reinstall does not fix it. Nor could I find anything in Applications Data. Registry perhaps (though I searched for MTASE in regedit and got nothing)?
- If saving doesn't work; neither does right-clicking or IntelliSense.
- Oh, I know it doesn't save files that weren't added to any resource that's because of the way I open files.
- What did you mean by "after trying to change my profile settings"? Your PC profile? And what settings?
- MTASE is not stored in registry yet.
A suggestion/feature request: allow opening other file formats (defaultly interpreting it as Lua).MTASE supports XML files as well. That was mainly to let users change their map files manually.
- Saving does not work if the file isn't part of a resource. Nor does it show in the SW info bar.
-
Check what setElementVelocity and getElementVelocity return.
-
The forum sa-mp, redirect me to you
Do something to help in this language LUA? I'm using the current plugin, which allows the use of LUA scripts in SA-MP.They can't send you here simply because the plugin doesn't support MTA functions. You better start using MTA and learn Lua from our wiki. You will make scripts that are not possible in SA-MP.
BTW, what does SA-MP camera bug has to do to MTA? It's just wrong.
-
First you need to learn Lua. Just because you can do it in Pawn doesn't mean you can do it straight away in Lua. All you need to do is learn the basics of Lua and make simple scripts from scratch.
You aim too far for your skills in Lua.
-
...
i'm making a zombie game just for fun as the npcs are a bit messed up on sa-mp
Have a look at this and some screenshots:
https://community.multitheftauto.com/index.html?p ... ils&id=347
-
-
The point of this function is not to add it to command handler but call it from anywhere. You can call this function from onClientMarkerHit for example to start the countdown.. Or you can call this function when player dies to tell him how long until he respawns.
-
.....
uhm you forgot a thing:
https://wiki.multitheftauto.com/wiki/AddCommandHandler
The handler function takes one more argument (client-side)
string commandName, [string arg1, string arg2, ...]
So the countdown handler function will be:
function Countdown( commandName, seconds ) guiStaticImageLoadImage( IMAGE, "images/" .. tostring( seconds ) .. ".png" ); guiSetVisible( IMAGE, true ); if ( seconds > 0 ) then -- do we need to continue countdown? setTimer( Countdown, 1000, 1, seconds - 1 ); -- call this function again in 1sec. with decreased value of "seconds" else CountdownFinished( ) end endand use the command like /countdown 3
This should work.
LEAVE THE COUNTDOWN FUNCTION ALONE! DO NOT MODIFY IT UNLESS YOU KNOW WHAT YOU'RE DOING! From what I see you don't know what you're doing.
Your code will not work... What's the purpose of Countdown function? It starts countdown and takes only 1 parameter.
I was hoping you can add command handler function yourself easily but it seems to be headache for both of you.
addCommandHandler( "countdown", function( _, secs ) secs = tonumber( secs ) if secs then Countdown( secs ) end end ) -
I never asked you to add Countdown function inside onClientResourceStart... It will still not work because you don't have a command.
-
First of all, I haven't added any commands there. You have to add it yourself.
Second of all, guiCreateStaticImage doesn't hide the image after it's created... You must hide it yourself with guiSetVisible. Besides, image shouldn't be created outside a function (move it inside a function that is called when resource starts or somewhere else).
Last but not least, debug your script.
-
A useful tool would be an inbuilt CEGUI interface so that we can design GUI out of game.
I've started making one long time ago but couldn't figure out why it stops rendering after loading cgui.dll up... There is no MTA Developer that knows why at least that's what they said when I asked them on IRC.
If there is anyone that wants to help me, feel free to do so with my source code (it's C++):
http://scripteditor.beta.mtasa.com/file ... or_src.zip
I'm including here binaries if you can't compile it yourself:
http://scripteditor.beta.mtasa.com/file ... Editor.zip
As I said, I started making it pretty long time ago when MTA went open source, so the "CGUI..." classes and cgui.dll are old but that doesn't mean it's the cause of stopping DirectX from rendering since it worked with MTA.
There are following features:
- change resolution of rendering window (from 640x480 to 1680x1050)
- loads cgui.dll from "File" menu
- context menu (right-click menu) on "black screen" which is meant to let user create GUI elements quickly (it's useless since cgui.dll doesn't initialize at all)
I'll say it again, MTA Developers weren't able or willing to help me and I got pissed off after a few weeks of trying to fix it.
-
Keep in mind the bandwidth issues when using events - don't pass a large list of arguments unless you really need to. It is marginally more efficient to pass one large event than two smaller ones.
If your array is small (say, 1 - 4), you can loop through it but it's not good idea to do so. Just send the array with 1 call.
-
If you're planning to make your own countdown script with GUI then I'll give you some advice before you start:
- Use 1 "static image element" and use guiStaticImageLoadImage instead of creating 4 images and showing/hiding them whenever needed.. this doesn't just save bandwidth but also memory where images are stored in
- make 1 function that starts the countdown and counts down by itself.
The less code your client-side script has the more bandwidth you save and shorter download time is.
Take this as a sample:
-- create your image (any image, can be "images/0.png") IMAGE = guiCreateStaticImage( ........ ); -- put your own arguments here -- call this function to start countdown, eg. Countdown( 3 ); function Countdown( seconds ) guiStaticImageLoadImage( IMAGE, "images/" .. tostring( seconds ) .. ".png" ); guiSetVisible( IMAGE, true ); if ( seconds > 0 ) then -- do we need to continue countdown? setTimer( Countdown, 1000, 1, seconds - 1 ); -- call this function again in 1sec. with decreased value of "seconds" else CountdownFinished( ) end end function CountdownFinished( ) --[[ DO WHATEVER YOU WANT HERE WHEN COUNTDOWN ENDS... YOU CAN HIDE THE IMAGE ]] guiSetVisible( IMAGE, false ); -- OR SHOW "GO!" for a second or 2 guiStaticImageLoadImage( IMAGE, "images/go.png" ); setTimer( guiSetVisible, 2000, 1, IMAGE, false ); end

Calling an clientimage from the server
in Scripting
Posted
Why don't you read the tutorial about GUI? You know where to learn from now.
The center of the screen is just a simple math calculation which you should already know about...
screenSize = { guiGetScreenSize() } -- make a table which is the size of player's screen, width -> [1], height -> [2] local centerOfScreenX = screenSize[ 1 ] / 2; local centerOfScreenY = screenSize[ 2 ] / 2; -- take a note of size of your image you want to display, eg. 100x200 -- and get the center of it or rather get half of its dimensions local centerOfImageX = 100 / 2; local centerOfImageY = 200 / 2; MYIMAGE = guiCreateStaticImage( centerOfScreenX - centerOfImageX, centerOfScreenY - centerOfImageY, 100, 200, "IMAGE.png", false ) -- hide: guiSetVisible( MYIMAGE, false ); -- make it underneath everything: guiMoveToBack( MYIMAGE )READ THE WIKI AND TUTORIALS IF YOU HAVE QUESTIONS REGARDING SUCH THINGS.
Most of the functions names are self-explanatory.