12.10.2014, 10:37
Hello guys!
I have a problem with a command. I've coded a VIP system for my server with some new commands and also, I've introduced a /vipchat command. Because I didn't want to waste time, I've copied the /adminchat command and just replaced some lines. The problem is that when I use /vipchat in game, it does work, but it is also followed by the "SERVER: Unknown command" message and I just don't understand why. Bellow is the script, please help me.
Thanks in advance!
I have a problem with a command. I've coded a VIP system for my server with some new commands and also, I've introduced a /vipchat command. Because I didn't want to waste time, I've copied the /adminchat command and just replaced some lines. The problem is that when I use /vipchat in game, it does work, but it is also followed by the "SERVER: Unknown command" message and I just don't understand why. Bellow is the script, please help me.
Thanks in advance!
Код:
//===============================================================================================// if(strcmp(cmd, "/vipchat", true) == 0 || strcmp(cmd, "/vc", true) == 0 || strcmp(cmd, "/vchat", true) == 0) { if(IsPlayerConnected(playerid)) { if(gPlayerLogged[playerid] == 0) { SendClientMessage(playerid, COLOR_WHITE, "You havent logged in yet"); return 1; } if (PlayerInfo[playerid][pVIP]==0 && PlayerInfo[playerid][pAdmin] < 1) { SendClientMessage(playerid, COLOR_WHITE, "You are not a VIP member"); return 1; } if(PlayerInfo[playerid][pMuted] == 1) { SendClientMessage(playerid, TEAM_CYAN_COLOR, "You can't speak, you have been silenced"); return 1; } new result[64]; GetPlayerName(playerid, sendername, sizeof(sendername)); new length = strlen(cmdtext); while ((idx < length) && (cmdtext[idx] <= ' ')) { idx++; } new offset = idx; while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))) { result[idx - offset] = cmdtext[idx]; idx++; } result[idx - offset] = EOS; if(!strlen(result)) { SendClientMessage(playerid, COLOR_GREY, "USAGE: /(v)ip©hat [text]"); return 1; } format(string, sizeof(string), "{FFFFFF}» {F3FF02}[VIP CHAT] %s: {FFFFFF}%s", sendername, result); for(new i=0; i<=MAX_PLAYERS; i++) { if(PlayerInfo[i][pVIP]==1) SendClientMessage(i, -1, string); } } return 1; } //===============================================================================================//