Blockland Forums > Modification Help
Vehicles and ironsights
<< < (2/2)
CityRPG:
you're not doing it right.

your code use %player instead of %obj. change the variable name
otto-san:
we've fixed it


--- Code: ---function Armor::onTrigger(%this, %player, %slot, %val)
{
    if(%obj.getType() & $TypeMasks::PlayerObjectType)
    {
        if(%player.getMountedImage(0) $= Mac10Image.getID() && %slot $= 4 && %val && !%player.getObjectMount())
            %player.mountImage(IronSightMac10Image, 0);
        else if(%player.getMountedImage(0) $= IronSightMac10Image.getID() && %slot $= 4 && %val && !%player.getObjectMount())
            %player.mountImage(Mac10Image, 0);
        else
            parent::onTrigger(%this, %player, %slot, %val);
        return;
    }
    parent::onTrigger(%this, %player, %slot, %val);
}
--- End code ---
CityRPG:
I can tell you right now that code does not work at all.

%obj.getType() & $TypeMasks::PlayerObjectType

%obj is not defined. Checking if %player is a Player Type is also totally redundant and does nothing.
otto-san:

--- Quote from: CityRPG on January 13, 2012, 09:17:10 PM ---I can tell you right now that code does not work at all.

%obj.getType() & $TypeMasks::PlayerObjectType

%obj is not defined. Checking if %player is a Player Type is also totally redundant and does nothing.

--- End quote ---
Oh, yeah, sorry, that's an older version. I went back too far in the pad.

It does work, though.

and where did we check if it was a playertype or not i dont get it
Navigation
Message Index
Previous page

Go to full version