Well, whenever I call someone and he answers, I type something and it comes in mainchat instead of [phonecall] hey
Код:
public OnPlayerText(playerid, text[])
{
if (!IsPlayerConnected2(playerid)) return 0;
new string[256], playername[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
new count = GetTickCount2();
if (count-cflood[playerid][1] < 1000) {
cflood[playerid][0] ++;
if (cflood[playerid][0] == 5) {
if (cdata[playerid][2] == 0 || text[0] == '!') {
printf("[chat] [%s]: %s", playername, text);
}
else {
GetPlayerName(cdata[playerid][0], string, MAX_PLAYER_NAME);
printf("[phonecall] [%s - %s]: %s", playername, string, text);
}
cflood[playerid][0] = 0;
SendClientMessage2(playerid, COLOR_WHITE, "~ You have been kicked for flooding.");
pkicktimer[playerid] = SetTimerEx("KickBanTimer", 50, 0, "dd", playerid, 1);
format(string, 128, "~ %s has been kicked from the server (Flooding).", playername);
SendClientMessageToAll2(COLOR_WHITE, string);
printf("[kicked] %s has been kicked from the server (Flooding).", playername);
return 0;
}
}
else {
cflood[playerid][0] = 1;
}
cflood[playerid][1] = count;
if (Logged[playerid] == 0) {
printf("[chat] [%s]: %s", playername, text);
if (dini_Exists(AddDirFile(dir_userfiles, playername))) {
SendClientMessage2(playerid, COLOR_WHITE, "You must login to play! Type /login to continue.");
}
else {
SendClientMessage2(playerid, COLOR_WHITE, "You must register to play! Type /register to continue.");
}
return 0;
}
IdleTime[playerid] = 90;
if (mtimer[playerid] != 0) {
if (cdata[playerid][2] == 0 || text[0] == '!') {
printf("[chat] [%s]: %s", playername, text);
}
else {
GetPlayerName(cdata[playerid][0], string, MAX_PLAYER_NAME);
printf("[phonecall] [%s - %s]: %s", playername, string, text);
}
SendClientMessage2(playerid, COLOR_RED, "Error: You are muted smart ass!");
return 0;
}
GetServerVarAsString("rcon_password", string, 64);
if (strfind(text, string, true) != -1) {
if (cdata[playerid][2] == 0 || text[0] == '!') {
printf("[chat] [%s]: %s", playername, text);
}
else {
GetPlayerName(cdata[playerid][0], string, MAX_PLAYER_NAME);
printf("[phonecall] [%s - %s]: %s", playername, string, text);
}
return 0;
}
new t = 0;
while (t < strlen(text)-1) {
if (text[t] == ' ' && text[t+1] == ' ') {
strdel(text, t+1, t+2);
}
else t ++;
}
if (cdata[playerid][2] == 1) {
if (text[0] == '!') {
printf("[chat] [%s]: %s", playername, text);
strmid(string, text, 1, strlen(text));
for (new i = 0; i < PLAYERS; i++) {
if (IsPlayerConnected2(i)) {
if (PlayerIgnored[i][playerid] == 0) SendPlayerMessageToPlayer(i, playerid, string);
}
}
}
else {
GetPlayerName(cdata[playerid][0], string, MAX_PLAYER_NAME);
printf("[phonecall] [%s - %s]: %s", playername, string, text);
format(string, sizeof(string), "[phonecall] %s", text);
SendClientMessage2(cdata[playerid][0], COLOR_SILVER, string);
format(string, sizeof(string), "[phonecall] %s", text);
SendClientMessage2(playerid, COLOR_LBLUE, string);
}
}
else {
printf("[chat] [%s]: %s", playername, text);
for (new i = 0; i < PLAYERS; i++) {
if (IsPlayerConnected2(i)) {
if (PlayerIgnored[i][playerid] == 0) SendPlayerMessageToPlayer(i, playerid, text);
}
}
}
return 0;
}