Warning 219...at a preceding level
#1

Код:
warning 219: local variable "pName" shadows a variable at a preceding level
pawn Код:
CMD:pm(playerid, params[])
{
    new pID, Msg[128];
    if(sscanf(params, "ds[128]", pID, Msg)) return SendClientMessage(playerid, -1, "USAGE: /pm [PlayerID] [Message]");
    if(pID == playerid) return SendClientMessage(playerid, 0xFF0000FF, "You can't PM to yourself!");
    if(!IsPlayerConnected(pID)) return SendClientMessage(playerid, 0xFF0000FF, "Invalid PlayerID or the PlayerID is not online!");
    if(DisablePM[pID] == 1) return GameTextForPlayer(playerid, "~n~~n~~r~Player Disabled PM", 3000, 5);
    new str[256], pName[MAX_PLAYER_NAME], pName2[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName, sizeof(pName));
    GetPlayerName(pID, pName2, sizeof(pName2));
    format(str, sizeof(str), "PM Sent to %s (ID: %d): %s", pName2, pID, Msg);
    SendClientMessage(playerid, -1, str);
    format(str, sizeof(str), "PM from %s (ID: %d): %s", pName, playerid, Msg);
    SendClientMessage(pID, -1, str);
    return 1;
}
Reply
#2

Try this:

Код:
CMD:pm(playerid, params[])
{
    new pID, Msg[128];
    if(sscanf(params, "ds[128]", pID, Msg)) return SendClientMessage(playerid, -1, "USAGE: /pm [PlayerID] [Message]");
    if(pID == playerid) return SendClientMessage(playerid, 0xFF0000FF, "You can't PM to yourself!");
    if(!IsPlayerConnected(pID)) return SendClientMessage(playerid, 0xFF0000FF, "Invalid PlayerID or the PlayerID is not online!");
    if(DisablePM[pID] == 1) return GameTextForPlayer(playerid, "~n~~n~~r~Player Disabled PM", 3000, 5);
    new str[256], pNamee[MAX_PLAYER_NAME], pName2[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pNamee, sizeof(pNamee));
    GetPlayerName(pID, pName2, sizeof(pName2));
    format(str, sizeof(str), "PM Sent to %s (ID: %d): %s", pName2, pID, Msg);
    SendClientMessage(playerid, -1, str);
    format(str, sizeof(str), "PM from %s (ID: %d): %s", pNamee, playerid, Msg);
    SendClientMessage(pID, -1, str);
    return 1;
}
Reply
#3

Quote:
Originally Posted by Marlon_Lorran
Посмотреть сообщение
Try this:

Код:
CMD:pm(playerid, params[])
{
    new pID, Msg[128];
    if(sscanf(params, "ds[128]", pID, Msg)) return SendClientMessage(playerid, -1, "USAGE: /pm [PlayerID] [Message]");
    if(pID == playerid) return SendClientMessage(playerid, 0xFF0000FF, "You can't PM to yourself!");
    if(!IsPlayerConnected(pID)) return SendClientMessage(playerid, 0xFF0000FF, "Invalid PlayerID or the PlayerID is not online!");
    if(DisablePM[pID] == 1) return GameTextForPlayer(playerid, "~n~~n~~r~Player Disabled PM", 3000, 5);
    new str[256], pNamee[MAX_PLAYER_NAME], pName2[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pNamee, sizeof(pNamee));
    GetPlayerName(pID, pName2, sizeof(pName2));
    format(str, sizeof(str), "PM Sent to %s (ID: %d): %s", pName2, pID, Msg);
    SendClientMessage(playerid, -1, str);
    format(str, sizeof(str), "PM from %s (ID: %d): %s", pNamee, playerid, Msg);
    SendClientMessage(pID, -1, str);
    return 1;
}
No more warnings, but /stats command not showing up when I do /stats nothing happens...
Reply
#4

Put the /stats Code here please!!
Reply
#5

