spoty Posted May 8, 2014 Posted May 8, 2014 Hi There i need some help how can i getPlayerName in outputchatbox? here is the code i have 0 errors but it dont take the player name i had searched on wiki and this what i did addCommandHandler( "akina", function( player ) setElementPosition( player, -2499.77466, 2135.24170, 320.54016 ) outputChatBox( "#FF0000[#FF00FFakina#FF0000]getPlayerFromName( Player ).. '#FF00FFHave Joined #FF0000[#FF00FF/akina#FF0000]", getRootElement(), 255, 255, 255, true ) end )
Dealman Posted May 8, 2014 Posted May 8, 2014 Because you're not concatenating it properly. Read this article for more information regarding concatenation. addCommandHandler( "akina", function(player) setElementPosition(player, -2499.77466, 2135.24170, 320.54016) outputChatBox("#FF0000[#FF00FFakina#FF0000]"..getPlayerFromName(Player).."#FF00FFHave Joined #FF0000[#FF00FF/akina#FF0000]", getRootElement(), 255, 255, 255, true) end )
spoty Posted May 8, 2014 Author Posted May 8, 2014 thats not working now it dont shows the outputchatbox but i gonna check that article
justn Posted May 8, 2014 Posted May 8, 2014 addCommandHandler( "akina", function(player) setElementPosition( player, -2499.77466, 2135.24170, 320.54016 ) outputChatBox( "#FF0000[#FF00FFakina#FF0000]"..getPlayerFromName(player).. "#FF00FFHave Joined #FF0000[#FF00FF/akina#FF0000]", getRootElement(), 255, 255, 255, true ) end )
spoty Posted May 8, 2014 Author Posted May 8, 2014 addCommandHandler( "akina", function(player) setElementPosition( player, -2499.77466, 2135.24170, 320.54016 ) outputChatBox( "#FF0000[#FF00FFakina#FF0000]"..getPlayerFromName(player).. "#FF00FFHave Joined #FF0000[#FF00FF/akina#FF0000]", getRootElement(), 255, 255, 255, true ) end ) ERROR: akina\object\akina.lua:44: attempt to concatenate a boolean value thats this line outputChatBox( "#FF0000[#FF00FFakina#FF0000]"..getPlayerFromName(player).. "#FF00FFHave Joined #FF0000[#FF00FF/akina#FF0000] i dont know that the error wanne say with that
justn Posted May 8, 2014 Posted May 8, 2014 Oh my bad, this should work Forgot to change getPlayerFromName to getPlayerName addCommandHandler( "akina", function(player) setElementPosition( player, -2499.77466, 2135.24170, 320.54016 ) outputChatBox( "#FF0000[#FF00FFakina#FF0000]"..getPlayerName(player).. "#FF00FFHave Joined #FF0000[#FF00FF/akina#FF0000]", getRootElement(), 255, 255, 255, true ) end )
spoty Posted May 8, 2014 Author Posted May 8, 2014 and is it mayby possible to allow players to use the teleport when they are in vehicle?
justn Posted May 8, 2014 Posted May 8, 2014 It is possible, using this code If you don't want the vehicle to be warped also, then you can remove line 5 and replace that with destroyElement(vehicle) addCommandHandler( "akina", function(player) if isPedInVehicle(player) then local vehicle = getPedOccupiedVehicle(player) setElementPosition( vehicle, -2499.77466, 2135.24170, 320.54016 ) setElementPosition( player, -2499.77466, 2135.24170, 320.54016 ) outputChatBox( "#FF0000[#FF00FFakina#FF0000]"..getPlayerName(player).. "#FF00FFHave Joined #FF0000[#FF00FF/akina#FF0000]", getRootElement(), 255, 255, 255, true ) else setElementPosition( player, -2499.77466, 2135.24170, 320.54016 ) outputChatBox( "#FF0000[#FF00FFakina#FF0000]"..getPlayerName(player).. "#FF00FFHave Joined #FF0000[#FF00FF/akina#FF0000]", getRootElement(), 255, 255, 255, true ) end end)
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