30.10.2012, 04:18
Hello, everybody.
For some reason when players chat, anybody is able to see what they are saying, no matter where they are.
I've gone over this time and time again and I see nothing wrong with it. I have no idea why this is happening.
Help, please? <3 Rep shall be given.
As far as I know, the problem is in this bit:
For some reason when players chat, anybody is able to see what they are saying, no matter where they are.
I've gone over this time and time again and I see nothing wrong with it. I have no idea why this is happening.
Help, please? <3 Rep shall be given.
pawn Код:
public OnPlayerText(playerid, text[]) {
#if defined DEBUG
printf("[debug] OnPlayerText(%d, %s)", playerid, text);
#endif
if(playerVariables[playerid][pStatus] >= 1 && playerVariables[playerid][pMuted] == 0) {
GetPlayerName(playerid, szPlayerName, MAX_PLAYER_NAME);
for(new i = 0; i < strlen(szPlayerName); i++) {
if(szPlayerName[i] == '_')
szPlayerName[i] = ' ';
}
if(playerVariables[playerid][pPhoneCall] != -1) {
format(szMessage, sizeof(szMessage), "[Phone] \"%s\"", text);
SetPlayerChatBubble(playerid, szMessage, COLOR_CHATBUBBLE, 10.0, 10000);
if(!strcmp(playerVariables[playerid][pAccent], "None", true))
format(szMessage, sizeof(szMessage), "[Phone] %s says: %s", szPlayerName, text);
else
format(szMessage, sizeof(szMessage), "[Phone] (%s Accent) %s says: %s", playerVariables[playerid][pAccent], szPlayerName, text);
nearByMessage(playerid, COLOR_WHITE, szMessage);
switch (playerVariables[playerid][pPhoneCall]) {
case 911: {
if(!strcmp(text, "LSPD", true) || !strcmp(text, "police", true)) {
SendClientMessage(playerid, COLOR_WHITE, "[Phone] 911: You have reached the Los Santos Police emergency hotline; can you describe the crime?");
playerVariables[playerid][pPhoneCall] = 912;
}
else if(!strcmp(text, "LSFMD", true) || !strcmp(text, "medic", true) || !strcmp(text, "ambulance", true)) {
SendClientMessage(playerid, COLOR_WHITE, "[Phone] 911: This is the Los Santos Fire & Medic Department emergency hotline; describe the emergency, please.");
playerVariables[playerid][pPhoneCall] = 914;
}
else SendClientMessage(playerid, COLOR_WHITE, "[Phone] 911: Sorry, I didn't quite understand that... speak again?");
}
case 912: {
if(strlen(text) > 1) {
new
location[MAX_ZONE_NAME];
GetPlayer2DZone(playerid, location, MAX_ZONE_NAME);
format(szMessage, sizeof(szMessage), "Dispatch: %s has reported: '%s' (10-20 %s)", szPlayerName, text, location);
SendToGroup(1, COLOR_RADIOCHAT, szMessage);
SendClientMessage(playerid, COLOR_WHITE, "[Phone] 911: Thank you for reporting this incident; a patrol unit is now on its way.");
SendClientMessage(playerid, COLOR_WHITE, "Your call has been terminated by the other party.");
if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_USECELLPHONE) {
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_STOPUSECELLPHONE);
}
playerVariables[playerid][pPhoneCall] = -1;
}
}
case 914: {
if(strlen(text) > 1) {
new
location[MAX_ZONE_NAME];
GetPlayer2DZone(playerid, location, MAX_ZONE_NAME);
format(szMessage, sizeof(szMessage), "Dispatch: %s has reported '%s' (10-20 %s)", szPlayerName, text, location);
SendToGroupType(4, COLOR_RED, szMessage);
SendClientMessage(playerid, COLOR_WHITE, "[Phone] 911: Thank you for reporting this incident; we are on our way.");
SendClientMessage(playerid, COLOR_WHITE, "Your call has been terminated by the other party.");
if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_USECELLPHONE)
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_STOPUSECELLPHONE);
playerVariables[playerid][pPhoneCall] = -1;
}
}
default: { // If they're calling a player, this code is executed.
SendClientMessage(playerVariables[playerid][pPhoneCall], COLOR_GREY, szMessage);
mysql_real_escape_string(szMessage, szMessage);
format(szLargeString, sizeof(szLargeString), "INSERT INTO chatLogs (value, playerinternalid) VALUES('%s', '%d')", szMessage, playerVariables[playerid][pInternalID]);
mysql_query(szLargeString);
}
}
}
else {
if(IsPlayerInAnyVehicle(playerid)) {
new veh = GetPlayerVehicleID(playerid);
if(!IsABoat(veh) && !IsAMBike(veh) && !IsABike(veh) && !IsAPlane(veh)) {
if(!vehicleVariables[veh][vVehicleWindows]) {
if(!strcmp(playerVariables[playerid][pAccent], "None", true)) {
format(szMessage, sizeof(szMessage), "[Vehicle] {FFFFFF}%s says: %s", szPlayerName, text);
}
else {
format(szMessage, sizeof(szMessage), "[Vehicle] (%s Accent) {FFFFFF}%s says: %s", playerVariables[playerid][pAccent], szPlayerName, text);
}
mysql_real_escape_string(szMessage, szMessage);
format(szLargeString, sizeof(szLargeString), "INSERT INTO chatLogs (value, playerinternalid) VALUES('%s', '%d')", szMessage, playerVariables[playerid][pInternalID]);
mysql_query(szLargeString);
playerVariables[playerid][pSpamCount]++;
foreach(Player, i) {
if(GetPlayerVehicleID(i) == veh) {
SendClientMessage(i, COLOR_GREY, szMessage);
}
}
return 0; // you shouldn't remove that :)
}
}
}
if(!strcmp(playerVariables[playerid][pAccent], "None", true)) {
format(szMessage, sizeof(szMessage), "{FFFFFF}%s says: %s", szPlayerName, text);
}
else {
format(szMessage, sizeof(szMessage), "(%s Accent) {FFFFFF}%s says: %s", playerVariables[playerid][pAccent], szPlayerName, text);
}
//if(playerVariables[playerid][pAdminDuty] >= 1) format(szMessage, sizeof(szMessage), "%s says: (( %s ))", szPlayerName, text);
new Float:pos[3];
GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
foreach(Player, i) {
if(IsPlayerInAnyVehicle(i)) {
new veh = GetPlayerVehicleID(i);
if(!IsABoat(veh) && !IsAMBike(veh) && !IsABike(veh) && !IsAPlane(veh)) {
if(vehicleVariables[veh][vVehicleWindows])
SendClientMessage(i, COLOR_GREY, szMessage);
}
else {
if(IsPlayerInRangeOfPoint(playerid, 12.0, pos[0], pos[1], pos[2]))
SendClientMessage(i, COLOR_GREY, szMessage);
}
}
else {
if(IsPlayerInRangeOfPoint(playerid, 12.0, pos[0], pos[1], pos[2]))
SendClientMessage(i, COLOR_GREY, szMessage);
}
}
mysql_real_escape_string(szMessage, szMessage);
format(szLargeString, sizeof(szLargeString), "INSERT INTO chatLogs (value, playerinternalid) VALUES('%s', '%d')", szMessage, playerVariables[playerid][pInternalID]);
mysql_query(szLargeString);
format(szMessage, sizeof(szMessage), "\"%s\"", text);
SetPlayerChatBubble(playerid, szMessage, COLOR_CHATBUBBLE, 10.0, 10000);
}
playerVariables[playerid][pSpamCount]++;
}
return 0;
}
pawn Код:
//if(playerVariables[playerid][pAdminDuty] >= 1) format(szMessage, sizeof(szMessage), "%s says: (( %s ))", szPlayerName, text);
new Float:pos[3];
GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
foreach(Player, i) {
if(IsPlayerInAnyVehicle(i)) {
new veh = GetPlayerVehicleID(i);
if(!IsABoat(veh) && !IsAMBike(veh) && !IsABike(veh) && !IsAPlane(veh)) {
if(vehicleVariables[veh][vVehicleWindows])
SendClientMessage(i, COLOR_GREY, szMessage);
}
else {
if(IsPlayerInRangeOfPoint(playerid, 12.0, pos[0], pos[1], pos[2]))
SendClientMessage(i, COLOR_GREY, szMessage);
}
}
else {
if(IsPlayerInRangeOfPoint(playerid, 12.0, pos[0], pos[1], pos[2]))
SendClientMessage(i, COLOR_GREY, szMessage);
}
}