Quote:
Originally Posted by Marlon_Lorran
Посмотреть сообщение
Put the /stats Code here please!!
I'am using Luxadmin

pawn Код:
dcmd_stats(playerid,params[])
{
    new str[512], pDeaths, player1, h, m, s;
    new status1[2][10] = {"Enabled", "Disabled"};
    new status2[2][10] = {"Disabled", "Enabled"};
    new InInterior;
    if(!strlen(params)) player1 = playerid;
    else player1 = strval(params);
    if(!IsPlayerConnected(player1)) return SendClientMessage(playerid, red, "ERROR: Player Not Connected!");
    TotalGameTime(player1, h, m, s);
    if(AccInfo[player1][Deaths] == 0) pDeaths = 1;
    else pDeaths = AccInfo[player1][Deaths];
    if(GetPlayerInterior(player1) != 0) InInterior = 1;
    format(str, sizeof(str), "{DAA520}%s (ID: %d){B0C4DE}\n\n", PlayerName2(player1), player1);
    format(str, sizeof(str), "%sSkinID: %d\n", str, GetPlayerSkin(player1));
    format(str, sizeof(str), "%sScore: %d\n", str, GetPlayerScore(player1));
    format(str, sizeof(str), "%sKills: %d\n", str, AccInfo[player1][Kills]);
    format(str, sizeof(str), "%sDeaths: %d\n", str, AccInfo[player1][Deaths]);
    format(str, sizeof(str), "%sRatio: %d\n", str, Float:AccInfo[player1][Kills]/Float:pDeaths);
    format(str, sizeof(str), "%sPM: %s\n", str, status1[DisablePM[player1]]);
    format(str, sizeof(str), "%sGod: %s\n", str, status2[GodMode[player1]]);
    format(str, sizeof(str), "%sGo's: %s\n", str, status1[GotoDisabled[player1]]);
    format(str, sizeof(str), "%sInterior: %d\n", str, InInterior);
    format(str, sizeof(str), "%sMoney: $%d\n", str, GetPlayerMoney(player1));
    format(str, sizeof(str), "%sPing: %d\n", str, GetPlayerPing(player1));
    format(str, sizeof(str), "%sTime Login: %d hours %d minutes %d seconds\n", str, h, m, s);
    ShowPlayerDialog(playerid, 8435, DIALOG_STYLE_MSGBOX, "Player Statistics", str, "Close", "");
    return 1;
}
Reply
#6

Quote:
Originally Posted by kbalor
Посмотреть сообщение
I'am using Luxadmin

pawn Код:
dcmd_stats(playerid,params[])
{
    new str[512], pDeaths, player1, h, m, s;
    new status1[2][10] = {"Enabled", "Disabled"};
    new status2[2][10] = {"Disabled", "Enabled"};
    new InInterior;
    if(!strlen(params)) player1 = playerid;
    else player1 = strval(params);
    if(!IsPlayerConnected(player1)) return SendClientMessage(playerid, red, "ERROR: Player Not Connected!");
    TotalGameTime(player1, h, m, s);
    if(AccInfo[player1][Deaths] == 0) pDeaths = 1;
    else pDeaths = AccInfo[player1][Deaths];
    if(GetPlayerInterior(player1) != 0) InInterior = 1;
    format(str, sizeof(str), "{DAA520}%s (ID: %d){B0C4DE}\n\n", PlayerName2(player1), player1);
    format(str, sizeof(str), "%sSkinID: %d\n", str, GetPlayerSkin(player1));
    format(str, sizeof(str), "%sScore: %d\n", str, GetPlayerScore(player1));
    format(str, sizeof(str), "%sKills: %d\n", str, AccInfo[player1][Kills]);
    format(str, sizeof(str), "%sDeaths: %d\n", str, AccInfo[player1][Deaths]);
    format(str, sizeof(str), "%sRatio: %d\n", str, Float:AccInfo[player1][Kills]/Float:pDeaths);
    format(str, sizeof(str), "%sPM: %s\n", str, status1[DisablePM[player1]]);
    format(str, sizeof(str), "%sGod: %s\n", str, status2[GodMode[player1]]);
    format(str, sizeof(str), "%sGo's: %s\n", str, status1[GotoDisabled[player1]]);
    format(str, sizeof(str), "%sInterior: %d\n", str, InInterior);
    format(str, sizeof(str), "%sMoney: $%d\n", str, GetPlayerMoney(player1));
    format(str, sizeof(str), "%sPing: %d\n", str, GetPlayerPing(player1));
    format(str, sizeof(str), "%sTime Login: %d hours %d minutes %d seconds\n", str, h, m, s);
    ShowPlayerDialog(playerid, 8435, DIALOG_STYLE_MSGBOX, "Player Statistics", str, "Close", "");
    return 1;
}
This code use params? yes or no?

