Author Topic: function gameconnection::createPlayer(%cl) Gets Stuck at Loading Objects  (Read 964 times)

function gameconnection::createPlayer(%cl) in my script causes me to get stuck at Loading Objects.  Is there an alternative to this command?  I'm looking for something that will start the script for the client as soon as he spawns.

Edit:
Code: [Select]
function getHungry(%cl)
{
%cl.hunger -= 1;
%cl.bottomPrint(%cl.hunger);
schedule(1000, 0, getHungry, %cl);
}

//function gameconnection::createPlayer(%cl)
//function serverCMDstartzmod(%cl)
function GameConnection::spawnPlayer(%this)
{
%cl.hunger = 100;
schedule(1000, 0, getHungry, %cl);
}

function serverCMDhunger(%cl)
{
%cl.bottomPrint(%cl.hunger);
}
« Last Edit: June 14, 2012, 04:51:43 PM by brickybob »

HatMod+ uses spawnPlayer and it seems to work just fine.

Code: [Select]
function GameConnection::spawnPlayer(%this)

pretty sure createPlayer has more arguments than just %cl.

spawnplayer does not.

HatMod+ uses spawnPlayer and it seems to work just fine.

Code: [Select]
function GameConnection::spawnPlayer(%this)
still freezes

probably help if I posted the whole script though  :cookieMonster:

Package it and call the parent

Code: [Select]
package Hungry
{
function GameConnection::spawnPlayer(%cl)
{
parent::spawnPlayer(%cl);

%cl.hunger = 100;
schedule(1000, 0, getHungry, %cl);
}
};
activatePackage(Hungry);
That should work.

You have to parent functions that already exist that you want to change.

Warning - while you were typing a new reply has been posted. You may wish to review your post.
-_-
« Last Edit: June 14, 2012, 04:58:50 PM by jes00 »

Package it and call the parent

This, and you are using different variables for the same thing. Same with Jes00 above.

This will work.
Code: [Select]
package Hungry
{
function GameConnection::spawnPlayer(%cl)
{
parent::spawnPlayer(%cl);

%cl.hunger = 100;
schedule(1000, 0, getHungry, %cl);
}
};
activatePackage(Hungry);


This, and you are using different variables for the same thing. Same with Jes00 above.

This will work.
Code: [Select]
package Hungry
{
function GameConnection::spawnPlayer(%cl)
{
parent::spawnPlayer(%cl);

%cl.hunger = 100;
schedule(1000, 0, getHungry, %cl);
}
};
activatePackage(Hungry);
I changed the %this to %cl (although I forgot to change one).

This, and you are using different variables for the same thing. Same with Jes00 above.

This will work.



Thanks.

I recommend that you define gameConnection::getHungry and schedule that on the client object instead of having a detached function with a isObject check.