Author Topic: Pickling Code is Pickling.  (Read 3082 times)


I found this error in console Ephi:
Code: [Select]
Add-Ons/Weapon_LightSaber.cs (453): Player::mountimage - wrong number of arguments.Heres lines 446-453, they are all related.
Code: [Select]
if(%player.client.LSHilt $= 1)
%player.mountImage(LightSaber1Image);
else if(%player.client.LSHilt $= 2)
%player.mountImage(LightSaber2Image);
else if(%player.client.LSHilt $= 3)
%player.mountImage(LightSaber3Image);
else
%player.mountImage(LightSaber1Image);
« Last Edit: March 18, 2008, 11:36:00 AM by Dr Bling »

Keep the code for servercmdhilt1 and servercmdhilt2, just replace the LightSaberitem::onUse(%this,%a,%b,%c,%d,%e) function with mine. Then type /hilt1 or /hilt2 and use the item.

Code: [Select]
function LightsaberItem::onUse(%this,%player,%slot)
{
        %player.updateArm(LightSaber1Image);
if(%player.client.LSHilt $= 1)
%player.mountImage(LightSaber1Image,0);
else if(%player.client.LSHilt $= 2)
%player.mountImage(LightSaber2Image,0);
else if(%player.client.LSHilt $= 3)
%player.mountImage(LightSaber3Image,0);
else
%player.mountImage(LightSaber1Image,0);
}

function serverCmdHilt1(%client)
{
%client.LSHilt = 1;
if(%client.player.getMountedImage(0).item.getID() $= LightsaberItem.getID())
LightsaberItem::onUse(LightsaberItem,%client.player,0);
}

function serverCmdHilt2(%client)
{
%client.LSHilt = 2;
if(%client.player.getMountedImage(0).item.getID() $= LightsaberItem.getID())
LightsaberItem::onUse(LightsaberItem,%client.player,0);
}

function serverCmdHilt3(%client)
{
%client.LSHilt = 3;
if(%client.player.getMountedImage(0).item.getID() $= LightsaberItem.getID())
LightsaberItem::onUse(LightsaberItem,%client.player,0);
}

Might work, try and see. I'm assuming that all your lightsaber images use the same item. This will make it so that if you do /hilt3 and then equip a lightsaber, it will set it to the image with hilt 3. It will also make it so if you do /hilt3 while holding hilt 2, you will equip hilt 3.

Try now

Space Guy, thank you for posting a working code. Thank you everyone else for trying :)