-
Posts
2,973 -
Joined
-
Last visited
-
Days Won
3
Everything posted by 50p
-
Because the event is triggered for players who join the server but not player who joined the server. Use onClientResourceStart instead which is triggered when resource starts and after all files has been downloaded by the player when (s)he joined the server. I'm still wondering why people don't use wiki as their MTA bible. That's place where they can find everything they need to know about scripting for MTA.
-
I haven't read question properly. It was very late morning before I went to bed, apologies. attachElements is not the way to go for this. MTA's trains aren't perfect and tend to be buggy. So, either follow Kayl's directions because setting trailers speed would be the way to go around it or wait for MTA to get these train bugs resolved (it may take some time).
-
You're basically asking us to do it for you since I can't see anything MySQL related in your code. You must use MySQL module to use extra MySQL functions in Lua. Why don't you investigate and use wiki as your fist place to look at? Go ahead, wiki doesn't bite you. I think I've explained it to you already You don't just have to learn Lua for MTA but also Lua's syntax and what Lua is. It looks like Lua is your first scripting/programming language so you have to learn what a function is and how to use them, then you can start to learn how to use Lua in MTA with the tutorials which are available on the forum and wiki. client is another hidden variable passed to function which is called by event triggered by client-side script. It points to player element who triggered this event. So, if you have a custom event in server-side script and you trigger it with triggerServerEvent, then function attached to this event will be called with "client" variable which is not one of parameters in your function. You MUST use wiki every day you need something related to scripting in MTA... You can learn more about client, source, etc. here: https://wiki.multitheftauto.com/wiki/AddEventHandler
-
You can try attachElements.
-
Trace the error. Basically, debug the script. I wouldn't recommend to learn from or modify freeroam resource because it's not easy to read its code. It's not made for beginners to learn from it. The message is surely from freeroam resource not MTA that's for sure, so find the function which shows you that message and debug it. There is nothing wrong with your code. Maybe you added your changes but didn't restart the resource after it?
-
You have to add event first and then add handlers to it. So, move your addEvent above addEventHandler.
-
If you're using onClientGUIClick then it won't work because:
-
It's exactly what you're want. You createBlip (use icon id 0 or 1, can't remember) and attachElements to attach the blip to a player, so when he moves, the blip on your minimap moves too.
-
Actually, -- in front of ]] is not necessary.
-
It's not in ACL. It's a script and needs to be put in a script file (usually .lua). You should learn about resources: https://wiki.multitheftauto.com/wiki/Resources
-
You didn't understand my post then. I told you not to use source in your function parameters because events have their own source element which will be overwritten by your parameter. Some events don't pass any arguments to a function attached to the event so your source (in parameters) will be nil. onPlayerJoin has source of the player who joined the server, so you can use that source but don't specify parameter "source" for your function... onPlayerWasted has source of player who died. onVehicleDamage has source of the vehicle which got damaged. In client-side events, it's onClientPlayerJoin, onClientPlayerWasted, etc. You can use source in your playerjoined function because it's the player who joined the server, so: function spawn(plr) repeat until spawnPlayer (plr, -711+math.random(1,5), 957+math.random(5,9), 12.4, 90, math.random(9,288) ) fadeCamera(plr, true) setCameraTarget(plr, plr) end function playerjoined() spawn(source) -- It's the player who joined, but there is no parameter for playerjoined as you see. setTimer(keys, 1000, 1, plr) setTimer(LichtAnlageOn, 500, 0, plr) outputChatBox("Hi Noob!", plr) end addEventHandler("onPlayerJoin", root, playerjoined)
-
It may be hard at first but after couple of days/weeks (depends how quick you learn) you understand it. It has different syntax but it's more friendly and you don't have to pay attention to variable types. It's always easier to learn new scripting/programming language if you know one or more already than if Lua was your first scripting language. So, don't be afraid.
-
Please stop naming element variables "source". It will confuse you later when you'll have to deal with different types of elements and for functions which are attached to events it's even worse because MTA doesn't know which source to use and it will overwrite the hidden source passed to function call (the element from event) with the source from parameters list which can be everything depending on event. If you expect player element call the variable "player", "thePlayer" or even "plr". If you expect vehicle name the variable "vehicle", "theVehicle" or "veh".
-
Doing things like this: pInfo = { pSQLID, pAdmin, pLevel,} gPlayerInfo = {} for i=1,100 do gPlayerInfo[i] = pInfo end Is not ideal, even if pSQLID, pAdmin and pLevel had values assigned to them. It's simply because when you assign a table to a variable you don't make a copy of that table but use instance of that table. Have a look at this example: table1 = { 123, 456, 789 }; table2 = table1; table2[ 1 ] = 0; -- change 123 to 0 print( table1[ 1 ] ); -- This will print "0", not 123 as you'd expect As you can see, I changed value of first index of table2 to 0 but it also changed table1. That's because table2 was assigned an instance of table1. not sure if "instance" is the correct name though Also, xxmistu, 1 think to remember about Lua is that it's typeless language. That means you don't have to declare variables with type of variable like it's in C-like languages (int iInteger, char cChar, etc.). Lua is dynamic.
-
Not many people use it. I used it for some maps that I made. Custom objects feature is little bugged and doesn't always work the same.
-
Do you mean sub-forum? There is no need for it. I'd rather ask to make a sub-forum for requests in general (scripts, new MTA features, etc.)
-
- onClientMarkerHit is triggered whenever player enters a marker (you or anyone else). You create window when you or someone else enters your marker. Make sure the player who entered the marker is "you" (getLocalPlayer) - You seem to create 2 windows. 1 in CreateSelectorWindow and 1 in selectorenable which calls CreateSelectorWindow. - takePlayerMoney whenever they select a skin (clientSkinSelect seems to be function called when player selects skin, that's where you take money away)
-
If you don't want to release your script to public I wouldn't recommend you to use a web-side based converter. You're not 100% sure your script will be removed from their server.
-
Use EDIT button to edit your post. Don't post 4 times in a row. So, you don't get any errors or warnings any more? When you make scripts, always make them without warning and error messages, even if it works with warnings, get rid of them.
-
Read wiki PLEASE! This function is available client-side only.
-
With that info, we can easily look at your code and know what to look for. Server-side: - From what I noticed, your server-side function gamble_hotTestPlay is never called. - At line 39, gamble_kitsuneBakuchiTestPlay is nil or it's a function which you didn't show us. You probably want to change it to gamble_hotTestPlay.
-
If only you explained what your problem is, people wouldn't have to read the whole script to find out what you've done wrong.
-
AFAIK, it won't save the settings to meta.xml. At least it didn't save for me when I used it last time.
-
What's the point of this? Everyone can download wiki themselves.
