How to use this command for 1 specific player and for everybody?
Code:cmd_executestring
Printable View
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.
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
why must you do "h \ Console: "?
Attachment 871
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);
}
You send your message like this:PHP Code:
a = switch to weapon
d = config string modified
e/f = game message
g = bold game message
h = chat
i = team chat
PHP Code:
h "message"
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;
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();
}