Author Topic: Player Locations?  (Read 1585 times)

gives a three-word string representing the player's coordinates

It's worth noting that these are called vectors (they have a direction and a magnitude)

The appropriate manipulation functions all start with the word Vector

e.g.
VectorAdd("1 1 2, "4 4 3") == "5 5 5"
VectorScale("1 2 3", 2) == "2 4 6"

Is there a way that I can cut the location thing down to 1 decimal? (eg. 1.1, 5.7 NOT 1.251799)

Is there a way that I can cut the location thing down to 1 decimal? (eg. 1.1, 5.7 NOT 1.251799)

mFloatLength(1.251799, 1) == 1.3

Edit: Accidentally truncated the variable instead of rounding it like mFloatLength does. mFloatLength(1.251799, 1) will return 1.3 not 1.2 like previously stated.
« Last Edit: February 04, 2015, 06:37:26 PM by $trinick »

Do I have to type in the number/variable manually?

No, you can pass variables to it just like anything else

Also, since there's no rounding function for vectors you'll have to round each number manually, like so:

Code: [Select]
%x = getWord(%location, 0);
%y = getWord(%location, 1);
%z = getWord(%location, 2);

%x = mFloatLength(%x, 1);
%y = mFloatLength(%y, 1);
%z = mFloatLength(%z, 1);

%location = %x SPC %y SPC %z;

Or the same thing compressed into one line:
%location = mFloatLength(getWord(%location, 0), 1) SPC mFloatLength(getWord(%location, 1), 1) SPC mFloatLength(getWord(%location, 2), 1);

Don't forget that messageClient's args are actually messageClient(%client,'MsgTag' (leave it as '' unless you are trying to do something with it), "message");

Don't forget that messageClient's args are actually messageClient(%client,'MsgTag' (leave it as '' unless you are trying to do something with it), "message");
Can I like have a list of those MsgTags? I currently know 'MsgAdminForce' which plays the Admin sound.

you want to be using %target.player, if that doesn't exist then they either haven't spawned, or are dead (and their body has poofed).
Fun fact: dying actually disconnects the player from the client, so being alive and having a player go hand in hand.

Can I like have a list of those MsgTags? I currently know 'MsgAdminForce' which plays the Admin sound.
Many of them are for things that aren't actually messages, like changes in inventory, brick plant errors, or when your player dies and gets that "respawning in 5" center print. Most of the time you'll want to leave it blank, because they're handled client-side and are hard-coded to do things when they're received. MsgAdminForce is about the only exception you'll need, which usually goes with an announcement of an admin action.