Jump to content

[REL] Pay'N'Sprays + Fast-Food + Ammunations + JP ^r2pl2


mabako

Recommended Posts

  • Replies 58
  • Created
  • Last Reply

Top Posters In This Topic

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

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

... 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

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

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
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

"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

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

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

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 ) 

2224098058_745129c4f3.jpg

Link to comment

<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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...