26.11.2014, 20:24
Do not know what it happened in this way is for the person entering /f e talk in chat of the family, that is, only those who have the same _secondname, shown only for those with _secondname
Код:
C:\Documents and Settings\P.Henrique\Desktop\WSA\gamemodes\WSA.pwn(47290) : warning 219: local variable "playername" shadows a variable at a preceding level Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 1 Warning.
pawn Код:
if (strcmp(cmd, "/famly", true) == 0 || strcmp(cmd, "/f", true) == 0)
{
if (IsPlayerConnected(playerid))
{
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if (!strlen(result))
{
SendClientMessage(playerid, COLOR_WHITE, "USE: (/f)amly [chat]");
return 1;
}
if (PlayerInfo[playerid][pMuted] == 1)
{
SendClientMessage(playerid, COLOR_GRAD1, "ERROR: You are unable to carry out is action.");
return 1;
}
if (PlayerInfo[playerid][pRadio] == 1)
{
SendClientMessage(playerid, COLOR_GRAD1, "ERROR: Your radio is broken, connection refused.");
return 1;
}
new plname[24], mylastname[24], family[24]; // Erroneous line !
GetPlayerName(playerid, plname, 24);
strmid(mylastname, plname, strfind(playername, "_") + 1, strlen(plname));
for (new p; p < MAX_PLAYERS; p++)
{
new Name[24];
GetPlayerName(p, Name, 24);
strmid(family, Name, strfind(Name, "_") + 1, strlen(Name));
if (!strcmp(mylastname, Name))
{
format(string, sizeof(string), "** Family %s: %s **", plname, result);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
}
GetPlayerName(playerid, sendername, sizeof(sendername));
if (PlayerInfo[playerid][pMascarause] == 1)
{
format(string, sizeof(string), "Strange (Rбdio): %s", result);
}
else
{
format(string, sizeof(string), "%s says (Rбdio): %s", sendername, result);
}
ProxDetector(10.0, playerid, string, COLOR_FADE1, COLOR_FADE2, COLOR_FADE3, COLOR_FADE4, COLOR_FADE5);
}
return 1;
}