• Wire Expression 2: Finding Players X, Y And Z
    4 replies, posted
hi there, i need some help on getting the x, y and z of players using a chat command. Here is my code that is nearly right (i think) but keeps returning 0 on X, Y and Z: [code] @name @inputs @outputs X Y Z @persist @trigger runOnChat(1) if(chatClk(owner())) { ChatCommand="!getxyz " if(owner():lastSaid():left( ChatCommand:length() ):find(ChatCommand)) { Plyname=owner():lastSaid():right(owner():lastSaid():length()-ChatCommand:length()) findByName(Plyname) Ply=find() X=Ply:pos():x() Y=Ply:pos():y() Z=Ply:pos():z() } } [/code] After the !getxyz i would write a name of a player and it would then output the values to the screens X, Y and Z. Thanks for reading.
1: Use code tags 2: Here [code] @name Thing @outputs X Y Z Pos:vector @persist Ply:entity @trigger runOnChat(1), runOnTick(1) if (chatClk(owner())) { M = lastSaid():explode(" ") #<- save the chat command to an array if (M:string(1) == "!getxyz") { # Is the first string equal to "!getxyz"? Ply = findPlayerByName(M:string(2)) #Find the player using the second string } } elseif (tickClk()) { Pos = Ply:pos() #Output pos X = Pos:x() #And the numerical positions.. Y = Pos:y() Z = Pos:z() }[/code]
Thanks ill try it now Edit: how do i use code use code tags
[noparse][code]Code Goes Here[/code][/noparse]
thanks
Sorry, you need to Log In to post a reply to this thread.