thasajti Posted November 12, 2015 Share Posted November 12, 2015 I wrote this code, and can't figure out why it won't work. function getPos(player,command,target) if target == nil then outputChatBox(player.." poziciója: "..getElementPosition(player)) else outputChatBox(target.." poziciója: "..getElementPosition(target)) end end addCommandHandler("pos",getPos) Link to comment
AlvarO Posted November 12, 2015 Share Posted November 12, 2015 Try to function getPos(player,command,target) x, y, z = getElementPosition(player) tx, ty, tz = getElementPosition(target) if target == nil then outputChatBox(player.." poziciója: "..x..y..z) else outputChatBox(target.." poziciója: "..tx..ty..tz) end end addCommandHandler("pos",getPos) Link to comment
ALw7sH Posted November 12, 2015 Share Posted November 12, 2015 target is a string not player you have to use getPlayerFromName Link to comment
Rockyz Posted November 13, 2015 Share Posted November 13, 2015 Try this : function getPos ( thePlayer, cmd, target ) local t = getPlayerFromName ( target ); if ( isElement ( t ) ) then outputChatBox ( " poziciója: " .. table.concat ( { getElementPosition ( t ) }, ", " ), thePlayer, 0, 255, 0, true ); else outputChatBox ( " poziciója: " .. table.concat ( { getElementPosition ( thePlayer ) }, ", " ), thePlayer, 255, 0, 0, true ); end end addCommandHandler ( "pos", getPos ); Its Works Itry It Link to comment
thasajti Posted November 13, 2015 Author Share Posted November 13, 2015 thank you guys, ~xiRoc[K]#^'s one worked for me. Topic solved. Link to comment
LoneGuardian Posted November 13, 2015 Share Posted November 13, 2015 If your doing this clientside, you might as well through this in there https://wiki.multitheftauto.com/wiki/SetClipboard and have it set the clipboard as the position string. Link to comment
Rockyz Posted November 13, 2015 Share Posted November 13, 2015 If your doing this clientside, you might as well through this in there https://wiki.multitheftauto.com/wiki/SetClipboard and have it set the clipboard as the position string. he didnt want it thank you guys, ~xiRoc[K]#^'s one worked for me. Topic solved. You're Welcome Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now