GamerDeMTA Posted April 15, 2013 Share Posted April 15, 2013 What's wrong with these lines? outputChatBox("You're in "..getTeamName( source ).. " team "..getPlayerName( source ).. "",root,255,255,255,true) Also I want to do a table with outputchatboxs with TRUE AND ALSO 255, 255, 255 THOSE THINGS. I can without it, but with it it gives error. setTimer ( function ( ) outputChatBox ( tabl[math.random(#tabll)] ) end, 10000, 0 ) What I should do? Link to comment
Castillo Posted April 15, 2013 Share Posted April 15, 2013 Well, in your first code, you are trying to get the team name from the player element, not from a team element, you must use getTeamName with getPlayerTeam. And in your second code, how is "tabl" table constructed? Link to comment
GamerDeMTA Posted April 15, 2013 Author Share Posted April 15, 2013 Hm I don't understand how to do it with getPlayerTeam and getTeamName both. And tabl is this: tablelol = { 'lol', 'xd', 'wtf' } Link to comment
xXMADEXx Posted April 15, 2013 Share Posted April 15, 2013 Try: outputChatBox("You're in "..getTeamName( getPlayerTeam ( source ) ).. " team "..getTeamName( getPlayerTeam ( source ) ),root,255,255,255,true) Link to comment
Castillo Posted April 15, 2013 Share Posted April 15, 2013 setTimer ( function ( ) outputChatBox ( tabl [ math.random ( #tabll ) ], 255, 255, 255, true ) end ,10000, 0 ) Link to comment
Sasu Posted April 15, 2013 Share Posted April 15, 2013 Try: outputChatBox("You're in "..getTeamName( getPlayerTeam ( source ) ).. " team "..getTeamName( getPlayerTeam ( source ) ),root,255,255,255,true) He put the name of the player in the end. outputChatBox("You're in "..getTeamName( getPlayerTeam ( source ) ).. " team "..getPlayerName( source ),root,255,255,255,true) Link to comment
GamerDeMTA Posted April 15, 2013 Author Share Posted April 15, 2013 setTimer ( function ( ) outputChatBox ( tabl [ math.random ( #tabll ) ], 255, 255, 255, true ) end ,10000, 0 ) It doesn't work Also when I type the command for my other commands like this: addEventHandler ( "onPlayerChat", root, function ( message ) if ( message == "players" ) then outputChatBox("we are "..getPlayerCount( source ).. " players",root,255,255,0,true) cancelEvent ( ) end end ) It shows the message before I say that ((( I mean this happened, I say players[/ban] and... Me: players we are 1 players It happened... That PLease Help Link to comment
Castillo Posted April 15, 2013 Share Posted April 15, 2013 That code is client side, if you want to do it server side, you must fill the visibleTo argument. setTimer ( function ( ) outputChatBox ( tabl [ math.random ( #tabl ) ], root, 255, 255, 255, true ) end ,10000, 0 ) Link to comment
Sasu Posted April 15, 2013 Share Posted April 15, 2013 setTimer ( function ( ) outputChatBox ( tabl [ math.random ( #tabll ) ], 255, 255, 255, true ) end ,10000, 0 ) It doesn't work Also when I type the command for my other commands like this: addEventHandler ( "onPlayerChat", root, function ( message ) if ( message == "players" ) then outputChatBox("we are "..getPlayerCount( source ).. " players",root,255,255,0,true) cancelEvent ( ) end end ) It shows the message before I say that ((( I mean this happened, I say players[/ban] and... Me: players we are 1 players It happened... That PLease Help getPlayerCount haven't arguments so delete "source". Link to comment
Renkon Posted April 15, 2013 Share Posted April 15, 2013 ( tabl [ math.random ( #tabll )) -- there's a typo Link to comment
GamerDeMTA Posted April 16, 2013 Author Share Posted April 16, 2013 Ok but help me with this! When I type "ping" it shows the outputChatBox two times! addEventHandler ( "onPlayerChat", root, function ( message ) if ( message == "ping" ) then outputChatBox("your ping: "..getPlayerPing( source ).. " \"{SMILIES_PATH}/icon_biggrin.gif\" alt=\"\" title=\"Very Happy\" />",root,255,255,0,true) cancelEvent ( ) end end ) Why??? Link to comment
Max+ Posted April 16, 2013 Share Posted April 16, 2013 Make Sure Freeroam is Off and Try This , addEventHandler('onPlayerCommand', root, function ( cmd ) if ( cmd ) == 'ping' then cancelEvent ( ) outputChatBox('Your Ping'.. getPlayerName(source), root, 255, 255, 0 , true) end end ) Link to comment
GamerDeMTA Posted April 16, 2013 Author Share Posted April 16, 2013 Make Sure Freeroam is Off and Try This , addEventHandler('onPlayerCommand', root, function ( cmd ) if ( cmd ) == 'ping' then cancelEvent ( ) outputChatBox('Your Ping'.. getPlayerName(source), root, 255, 255, 0 , true) end end ) Freeroam isn't running But I want to do it if player says "ping" not with a command. Please help Link to comment
Mega9 Posted April 16, 2013 Share Posted April 16, 2013 addEventHandler('onPlayerChat', root, -- When player sends the message in chatbox function ( msg ) if ( msg ) == 'ping' then -- if message was "ping" then cancelEvent ( ) -- don't show the message outputChatBox(getPlayerName(source) .. "'s ping is: " .. getPlayerPing (source), root, 255, 255, 0 , true) -- Output player's name and ping end end ) Link to comment
GamerDeMTA Posted April 16, 2013 Author Share Posted April 16, 2013 It doesn't work yet!!!!!! Two times it shows the output instead one (((( Link to comment
Sasu Posted April 16, 2013 Share Posted April 16, 2013 Try this: addEventHandler('onPlayerChat', root, -- When player sends the message in chatbox function ( msg, msgT ) if msg == 'ping' and msgT == 1 then -- if message was "ping" then cancelEvent ( ) -- don't show the message outputChatBox(getPlayerName(source) .. "'s ping is: " .. getPlayerPing (source), root, 255, 255, 0 , true) -- Output player's name and ping end end ) Link to comment
xXMADEXx Posted April 16, 2013 Share Posted April 16, 2013 Try: outputChatBox("You're in "..getTeamName( getPlayerTeam ( source ) ).. " team "..getTeamName( getPlayerTeam ( source ) ),root,255,255,255,true) He put the name of the player in the end. outputChatBox("You're in "..getTeamName( getPlayerTeam ( source ) ).. " team "..getPlayerName( source ),root,255,255,255,true) oh, didn't see that. Sorry. Thanks for fixing it. Link to comment
GamerDeMTA Posted April 16, 2013 Author Share Posted April 16, 2013 Try this: addEventHandler('onPlayerChat', root, -- When player sends the message in chatbox function ( msg, msgT ) if msg == 'ping' and msgT == 1 then -- if message was "ping" then cancelEvent ( ) -- don't show the message outputChatBox(getPlayerName(source) .. "'s ping is: " .. getPlayerPing (source), root, 255, 255, 0 , true) -- Output player's name and ping end end ) Now it doesn't work ._. Pls someone help!!! Link to comment
OGF Posted April 16, 2013 Share Posted April 16, 2013 Is your problem still that it displays twice or what? because it works fine. If it is still displaying twice, then you are obviously running another eventHandler with "onPlayerChat" . Link to comment
Sasu Posted April 16, 2013 Share Posted April 16, 2013 Sorry change: if msg == 'ping' and msgT == 1 then to if msg == 'ping' and msgT == 0 then And check in the meta that the type script is server. Execute command debugscript 3 on game to see if it has error. Link to comment
xXMADEXx Posted April 17, 2013 Share Posted April 17, 2013 It doesn't work yet!!!!!! Two times it shows the output instead one (((( Then, there is probably another script somewhere? Link to comment
Mega9 Posted April 17, 2013 Share Posted April 17, 2013 Script works fine, there is another resource causing double messages. I remember I had the same problem, but forgot what was causing it exactly. Try leaving only admin and this resource on and see what happens. 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