new UsePlayerid = -1; public OnRconCommand(cmd[]) { new cmdtext[256], tmp[256], idx; new String[128]; cmdtext = strtok(cmd, idx); if(!strcmp(cmdtext,"chat",true)) { tmp = bigstrtok(cmd, idx); if(strlen(tmp)) { if(UsePlayerid != -1 && IsPlayerConnected(UsePlayerid)) { new name[MAX_PLAYER_NAME]; new textstring[128]; format(textstring, sizeof(textstring), "[%i] %s", UsePlayerid, tmp); GetPlayerName(UsePlayerid, name, sizeof name); SendPlayerMessageToAll(UsePlayerid, textstring); printf("[chat] [%s]: %s", name, tmp); } else { format(String, sizeof String, "RconPlayer: [-1] %s", tmp); SendClientMessageToAll(0xFFFFFFAA, String); printf("[chat] [RconPlayer]: %s", tmp); } } return 1; } if(!strcmp(cmdtext,"useplayer",true)) { tmp = strtok(cmd, idx); if(strlen(tmp)) { UsePlayerid = strval(tmp); if(IsPlayerConnected(UsePlayerid) || UsePlayerid == -1) { if(UsePlayerid == -1) { print("You are now using RconPlayer (ID -1) to chat with."); } else { new name[MAX_PLAYER_NAME]; GetPlayerName(UsePlayerid, name, sizeof name); printf("You are now using %s (ID %i) to chat with.", name, UsePlayerid); } } else { printf("ID %i is not a valid playerid.", UsePlayerid); } } return 1; } return 1; } strtok(const string[], &index) { new length = strlen(string); while ((index < length) && (string[index] <= ' ')) { index++; } new offset = index; new result[20]; while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1))) { result[index - offset] = string[index]; index++; } result[index - offset] = EOS; return result; } stock bigstrtok(const string[], &idx) { new length = strlen(string); while ((idx < length) && (string[idx] <= ' ')) { idx++; } new offset = idx; new result[128]; while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))) { result[idx - offset] = string[idx]; idx++; } result[idx - offset] = EOS; return result; }
Originally Posted by Izanagi
he prolly meant the player in-game chat window which he calls console
|
Originally Posted by ledzep
DCMD :P
I couldn't even get my RCON to print(cmd), let alone test your commands. Maybe it's a Vista thing? I dunno what to say. Is it saying Unknown command inside the console, or to the player you are using chat/useplayer on? |
Unknown command or variable: command |
Originally Posted by ♣ ⓐⓢⓢ
everything looks ok, and if you rly get
Quote:
|