new pName[MAX_PLAYER_NAME];
#1

How can i solve these warnings? i got 3 of them
pawn Код:
new pName[MAX_PLAYER_NAME];

warning 219: local variable "pName" shadows a variable at a preceding level
1 of 3 codes:
pawn Код:
CMD:get(playerid,params[])
{
    new id;
    new pName[MAX_PLAYER_NAME];
    new pName2[MAX_PLAYER_NAME];
    if ( GetPVarInt( playerid, "Level" ) == 0 )return SendClientMessage(playerid, 0xFF0000FF, "Only admin 1-3 can use this command!!");
    if(sscanf(params,"us[128]",id)) return SendClientMessage(playerid,COLOR_YELLOW,"Correct Usage:/get [ID]");
    if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid,COLOR_RED,"Player ID Doesn't Exist");
    {
            new Float:X, Float:Y, Float:Z;
            GetPlayerName(playerid,pName,sizeof(pName));
            GetPlayerName(id,pName2,sizeof(pName2));
            GetPlayerPos(playerid, X, Y, Z);
            SetPlayerPos(id, X, Y, Z);
    }
    return 1;
}
Reply
#2

pawn Код:
warning 219: local variable "pName" shadows a variable at a preceding level
This means you already defined a variable named ' pName '. Either delete the one you made and use the old one, or make a new variable named PlayerName or something.
Reply
#3

Quote:
Originally Posted by grand.Theft.Otto
Посмотреть сообщение
pawn Код:
warning 219: local variable "pName" shadows a variable at a preceding level
This means you already defined a variable named ' pName '. Either delete the one you made and use the old one, or make a new variable named PlayerName or something.
if i delee it, i get
pawn Код:
error 076: syntax error in the expression, or invalid function call
error 072: "sizeof" operator is invalid on "function" symbols
Reply
#4

PHP код:
CMD:get(playerid,params[]) {
    new
        
id,
        
plname[MAX_PLAYER_NAME],
        
idname[MAX_PLAYER_NAME];
    if ( 
GetPVarIntplayerid"Level" ) == )return SendClientMessage(playerid0xFF0000FF"Only admin 1-3 can use this command!!");
    if(
sscanf(params,"u",id)) return SendClientMessage(playerid,COLOR_YELLOW,"Correct Usage:/get [ID]");
    if(
id == INVALID_PLAYER_ID) return SendClientMessage(playerid,COLOR_RED,"Player ID Doesn't Exist");
    {
            new 
Float:XFloat:YFloat:Z;
            
//GetPlayerName(playerid,plname,sizeof(plname));
            //GetPlayerName(id,idname,sizeof(idname));
            
GetPlayerPos(playeridXYZ);
            
SetPlayerPos(idXYZ);
    } return 
1;

Reply
#5

Quote:
Originally Posted by Kush
Посмотреть сообщение
PHP код:
CMD:get(playerid,params[]) {
    new
        
id,
        
plname[MAX_PLAYER_NAME],
        
idname[MAX_PLAYER_NAME];
    if ( 
GetPVarIntplayerid"Level" ) == )return SendClientMessage(playerid0xFF0000FF"Only admin 1-3 can use this command!!");
    if(
sscanf(params,"u",id)) return SendClientMessage(playerid,COLOR_YELLOW,"Correct Usage:/get [ID]");
    if(
id == INVALID_PLAYER_ID) return SendClientMessage(playerid,COLOR_RED,"Player ID Doesn't Exist");
    {
            new 
Float:XFloat:YFloat:Z;
            
//GetPlayerName(playerid,plname,sizeof(plname));
            //GetPlayerName(id,idname,sizeof(idname));
            
GetPlayerPos(playeridXYZ);
            
SetPlayerPos(idXYZ);
    } return 
1;

Thanks, but it just gives me warnings to.
pawn Код:
warning 204: symbol is assigned a value that is never used: "idname"
 warning 204: symbol is assigned a value that is never used: "plname"
Reply
#6

PHP код:
CMD:get(playerid,params[]) { 
    new 
        
id
        
//plname[MAX_PLAYER_NAME], 
        //idname[MAX_PLAYER_NAME]; 
    
if ( GetPVarIntplayerid"Level" ) == )return SendClientMessage(playerid0xFF0000FF"Only admin 1-3 can use this command!!"); 
    if(
sscanf(params,"u",id)) return SendClientMessage(playerid,COLOR_YELLOW,"Correct Usage:/get [ID]"); 
    if(
id == INVALID_PLAYER_ID) return SendClientMessage(playerid,COLOR_RED,"Player ID Doesn't Exist"); 
    { 
            new 
Float:XFloat:YFloat:Z
            
//GetPlayerName(playerid,plname,sizeof(plname)); 
            //GetPlayerName(id,idname,sizeof(idname)); 
            
GetPlayerPos(playeridXYZ); 
            
SetPlayerPos(idXYZ); 
    } return 
1

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)