-
Posts
2,973 -
Joined
-
Last visited
-
Days Won
3
Everything posted by 50p
-
You should make another for loop to go through all member nodes just like for gangs and its data nodes. I thought you get the idea after showing you a for loop inside a for loop.
-
You should never start working on an roleplaying gamemode if you don't understand scripting. What you showed us here is GUI code that was made for you but don't expect us to make the login system for you.
-
What do you mean? 3DS Max? Lua script? Map editor?
-
This is what you should do even in languages which support goto.
-
Unfortunately MTA doesn't support lights (coronas), smoke effects nor animated textures. Good luck.
-
Almost everything you said is lack of knowledge. - You can't have server-side - If you edit file in resource folder (server-side), it will be re-downloaded by players when the resource is reloaded/restarted - There is no need to triggerClientEvent or triggerServerEvent to keep them in sync If you want the file to be on both sides the same then use instead but if the script will change the file then it will be edited on 1 side until resource restarts. I recommend you use for all your xml files because if xmlLoadFile fails, you can still use getResourceConfig to load the file. I don't see a point of having 1 file for server and client. You can load the file server-side and then send data needed to client with triggerClientEvent. Show us your meta.xml.
-
If the models are not big then you can attach them before exporting. Nothing wrong will happen if you attach them but make sure that bounding box is not greater than 512x512x512. Yes, you have to center the col mesh before you export the col. It doesn't matter which one you export first. My export script centers the model before it's written to .dff then moves it back to the position where it was before exporting. As I said, I'd love to include col export feature but I can't. I was aware of people making loads of models and exporting them one by one is pain in the butt that's why I made this script but unfortunately you still have to export collision yourself.
-
I would love to add col exporting but I really doubt it will be added in the future because as I said somewhere, I have no idea what function KAM scripts use to export collision mesh since the script is encoded and I have no access to its source code. I said function because I'm pretty sure Kam made a function that will do all the exporting for me. I can't even get in touch with Kam who made the the KAM scripts to find out what should I use.
-
You have to learn to debug your scripts because this is the most important thing you need to learn before you start scripting something serious or more advanced: https://wiki.multitheftauto.com/wiki/Debugging And about the teams, I think this may help you: https://community.multitheftauto.com/index.html?p ... ils&id=612
-
<gangs> <!-- GANG 1 --> <gang name="Gang name 1" > <weapons ids="1,2,3,4,5,6" /> <skins ids="0,1,3,5,62,123" /> <vehicles ids="461,429,402" /> <members names="piglet,chicken" /> <!-- for members you could do this but i'd recommend different children because player names may have commas (,) - do something like: --> <members> <member name="piglet" /> <member name="chicken" /> </members> </gang> <!-- GANG 2 --> <gang name="Gang name 2"> <!-- GANG 2 DATA --> </gang> </gangs> g_Teams = { }; -- a global table for teams and their data function initTeams( ) local gangsRoot = xmlLoadFile( "gangList.xml" ); for i, gangNode in ipairs( xmlNodeGetChildren( gangsRoot ) ) do -- loop all the nodes local team = { createTeam( xmlNodeGetAttribute( gangNode, "name" ), 255, 255, 255 ) }; -- create a team and store it in a table for j, child in ipairs( xmlNodeGetChildren( gangNode ) ) do -- loop all the gang children: weapons, skins, etc. local nodeName = xmlNodeGetName( child ); if nodeName == "weapons" then -- check if the node name is "weapons" if so, get the weapon ids from its "ids" attribute local weaponsStr = xmlNodeGetAttribute( child, "ids" ); -- this will return ids as a string from "ids", like: "1,2,3,4,5,6" team.weapons = split( weaponsStr, string.byte( "," ) ); -- returns a table with all weapons in separate index of the table... check split func on wiki for more info elseif nodeName == "skins" then -- do exactly the same as for weapons end end table.insert( g_Teams, team ); -- insert team table to the global teams table end end I hope it will give you the information you asked for. If you still don't understand something, just say what and I'll try to explain it in more detail.
-
The data assigned to grid list items can only be string as you know same goes for what is returned when you try to get its data... So, what your selected variable will be is the player name. You can't pass player name to setPedOnFire! You first need to getPlayerFromName and then pass that player to setPedOnFire BUT do it server-side so that the player will die because I doubt client-side setPedOnFire will take any effects on remote players.
-
I would suggest you have a table with objects. Then check if the table size is greater then 2, if it is, then print a message. You have complicated your script way too much. local objects = { } local selectedObjIndex = { }; if not objects[ playerSource ] then objects[ playerSource ] = { }; end -- when you create new object, check its size: if #objects[ playerSource ] < 2 then -- we can create 1 more object local obj = createObject( ...... ); -- you don't have to assign it to a variable but it'll make the code cleaner local objTab = { obj, { 0,0,0, 0,0,0 } }; -- make a table with the object and a table for its offset coords, NOTE that coords table is at index 2! object element at 1! table.insert( objects[ playerSource ], objTab ); selectedObjIndex[ playerSource ] = #objects[ playerSource ]; -- make the new object as a selected else return outputChatBox( "You can only create 2 objects!!!", playerSource ); end -- in your movement functions use the selectedObjIndex instead of argument passed from pressed key (bindKey) -- this will shorten the script by all not necessary bindKey with different objects -- something like this: local selectedIndex = selectedObjIndex[ playerSource ]; if key ..... then objects[ playerSource ][ selectedIndex ][ 2 ][ 1 ] = objects[ playerSource ][ selectedIndex ][ 2 ][ 1 ] - precision; -- [ 2 ] <-- will be the table of the offset coords... [ 2 ][ 1 ] would be offsetX, [ 2 ][ 2 ] offsetY, [ 2 ][ 3 ] offsetZ, etc. -- as noted on line 8 setElementAttachedOffset( objects[ playerSource ][ selectedIndex ][ 1 ], ........ ); -- [ 1 ] will return the object element end It may look a bit complicated at first but if you'll read the comments and try to understand the code then you'll be fine.
-
If you know it then fix it because debug window tells you what is wrong with your script and you can fix it easily after reading the message.
-
Why did you zipped it and uploaded here? Just pastebin it.
-
Show your latest code. Make sure you don't get any warning/error messages.
-
Use getVehicleName and compare it with the vehicle name that you want to be bulletproof or getElementModel and check if the model ID is the ID of vehicle which you want to be bulletproof.
-
Every vehicle should have an id in xml file so that you can find it with a for loop, xmlNodeGetChildren and xmlNodeGetAttribute (to get the id from the file and compare it with id of vehicle - not the model but the id that you loaded from xml file earlier) and then change the attributes with xmlNodeSetAttribute.
-
I never said it will work. Do you get any warning/error messages? I've heard from a few people that ghost mode doesn't work sometimes.
-
Modules are server-side. You can't use functions exported from modules in client-side scripts. Use debug window to see what is wrong with your script. https://wiki.multitheftauto.com/wiki/Debugging
-
You can use setElementData and set vehicle's owner. Then you can use getElementData to check if driver's name is owner or not.. I would suggest you use account names instead of player name because player name can change but account name will always stay the same even if player will change his name his account name will be the same.
-
What message do you see? "Failed to get.." or "Failed to load..." or maybe you get some warning/error messages in debug window? I don't know who designed your gangs xml file but I know it looks like members, skins, vehicles, weapons and gang are all child of gangs. Your gangs node should have gang children only. Your gang nodes should have their own children nodes which would be members, skins, vehicles and weapons. This will be easier to read and easier to parse. If you load a file, don't forget to unload it!
-
DO NOT TRIPLE POST! Use the damn debug window.. You have many errors in such a short script. https://wiki.multitheftauto.com/wiki/Debugging
-
OK, I missed your first post. I suppose you don't understand what variable types are... If you look at xmlNodeSetAttribute wiki page then you'll see you can only use string or a number for the attribute value. Player element is not string nor number. You can getPlayerName and use it as attribute value. Bad argument means you passed an invalid data type to the function. https://wiki.multitheftauto.com/wiki/Debugging
-
https://wiki.multitheftauto.com/wiki/SetTeamFriendlyFire You even have an example there.
-
You can use https://wiki.multitheftauto.com/wiki/GetVehicleUpgrades instead of the upgrades table.
