Author Topic: If client player object  (Read 2138 times)

Code: (Torque) [Select]
function lololololol(%client)
{
    if(!isObject(%client.player))
    {
messageClient(%client, '', "loloolololol");
    }
}
Don't use that yet.

Oh wait, you need something to initialize it. Start when the player is first spawning? End when he/she/it leaves?

You'd use a loop:
Code: [Select]
function playerMessage(%client)
{
     if(!isObject(%client))
          return;

     if(isObject(%client.player))
          messageClient(...);

     schedule(5000,0,"playerMessage",%client);
}

playerMessage(%client);

That demonstrates how to keep calling the function, and how to quit it if the client leaves the game. It also sends a message every 5 seconds provided the client has a player object.

Also,
Kalphiter  just stop.

Please do, You reak of incompetence.

Code: (Torque) [Select]
package lololololmypack
{
    function GameConnection::onClientEnterGame(%client,%name,%a,%b,%c,%d,%e)
    {
Parent::onClientEnterGame(%client,%name,%a,%b,%c,%d,%e);
playerMessage(%client);
    }

};

activatepackage(lololololmypack);

Darn it, forgot to disconnect. Wait

Code: (Torque) [Select]
package lololololmypack
{
    function GameConnection::onClientEnterGame(%this,%name,%a,%b,%c,%d,%e)
    {
Parent::onClientEnterGame(%this,%name,%a,%b,%c,%d,%e);
playerMessage(%client);
    }

};

activatepackage(lololololmypack);

Fail again, %client doesn't exist. Honestly you're just confusing this guy and its getting pretty pathetic. He's asked you to stop so quit being a jerk and stop, ok?

I've got some sleeping to do but I'd wait for someone more competent to come along and help - you don't want to listen to this idiot or you might end up as stupid as he is.
« Last Edit: June 15, 2009, 08:53:23 PM by Ephialtes »


You er, edited your post. I quoted your screw-up, don't worry.

Alright, should it start looping again after the player respawns?

Also, Ephialtes, explain this: http://forum.blockland.us/index.php?topic=68435.msg1151573#msg1151573
That is pretty mean.

Alright, should it start looping again after the player respawns?

Owch, do you even understand the code I wrote? If you did you would realise that it constantly loops regardless of whether the player dies or not, but only sends a message if the player is alive. I can't believe I have to educate you on the most basic principles.

Also; start a drama topic, this isn't the place for you to bitch about me being "mean" to you.

Owch, do you even understand the code I wrote? If you did you would realise that it constantly loops regardless of whether the player dies or not, but only sends a message if the player is alive. I can't believe I have to educate you on the most basic principles.

Also; start a drama topic, this isn't the place for you to bitch about me being "mean" to you.

Read comment

Code: (Torque) [Select]
function playerMessage(%client)
{
     if(!isObject(%client))
          return; //never goes back to this function once the player dies

     if(isObject(%client.player))
          messageClient(...);

     schedule(5000,0,"playerMessage",%client);
}

playerMessage(%client);

Read comment

Code: (Torque) [Select]
function playerMessage(%client)
{
     if(!isObject(%client))
          return; //never goes back to this function once the player dies

     if(isObject(%client.player))
          messageClient(...);

     schedule(5000,0,"playerMessage",%client);
}

playerMessage(%client);

Do you understand what a client is? %client represents a connection to the server. %client.player is the player object in the server. If a player dies, the connection is not deleted - it still exists. Please let me know which part of this is confusing for you.

function called on %client

it's an object, message, and schedule next check in 5 secs

it's an object, message, and schedule next check in 5 secs

it's not an object, goes into return statement, no chance to be called again

function called on %client

it's an object, message, and schedule next check in 5 secs

it's an object, message, and schedule next check in 5 secs

it's not an object, goes into return statement, no chance to be called again

I really don't think you understand at all. You should probably study the basics of TorqueScript before you attempt to help people again. I'll go in-depth for you because I pity your stupidity.

A client is a connection. When a client connects to the server the messagePlayer function is called on the client. The client exists until the client leaves the server and disconnects. Are you with me so far? The client is ALWAYS on the server, always. When the client leaves, the function returns and doesn't need to be called until the client re-joins.

Next, a player is created when a client has finished loading and spawns in the server. This player can die and will therefore no longer exist, but the client will ALWAYS exist until the client leaves the game. So this function will ALWAYS call while the client is connected to the game, and it will ALWAYS call even if the player is dead. It will ONLY send a message if the player exists though.

Do you understand yet?

Honestly If I didn't know you better I'd swear you were trolling me.
« Last Edit: June 15, 2009, 09:13:08 PM by Ephialtes »


Well what are you doing trying to help some guy in the Coding Help forum when you can't even comprehend this very simple concept? Maybe this will be helpful for bloodnight.

Well what are you doing trying to help some guy in the Coding Help forum when you can't even comprehend this very simple concept? Maybe this will be helpful for bloodnight.
You're just trying to prevent me to make good stuff. Good going.

I actually have good stuff.