-
Posts
851 -
Joined
-
Last visited
-
Days Won
3
Everything posted by Noki
-
If the player in question has runcode access, they might be able to. Otherwise, I'm pretty certain they wouldn't be able to.
-
I sometimes come across this. My solution is just to add a dummy parameter at the beginning. Always seems to work for me. -- client triggerServerEvent("onSpawnRequest",localPlayer,spawnvehicle,posX,posY,posZ,rotX,rotY,rotZ,interior,alpha); -- server function asd(_, spawnvehicle,x,y,z,rotx,roty,rotz,interior,alpha) outputChatBox(tostring(spawnvehicle)); end;
-
A good year in all. Hopefully, 2016 will be even better!
-
math.round(5.924613, 2) > 5.92 The second argument is the number of decimal places.
-
If you want the sound to play when the local player shoots, use onClientPlayerWeaponFire.
-
If you want to check for a certain player, you'll need to include an extra parameter for that player's (partial) name. Then just use getPlayerFromPartialName to get the player element. You'll be better off making it server sided and possibly including some client events.
-
Wrong section.
-
Isn't that precisely what the map editor's object list is?
-
Move createMarker inside the function. Also, I don't see getElemenyData within the code you posted. Looks like you have errors elsewhere.
-
The problem with that would be, if the website was down or if you don't have access to an internet connection, the map editor would be kind of useless. A cool idea nevertheless.
-
First off, I would recommend using the in-built db functions. According to the wiki, this would retrieve a result. However, you're trying to insert data so maybe you aren't supposed to get a return from that. I'm also pretty sure you don't need to free an insert query. Also, you're looking at the structure tab of phpMyAdmin. The browse tab, if the table isn't empty, should look something like this.
-
http://www.gtagarage.com/mods/show.php?id=1154 Split that .col file into multiple different .col files and replace each one in MTA. As for the .txds, I'm not really sure. Your best bet there would be finding out which texture is required for each .dff and creating a new .txd for each one containing the required textures. You might need 3DS Max to do that (open up each .dff and see what materials it requires by pressing 'M').
-
setElementVisibleTo There is also an optional parameter in createBlip (called visibleTo) where you can specify who the blip is visible to. Otherwise you can just create the blip when the player takes the job and destroy it when the player leaves that job or takes a different job.
-
I don't really understand what you're trying to say. But if you want a player's name to be the same colour as his team on chat, just get rid of that hex nonsense at lines 8 and 9. Then for the outputs, just use outputChatBox(name..": #FFFFFF"..msg, root, r, g, b, true). I believe team chat doesn't work if you're not in a team, so if you want it to be white when a player isn't in a team then you'll need to make your own custom team chat. Line 3 should be: if type == 2 then
-
The in-built db functions pass input as parameters, as opposed to processing input. That means you don't need to worry about SQL injection.
-
https://wiki.multitheftauto.com/wiki/OnPlayerChat messageType 0 is chat using 't' or /say messageType 2 is team chat using 'y'
-
For your first issue, when a texture can't be found by the game, it usually displays as white (on an object, ped or vehicle at least), not grey. Make sure you assigned the material to a part of the model itself. You also have to make sure the names match up in 3DS and the .txd file (don't call a certain material 'x' in 3DS and import the texture as 'y' into the .txd file). For your second issue, you need to use CollEditor2 when exporting a collision file. First export your .col from 3DS, then into CollEditor2. Export it from there and use that final exported version in MTA. I haven't used 3DS Max in a while, but I hope what I can remember has helped. Oh, the newer versions of Max tend to have issues with KAMS scripts. If you experience any more problems, you're better off going to a version like 2009, 2010 or 2012. I've seen the least issues stem from those 3 versions.
-
Check your second for loop. for index, marker in ipairs(entryMarkers) do. Yet, you're checking for the value of i in allAmbiMarkers on line 21. That was my bad from my last post, sorry! I edited my post.
-
1. Yes, you can use OOP in a situation like that. However, it becomes a bit more complex (see metatables and loading a class into a resource via loadstring). Personally, I use OOP for all of my MTA coding except calling/exporting other resources. I use the procedural exports.resource:function(args) method. OOP will make your code more organised, easier to read and you will have to type less (plr.account.name as opposed to getAccountName(getPlayerAccount(plr))). I would recommend using OOP as MTA is heading in that direction anyway and it just looks nicer. 2. Dealman said it pretty well. I have personally used lots of smaller resources (and lots of servers also tend to do that) and find it much easier to work with. I find it easier to diagnose and debug problems if you can isolate it to a specific resource. I encourage you to experiment with both and find out where you're comfortable most and what you prefer. 3. OOP, as the name suggests, is object-oriented programming. That means you code with objects (not to be confused with elements or objects in MTA). There are two types of functions (can also be called methods) - static and instance. Static functions are functions where you don't need an object to call them (Vehicle.create(), Element.getAllByType() are some examples). Instance calls are where you need to pass an existing object from that class into the function/method (player:setName(), element:setHealth() are some examples). Familiarise yourself with that and learn what they mean. Don't think you need to code everything in OOP either. I still have to code some things the procedural way simply because the OOP function does not exist yet. https://wiki.multitheftauto.com/wiki/OOP_Introduction - An introduction to OOP https://wiki.multitheftauto.com/wiki/OOP_client - A list of all client-side OOP functions https://wiki.multitheftauto.com/wiki/OOP_server - A list of all server-side OOP functions https://wiki.multitheftauto.com/wiki/Vector - Different types of vectors. A lot of OOP function take Vector3/Vector2 instead of normal x, y, z coordinates. https://wiki.multitheftauto.com/wiki/Matrix - Matrices. A little more complicated, but very powerful. You can use these to minimise the amount of math you might need to do. A highlight of OOP. https://wiki.multitheftauto.com/wiki/MTA_Classes - A list of all classes in MTA. https://wiki.multitheftauto.com/wiki/Element_tree - The element tree. Learning this will save you a lot of time later on (speaking from experience). Some OOP questions that have been asked on this forum: https://forum.multitheftauto.com/viewtopic.php?f=91&t=86225 https://forum.multitheftauto.com/viewtopic.php?f=91&t=93452 https://forum.multitheftauto.com/viewtopic.php?f=91&t=85392 The main OOP guy around here is qaisjp. He's pretty good to talk to if you have any questions.
-
Each marker is assigned a local variable within that loop which is then destroyed, so you can't access the marker element outside of that function and its attached event handler. And making it a global variable won't help as it will only iterate over the previous marker each time. That's where we use tables. allMarkers = {} entryMarkers = {[1] = {15, 66, 7}, [2] = {4, 7, 8}} for i, v in ipairs(entryMarkers) do allMarkers[i] = createMarker(v[1], v[2], v[3]) addEventHandler("onClientMarkerHit", allMarkers[i], handlerFunction) end You assign each marker an index position within the table (numbers from one onward). To access a marker element, just do allMarkers[number], where number is the index from one to the amount of markers. To destroy the markers: for i in ipairs(entryMarkers) do if (allMarkers[i] and isElement(allMarkers[i])) then -- Check to see if the marker exists within the table and also check to see if the value of that key is an element destroyElement(allMarkers[i]) end end
-
entryMarkers = {[1] = {15, 66, 7}, [2] = {4, 7, 8}} for _, v in ipairs(entryMarkers) do local entryMarker = createMarker(v[1], v[2], v[3]) addEventHandler("onClientMarkerHit", entryMarker, handlerFunction) end This won't necessarily make the runtime more efficient, but it will make editing the code in the future much easier. You can also do the same with your exit markers. That way you get rid lf the big if and elseif statements. function toggleWindow() guiSetVisible(window, not guiGetVisible(window)) showCursor(not isCursorShowing()) end You basically set these values to what they boolean opposite currently is (true becomes false, false becomes true).
-
Anubhav is correct. Although, using lots of element data is not the best practice. When you set element data, it sends it to every client on the server. So if you want to sync it for one specific player, element data usually isn't the best way to do so. triggerClientEvent and triggerLatentClientEvent are what you should be using. But don't use something like setTimer(function () triggerClientEvent(player, "syncThisTable", player, massiveTable) end, 500, 0). That would basically be DoSing your players. You are better off creating a series of custom events (or something like that) to only sync the data when it changes.
-
Wrong section --> viewforum.php?f=106 Delete the old libmysqlclient.so.16 from /usr/lib If you're running a 64-bit nightly, replace it with this one. Otherwise, replace it with this one.
-
I've found that scripts compiled without luac.multitheftauto.com's extra obfuscation are easily decompiled. Why isn't the extra obfuscation forced? I don't see any negatives to it.
