Tomc0 Posted September 4, 2013 Share Posted September 4, 2013 Hello guys, I think you know this ! command thing... It's usually used on DD/DM servers, if you write this to the chatbox: !wins examplePlayer, the server outputs the wins of the examplePlayer. I want to implement this thing to one of my script, but I have no idea how to do that. I have a code like that right now, but it's not working: function queryData(message,type) local nickName = getPlayerName(source) if (string.find(message,"!points")) and not (string.find(message," !points")) then else if message == "!cash" or message == "!money" then else if message == "!kills" then outputChatBox(nickName .. " has " .. tostring(getAccountData(account,"totalStatKills")) .. " points.") else if(string.find(message,"!playtime")) and not (string.find(message," !playtime")) then outputChatBox(nickName .. "'s playtime is " .. tostring(return_Played_time(getAccountData(account,"totalStatTime")))) else if(string.find(message,"!wins")) and not (string.find(message," !wins")) then outputChatBox(nickName .. " has " .. tostring(getAccountData(account,"totalStatFirstPlace")) .. " wins.") else if(string.find(message,"!deaths")) and not (string.find(message," !deaths")) then outputChatBox(nickName .. " died " .. tostring(getAccountData(account,"totalStatDies")) .. " times.") else if(string.find(message,"!messages")) and not (string.find(message," !messages")) then outputChatBox(nickName .. " send " .. tostring(getAccountData(account,"totalStatMessages")) .. " messages." ) else if(string.find(message,"!matches")) and not(string.find(message," !matches")) then outputChatBox(nickName .. " played " .. tostring(getAccountData(account,"totalStatMatches")) .. " matches.") end end end end end end end end end Any of you know how to do that? If yes, can someone help me? Thanks for the answers! Link to comment
Castillo Posted September 4, 2013 Share Posted September 4, 2013 Why is not working? do you get any debug error? Link to comment
BieHDC Posted September 5, 2013 Share Posted September 5, 2013 This works for me: --server side addEventHandler ("onPlayerChat",getRootElement(), function(message,type) local nick = getPlayerName(source) if (string.find(message,"!cash")) and not (string.find(message," !cash")) then outputChatBox("#191970* " .. nick .. " #8bbae9 has #FFFFFF" .. getPlayerMoney(source) .. "$#8bbae9 money ", getRootElement(), 255, 255, 255, true) end end) Link to comment
Tomc0 Posted September 5, 2013 Author Share Posted September 5, 2013 Okay, I'm officially dumb as hell. I forgot to add the "onPlayerChat" event handler. Anyways, thanks guys! 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