Author Topic: Get the player's name from onPlayerTouch?  (Read 1039 times)

I'm trying to get a player's name when they touch a brick. Example: it will say "Blockhead12345 has touched the brick!"
Can anyone help?

If you are in a minigame:

onPlayerTouch -> Minigame -> CenterPrintAll -> %1 touched the brick!

%1 (in events) gives the person's name.

If you are in a minigame:

onPlayerTouch -> Minigame -> CenterPrintAll -> %1 touched the brick!

%1 (in events) gives the person's name.

Thanks!

If you are in a minigame:

onPlayerTouch -> Minigame -> CenterPrintAll -> %1 touched the brick!

%1 (in events) gives the person's name.
this doesn't work
it will say that the client touched the brick instead of the person who touched it.

this doesn't work
it will say that the client touched the brick instead of the person who touched it.
This doesn't make any sense. It finds the client name based on the player. What are you trying to say??

this doesn't work
it will say that the client touched the brick instead of the person who touched it.
Client is the persons computer.
Player is the persons body
%1 resolves a client (or player I'm not sure) object into their player name.

This doesn't make any sense. It finds the client name based on the player. What are you trying to say??
sorry, i couldn't find a better way to word it
lets say you have blockhead 1 and blockhead 2
when blockhead 1 touches the brick it will say blockhead 1 touched the brick
when blockhead 1 touches the brick it will say blockhead 2 touched the brick

sorry, i couldn't find a better way to word it
lets say you have blockhead 1 and blockhead 2
when blockhead 1 touches the brick it will say blockhead 1 touched the brick
when blockhead 1 touches the brick it will say blockhead 2 touched the brick

Isn't that exactly what he wants?

Isn't that exactly what he wants?
Never mind, didn't read carefully.

sorry, i couldn't find a better way to word it
lets say you have blockhead 1 and blockhead 2
when blockhead 1 touches the brick it will say blockhead 1 touched the brick
when blockhead 1 touches the brick it will say blockhead 2 touched the brick
What the hell are you talking about? %1 returns the client object of the player that touches the brick.
I'm assuming that it loops through all of the clients and checks if they are in the minigame, and returns true if so, and then messages them.
This isn't the actual current source code, but here's the messageTeam code from v0002:

function messageTeam(%team, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13)
{
   %count = ClientGroup.getCount();
   for(%cl= 0; %cl < %count; %cl++)
   {
      %recipient = ClientGroup.getObject(%cl);
     if(%recipient.team == %team)
         messageClient(%recipient, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13);
   }
}

I'm assuming that sending a chatmessage/centerprint whatever through the minigame does the same method, because that would make sense.
Anyways, he asked how to get a player's name from player touch. Step on the brick, and it works. But how would having two people in the entire miniGame mess up the fact that one of them touched the brick and it said "Blockhead has touched the brick!"? Please explain.

What the hell are you talking about? %1 returns the client object of the player that touches the brick.
I'm assuming that it loops through all of the clients and checks if they are in the minigame, and returns true if so, and then messages them.
This isn't the actual current source code, but here's the messageTeam code from v0002:

function messageTeam(%team, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13)
{
   %count = ClientGroup.getCount();
   for(%cl= 0; %cl < %count; %cl++)
   {
      %recipient = ClientGroup.getObject(%cl);
     if(%recipient.team == %team)
         messageClient(%recipient, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13);
   }
}

I'm assuming that sending a chatmessage/centerprint whatever through the minigame does the same method, because that would make sense.
Anyways, he asked how to get a player's name from player touch. Step on the brick, and it works. But how would having two people in the entire miniGame mess up the fact that one of them touched the brick and it said "Blockhead has touched the brick!"? Please explain.
Sorry, I was wrong, I must of been thinking of something else.