mabako Posted January 25, 2008 Author Share Posted January 25, 2008 I've thought about that and a small GUI widget, so you can buy e.g. for $5000 and it shows you how much is left, and you can fly only for the way you've bought. Link to comment
DazzaJay Posted January 26, 2008 Share Posted January 26, 2008 There is a problem i have noticed. Basically, i decided to run it on my server, Which is standard DM (figured Pay n Sprays would add more Strategy into some gametypes) So anyway, the server runs it Full-time. but its interfering with a lot of gamemodes. In Capture The Orb. with Mabako Services running, if you take any car into any paynspray, you get the orb, even if it was over the other side of the map. Also, walking in and out of fast food restarunts gives you the orb. And In Hay, It somehow causes hay to go nuts, and ranomly Kill people for walking away, even tho they were climbing the haystack. The only way i have found around this Problem is to get only ceartian gamemodes to load Mabako services (Like CDM, and CTV) But i would really like to use it in CTO also, but as i said before, its incompadible with CTO. can you check into it please? Link to comment
Woovie Posted January 26, 2008 Share Posted January 26, 2008 Haha that is great. It has to do with the way the player collides with an object to "capture" the orb and how a player also collides with objects entering pay n spray and when they do into an interior. Awesome conflict though =). Link to comment
mabako Posted January 26, 2008 Author Share Posted January 26, 2008 Capture The Orb: ctoclient.lua search for function onClientElementColShapeHit_cto ( colshape, matchingDimension ) -- can get called lots of times tho outputDebugString ( "You hit the colshape!" )--- add below: if( colshape ~= orbCol ) then return end Hay: hay.lua search for local barrier_x local barrier_y local barrier_r add below local barrier search for local barrier = createColCircle ( barrier_x, barrier_y, barrier_r ) addEventHandler ( "onColShapeLeave", barrier, function ( p ) if ( getElementType ( p ) == "player" ) then replace with barrier = createColCircle ( barrier_x, barrier_y, barrier_r ) addEventHandler ( "onColShapeLeave", barrier, function ( p ) if ( source == barrier and getElementType ( p ) == "player" ) then At all, it isn't my fault, but the fault of Aeron and error404 for creating such "greedy" gamemodes - who trigger EVERY colshape, not only the ones created by the cto/hay script. Link to comment
DazzaJay Posted January 26, 2008 Share Posted January 26, 2008 Thanks for that! i will go about changing it soon! (BTW, thanks for youtr In-Depth explanation on what to do!) Link to comment
eAi Posted January 26, 2008 Share Posted January 26, 2008 ... let this be a lesson in providing overly general event handlers! If you add an event handler, make it as specific as possible - attach it directly to the element you're trying to handle the event for if you can. This avoids most potential incompatibilities with other resources. Link to comment
DazzaJay Posted January 26, 2008 Share Posted January 26, 2008 Hay is still randomly killing people, no idea why, but i dont think its cos of mabako services anymore.... as i set up a fresh server with all clean recources and it was doing it on that too But CTO Works Perfectly now! so thanks for that fix! Link to comment
mabako Posted January 26, 2008 Author Share Posted January 26, 2008 ah yeah, then I've no idea about Hay - maybe the boundings are placed way too restrictive? btw... http://mabako.net/mta-screen0029.png http://mabako.net/mta-screen0031.png ... soon Link to comment
DazzaJay Posted January 26, 2008 Share Posted January 26, 2008 THAT IS AWESOME! Quick question, do you plan to get TransFender working aswell? Link to comment
mabako Posted January 26, 2008 Author Share Posted January 26, 2008 My first priority is after jetpacks to get an armor-icon which i could use, then I could, of course see about transfenders/loco low/Wheel Arch Angels - which would be good as well. But i can't tell you anything yet, as I'm not totally sure, it'd be good, but it might take some time. Link to comment
Guest Posted January 26, 2008 Share Posted January 26, 2008 Where i can get gamemode with money for my server? Link to comment
mabako Posted January 26, 2008 Author Share Posted January 26, 2008 just give everyone money on spawn, or on join, etc. you could also just use addEventHandler( "onPlayerSpawn", getRootElement(), function setPlayerMoney( source, 10000 ) end ) server-side Link to comment
mabako Posted January 26, 2008 Author Share Posted January 26, 2008 added Jetpacks now, those work with Fuel (buyable at ammu-nations) and may be obtained at any ammu-nation by now (you can change that of course) for 5% - $500, 20% - $2000, 50% - $5000. You can't use jetpacks in interiors, and you can't enter shops in this script while having a jetpack on. Whenever you die, your jetpack will be removed from your player, but you keep the amount of fuel (an error happened with this before, when you respawned in an interior and had a jetpack, you couldn't remove it) enjoy as always. Link to comment
Woovie Posted January 27, 2008 Share Posted January 27, 2008 You are an amazing coder. I am learning a bit from what you have made. Thank you for the scripts as always! Link to comment
mabako Posted January 27, 2008 Author Share Posted January 27, 2008 "amazing"... before I've started writing resources for MTA, i had almost no experience in LUA, or let's say a very small amount what everyone could learn in a day or two Link to comment
DazzaJay Posted January 27, 2008 Share Posted January 27, 2008 ive been reading the LUA handbook for weeks, and it still makes no sence. Link to comment
eAi Posted January 27, 2008 Share Posted January 27, 2008 ive been reading the LUA handbook for weeks, and it still makes no sence. My advice is to ignore the LUA handbook, it has a tendency to make no sense Just look at all the wiki examples and go from there. Link to comment
DazzaJay Posted January 27, 2008 Share Posted January 27, 2008 The wiki examples are either incomplete, fucked, or just plain broken. Link to comment
50p Posted January 27, 2008 Share Posted January 27, 2008 "Listen to your stomach!", LOL If you get confused about how to write scripts in LUA, try to have a sandwich and come back to learning, ROFL; it helps me because you cannot concentrate if you haven't got energy, hehe! Examples on wiki aren't mostly fcuked or incomplete. Example itself doesn't have to be a complete script. It didn't make any sense to me when I first read all of the tutorials on MTA main site, why? Because you can't learn to write scripts if you haven't got a list of functions. Link to comment
norby89 Posted January 27, 2008 Share Posted January 27, 2008 The wiki examples are either incomplete, fucked, or just plain broken. funny how Everyone else can learn by reading the wiki Link to comment
Woovie Posted January 27, 2008 Share Posted January 27, 2008 I have actually learned very little on the wiki. I learned from reading the FR, CDM, and Broph scripts. I am learning some from this, although your LUA is rather difficult to read. Here is something I have made based off of your ammu-nation. I plan to try to do this all on my own. Here is how it will work. There will be an empty car lot, with, probably, 3-5 red circles. When you walk into them, it will give you a car purchase menu where you will be able to buy vehicles. Here is what I have so far. I would like some help if you wouldn't mind... shops.map <!-- Vehicle Menu --> <!-- id = the name of the image in images/cars/<id>.png name = the name to be shown vehicleid = the ID of the vehicle, see [url=http://development.mtasa.com/index.php?title=Vehicle_IDs]http://development.mtasa.com/index.php? ... ehicle_IDs[/url] --> <shop id="VEHI" type="vehi" name="Vehicle Purchase Station" posX="XXX" posY="YYY" posZ="ZZZ" rotation="RRR" interior="0" rows="3" columns="6"> <!-- Row 1 --> <article id="BANSHEE" name="Banshee" price="20000" vehicleid="429"/> <article id="BULLET" name="Bullet" price="20000" vehicleid="541"/> <article id="CHEETAH" name="Cheetah" price="20000" vehicleid="415"/> <article id="INFERNUS" name="Infernus" price="20000" vehicleid="411"/> <article id="SUPER_GT" name="Super GT" price="20000" vehicleid="506"/> <article id="TURISMO" name="Turismo" price="20000" vehicleid="451"/> </shop> shops.lua (serverside) -- Vehicle Specific, others will have false shops[num].Articles[ sNum ].VehicleID = tonumber( getElementData( sv, "vehicleid" ) ) Now this is where I need help. I need it so when you buy the vehicle, it is placed at specified coordinates. Link to comment
mabako Posted January 27, 2008 Author Share Posted January 27, 2008 somewhere at the end, you should notice elseif( shops[shopID].Articles[articleID].Fuel ) then local newFuel = shops[shopID].Articles[articleID].Fuel if( getElementData( source, "jetpackFuel" ) ) then newFuel = newFuel + tonumber( getElementData( source, "jetpackFuel" ) ) end if( newFuel > tonumber( get("MaxJetpackFuel") ) ) then newFuel = tonumber( get( "MaxJetpackFuel" ) ) end setElementData( source, "jetpackFuel", newFuel ) now, before the end, add elseif( shops[shopID].Articles[articleID].VehicleID ) then local playerX, playerY, playerZ = getElementPosition( source ) local vehicle = createVehicle( shops[shopID].Articles[articleID].VehicleID, playerX, playerY, playerZ ) warpPlayerIntoVehicle( source, vehicle ) -- maybe, only if you want the player to join that vehicle on buying Link to comment
Woovie Posted January 27, 2008 Share Posted January 27, 2008 Wow. Thanks! And actually I am going to have it spawn at some coords in front of him. But thank you so much! I will show some screenshots and such if I get it working good. =) And if you don't mind, release it as an addon for your mod ? Is there a way to make one resource point to another ? Edit: Well I got most everything working. I added this line to the client shops.lua under function addShopArticle. I added it before line 174. I still ahve the issue in the picture shown. I do not know how to properly scale the images I guess. They are 200x75 PNGs. elseif( sType == "cars" ) then sImages[articleID] = guiCreateStaticImage( x/2 - width/2 + 110*lastColumn + 28, y - height - 2 + 120*lastRow, 64, 64, "images/" .. sType .. "/" .. img .. ".png", false, nil ) Link to comment
mabako Posted January 28, 2008 Author Share Posted January 28, 2008 <shop id="VEHI" type="vehi" elseif( sType == "cars" ) then use either "cars" or "vehi" as type - it should be the same as the name of your folder in images/ then... look for elseif( type == "ammu" ) then width = columns * 110 + 10 height = rows * 120 + 50 and add below elseif( type == "cars" ) then width = columns * 210 + 10 height = rows * 125 + 20 and then your code should be elseif( sType == "cars" ) then sImages[articleID] = guiCreateStaticImage( x/2 - width/2 + 210*lastColumn + 10, y - height - 20 + 125*lastRow, 200, 75, "images/" .. sType .. "/" .. img .. ".png", false, nil ) sButtons[articleID] = guiCreateButton( x/2 - width/2 + 210*lastColumn + 10, y - height + 65 + 125*lastRow, 200, 20, name .. " - $" .. tostring( price ), false, nil ) Link to comment
Woovie Posted January 28, 2008 Share Posted January 28, 2008 Oh wow! I am clueless.. I totally forgot those where the same... Wow I feel dumb. Thanks for the help. I will edit this with the results! Edit: It works now! I actually need to put the elseif( sType == "cars" ) then before the ammunation. It was conflicting with the last addbutton thing. Thank you so much for your help though! Now to somehow get some car renders from the in game cars and such. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now