if this code no use params try:

Код:
dcmd_stats(playerid,params[])
{
   new str[512], pDeaths, h, m, s;
   new status1[2][10] = {"Enabled", "Disabled"};
   new status2[2][10] = {"Disabled", "Enabled"};
   new InInterior;
   if(!IsPlayerConnected(player)) return SendClientMessage(playerid, red, "ERROR: You're connected!");
   TotalGameTime(playerid, h, m, s);
   if(AccInfo[playerid][Deaths] == 0) pDeaths = 1;
   else pDeaths = AccInfo[playerid][Deaths];
   if(GetPlayerInterior(playerid) != 0) InInterior = 1;
   format(str, sizeof(str), "{DAA520}%s (ID: %d){B0C4DE}\n\n", PlayerName2(playerid), playerid);
   format(str, sizeof(str), "%sSkinID: %d\n", str, GetPlayerSkin(playerid));
   format(str, sizeof(str), "%sScore: %d\n", str, GetPlayerScore(playerid));
   format(str, sizeof(str), "%sKills: %d\n", str, AccInfo[playerid][Kills]);
   format(str, sizeof(str), "%sDeaths: %d\n", str, AccInfo[playerid][Deaths]);
   format(str, sizeof(str), "%sRatio: %d\n", str, Float:AccInfo[playerid][Kills]/Float:pDeaths);
   format(str, sizeof(str), "%sPM: %s\n", str, status1[DisablePM[playerid]]);
   format(str, sizeof(str), "%sGod: %s\n", str, status2[GodMode[playerid]]);
   format(str, sizeof(str), "%sGo's: %s\n", str, status1[GotoDisabled[playerid]]);
   format(str, sizeof(str), "%sInterior: %d\n", str, InInterior);
   format(str, sizeof(str), "%sMoney: $%d\n", str, GetPlayerMoney(playerid));
   format(str, sizeof(str), "%sPing: %d\n", str, GetPlayerPing(playerid));
   format(str, sizeof(str), "%sTime Login: %d hours %d minutes %d seconds\n", str, h, m, s);
   ShowPlayerDialog(playerid, 8435, DIALOG_STYLE_MSGBOX, "Player Statistics", str, "Close", "");
   return 1;
}
Reply
#7

That warning means you have created 2 time the same variable!
Reply
#8

Quote:
Originally Posted by Marlon_Lorran
Посмотреть сообщение
This code use params? yes or no?

if this code no use params try:

