Blockland Forums > Modification Help

Click players for info

Pages: (1/4) > >>

420:

I've been wanting to make a script where you can click players to see info about them and here's what I'm trying to do right now

what I want the code below to do is tell me in the chat the name and bl_id of a player when I click them but the problem is the targets info doesn't show up (the rest of the message does)


--- Code: ---package id
{
function Player::activateStuff(%player)
{
%v = Parent::activateStuff(%player);
%client = %player.client;

%target = containerRayCast(%player.getEyePoint(),vectorAdd(vectorScale(vectorNormalize(%player.getEyeVector()),2),%player.getEyePoint()),$TypeMasks::PlayerObjectType,%player);

if(!isObject(%target) || %target == %player || %player.getObjectMount() == %target)
return %v;

messageclient(%client, '', "\c6Name: \c3" @ %target.name @ "   \c6BL_ID: \c3" @ %target.getblid());

return %v;
}
};
activatePackage(id);
--- End code ---

can someone help me out?

Daenth:


--- Quote from: 420 on April 29, 2012, 11:22:24 PM ---I've been wanting to make a script where you can click players to see info about them and here's what I'm trying to do right now

what I want the code below to do is tell me in the chat the name and bl_id of a player when I click them but the problem is the targets info doesn't show up (the rest of the message does)


--- Code: ---package id
{
function Player::activateStuff(%player)
{
%v = Parent::activateStuff(%player);
%client = %player.client;

%target = containerRayCast(%player.getEyePoint(),vectorAdd(vectorScale(vectorNormalize(%player.getEyeVector()),2),%player.getEyePoint()),$TypeMasks::PlayerObjectType,%player);

if(!isObject(%target) || %target == %player || %player.getObjectMount() == %target)
return %v;

messageclient(%client, '', "\c6Name: \c3" @ %target.name @ "   \c6BL_ID: \c3" @ %target.getblid());

return %v;
}
};
activatePackage(id);
--- End code ---

can someone help me out?

--- End quote ---
%target is the player object. Try using %target.client instead of just %target.

Ipquarx:

You just registered today and you're already programming?
Wow.

But on topic, I'm pretty sure what you're looking for is the armor::onTrigger function.

420:


--- Quote from: Ipquarx on April 29, 2012, 11:28:02 PM ---You just registered today and you're already programming?
Wow.

But on topic, I'm pretty sure what you're looking for is the armor::onTrigger function.

--- End quote ---

My BL_ID is in the 7ks lol

420:


--- Quote from: Daenth on April 29, 2012, 11:26:21 PM ---%target is the player object. Try using %target.client instead of just %target.

--- End quote ---

Thank you very much!  It work's flawlessly now :)

Pages: (1/4) > >>

Go to full version