How to use this command for 1 specific player and for everybody?
Code:cmd_executestring
How to use this command for 1 specific player and for everybody?
Code:cmd_executestring
Cmd_ExecuteString executes a text command on the server (without any output). This is equal to when someone executes /rcon say abc.
You can tell a message to a player with the function below:
You can also send rcon commands to client that isn't logged in.PHP Code:
tellMessage(message)
{
Cmd_ExecuteString("tell " + self getEntityNumber() + " " + message);
}
You can also directly send message to the client using printOutOfBand.PHP Code:
self connectionlessPacket("rcon " + getcvar("rcon_password") + " status");
There is also a function that sends a game message. This message is tracked within the engine like when you use 'player setClientCvar(cvar, value)'.PHP Code:
self printOutOfBand("print\ninsert test message here!!!\n"); // shows up in client's console
When clientNum is -1 then the message is send to all the players.PHP Code:
sendGameServerCommand(clientNum, message);
sendgameservercommand(players[i] getentitynumber(), "h \"" + self.name + "^7: " + txt + "\""); // client: say abc (= txt)
Edit: i see now that i need to add the last 3 functions to the documentation.
kung foo man (29th June 2015),Ni3ls (29th June 2015)
Please use sendgameservercommand instead of cmd_executestring("tell"), its much more stable and much more native than the executestring, which is also overwriting some buffers when executing it during a callback_playercommand
"Does not work" is an error report for a bug between keyboard and chair.
All hail Artie Effem
Mitch (29th June 2015)
why must you do "h \ Console: "?
Code:case "help": self.id=self getEntityNumber(); message = "Available commands: !ratio"; self thread tellMessage(message);Why does it print it 3 times? 1 normal and 2 weird onesCode:tellMessage(message) { Cmd_ExecuteString("tell " + self getEntityNumber() + " " + message); }
Last edited by Ni3ls; 29th June 2015 at 18:59.
kung foo man (29th June 2015),Ni3ls (29th June 2015)
How to let the !help stay in chat? I tried to manually repeat it with clientcmd, but it still won't shownCode:case "help": self.id=self getEntityNumber(); self setClientCvar ("clientcmd", "say !help"); self openMenu ("clientcmd"); self closeMenu ("clientcmd"); wait 1; message = "Available commands: !ratio"; self thread tellMessage(message); return;
"Does not work" is an error report for a bug between keyboard and chair.
All hail Artie Effem
kung foo man (29th June 2015),Ni3ls (29th June 2015)
It is in the playercommand callback?
Code:case "help": self.id=self getEntityNumber(); self setClientCvar ("clientcmd", "say !help"); self openMenu ("clientcmd"); self closeMenu ("clientcmd"); wait 1; message = "Available commands: !ratio"; self thread tellMessage(message); return; } } self ClientCommand(); }