Код:
dcmd_stats(playerid,params[])
{
   new str[512], pDeaths, h, m, s;
   new status1[2][10] = {"Enabled", "Disabled"};
   new status2[2][10] = {"Disabled", "Enabled"};
   new InInterior;
   if(!IsPlayerConnected(player)) return SendClientMessage(playerid, red, "ERROR: You're connected!");
   TotalGameTime(playerid, h, m, s);
   if(AccInfo[playerid][Deaths] == 0) pDeaths = 1;
   else pDeaths = AccInfo[playerid][Deaths];
   if(GetPlayerInterior(playerid) != 0) InInterior = 1;
   format(str, sizeof(str), "{DAA520}%s (ID: %d){B0C4DE}\n\n", PlayerName2(playerid), playerid);
   format(str, sizeof(str), "%sSkinID: %d\n", str, GetPlayerSkin(playerid));
   format(str, sizeof(str), "%sScore: %d\n", str, GetPlayerScore(playerid));
   format(str, sizeof(str), "%sKills: %d\n", str, AccInfo[playerid][Kills]);
   format(str, sizeof(str), "%sDeaths: %d\n", str, AccInfo[playerid][Deaths]);
   format(str, sizeof(str), "%sRatio: %d\n", str, Float:AccInfo[playerid][Kills]/Float:pDeaths);
   format(str, sizeof(str), "%sPM: %s\n", str, status1[DisablePM[playerid]]);
   format(str, sizeof(str), "%sGod: %s\n", str, status2[GodMode[playerid]]);
   format(str, sizeof(str), "%sGo's: %s\n", str, status1[GotoDisabled[playerid]]);
   format(str, sizeof(str), "%sInterior: %d\n", str, InInterior);
   format(str, sizeof(str), "%sMoney: $%d\n", str, GetPlayerMoney(playerid));
   format(str, sizeof(str), "%sPing: %d\n", str, GetPlayerPing(playerid));
   format(str, sizeof(str), "%sTime Login: %d hours %d minutes %d seconds\n", str, h, m, s);
   ShowPlayerDialog(playerid, 8435, DIALOG_STYLE_MSGBOX, "Player Statistics", str, "Close", "");
   return 1;
}
error 017: undefined symbol "player"
warning 203: symbol is never used: "params"
Reply
#9

Try:

Код:
dcmd_stats(playerid,params[])
{
	#pragma unused params
   	new str[512], pDeaths, h, m, s;
   	new status1[2][10] = {"Enabled", "Disabled"};
   	new status2[2][10] = {"Disabled", "Enabled"};
   	new InInterior;
   	if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, red, "ERROR: You're connected!");
   	TotalGameTime(playerid, h, m, s);
   	if(AccInfo[playerid][Deaths] == 0) pDeaths = 1;
   	else pDeaths = AccInfo[playerid][Deaths];
   	if(GetPlayerInterior(playerid) != 0) InInterior = 1;
   	format(str, sizeof(str), "{DAA520}%s (ID: %d){B0C4DE}\n\n", PlayerName2(playerid), playerid);
   	format(str, sizeof(str), "%sSkinID: %d\n", str, GetPlayerSkin(playerid));
   	format(str, sizeof(str), "%sScore: %d\n", str, GetPlayerScore(playerid));
   	format(str, sizeof(str), "%sKills: %d\n", str, AccInfo[playerid][Kills]);
   	format(str, sizeof(str), "%sDeaths: %d\n", str, AccInfo[playerid][Deaths]);
   	format(str, sizeof(str), "%sRatio: %d\n", str, Float:AccInfo[playerid][Kills]/Float:pDeaths);
   	format(str, sizeof(str), "%sPM: %s\n", str, status1[DisablePM[playerid]]);
   	format(str, sizeof(str), "%sGod: %s\n", str, status2[GodMode[playerid]]);
 	format(str, sizeof(str), "%sGo's: %s\n", str, status1[GotoDisabled[playerid]]);
   	format(str, sizeof(str), "%sInterior: %d\n", str, InInterior);
   	format(str, sizeof(str), "%sMoney: $%d\n", str, GetPlayerMoney(playerid));
   	format(str, sizeof(str), "%sPing: %d\n", str, GetPlayerPing(playerid));
   	format(str, sizeof(str), "%sTime Login: %d hours %d minutes %d seconds\n", str, h, m, s);
   	ShowPlayerDialog(playerid, 8435, DIALOG_STYLE_MSGBOX, "Player Statistics", str, "Close", "");
   	return 1;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)