Author Topic: Can someone tell me whats wrong with this code?  (Read 994 times)

Well, it worked ... but the deathmessage wouldnt show, and i guess other stuff will happen that im not aware of yet.

Heres the code i used :
Code: [Select]
package Keepitemsondeath
{
function gameconnection::spawnplayer(%this)
{
parent::spawnplayer(%this);
loaditems(%this);
}

function gameconnection::ondeath(%this)
{
saveitems(%this);
parent::ondeath(%this);
}
};
Activatepackage(Keepitemsondeath);

function loaditems(%c)
{
for(%a=0;%a<=5;%a++)
{
%c.player.tool[%a]=%c.Items[%a];
messageClient(%c, 'MsgItemPickup', '', %a, %c.Items[%a]);
}
}

function saveitems(%c)
{
for(%a=0;%a<=5;%a++)
{
%c.Items[%a]=%c.player.tool[%a];
}
}

It DID make the player get the items on respawn.

Could there be something wrong with the package >.< or other addons colliding with it?

EDIT : Well it wont work in minigames but it does work outside of a minigame ... strange =/
« Last Edit: April 03, 2008, 06:02:33 PM by NiXiLL »

You'd get more help if it was idented, here :)

Code: [Select]
package Keepitemsondeath
{
function gameconnection::spawnplayer(%this)
{
parent::spawnplayer(%this);
loaditems(%this);
}

function gameconnection::ondeath(%this)
{
saveitems(%this);
parent::ondeath(%this);
}
};
Activatepackage(Keepitemsondeath);

function loaditems(%c)
{
for(%a=0;%a<=5;%a++)
{
%c.player.tool[%a]=%c.Items[%a];
messageClient(%c, 'MsgItemPickup', '', %a, %c.Items[%a]);
}
}

function saveitems(%c)
{
for(%a=0;%a<=5;%a++)
{
%c.Items[%a]=%c.player.tool[%a];
}
}

Thanks but its like package/parent:: doesnt work =S

And ill indent my code in further posts ;D

EDIT : Okay i dont think theres anything wrong with this code except it doesnt work in minis, i really thought something was wrong... Theres another problem causing it, very strange things are happening in blockland for an unknown reason.. sounds change,theres an energy bar where it shouldnt be,death isnt displayed at times,...

EDIT 2 : Now how should i make it work in minigames?

EDIT 3 : Made it work in minis and found out that this thing bugs whole the server. Help anyone?
« Last Edit: April 05, 2008, 01:40:12 PM by NiXiLL »