onPlayerConnect help
#1

PHP код:
//Text Administrator
    
if(PlayerInfo[playerid][Level] >= 1) {
    new 
messtring[128], pName[24];
    
format(messtringsizeof(messtring), "~w~]Administrator] ~b~ %s(%d) ~w~has ~r~Joined ~w~Server",pNameplayerid);
    return 
GameTextForAll(messtring5000);
    }
//Text Co-OWNER
    
if(PlayerInfo[playerid][Level] >= 5) {
    new 
messtring[128], pName[24];
    
format(messtringsizeof(messtring), "~w~]Server CO-OWNER] ~b~ %s(%d) ~w~has ~r~Joined ~w~Server",pNameplayerid);
    return 
GameTextForAll(messtring5000);
    }
//Text OWNER
    
if(PlayerInfo[playerid][Level] >= 6) {
    new 
messtring[128], pName[24];
    
format(messtringsizeof(messtring), "~w~]Server OWNER] ~b~ %s(%d) ~w~has ~r~Joined ~w~Server",pNameplayerid);
    return 
GameTextForAll(messtring5000);
    } 

Error
Код HTML:
C:\Users\win7\Desktop\SATDM_v9.pwn(12109) : warning 219: local variable "pName" shadows a variable at a preceding level
C:\Users\win7\Desktop\SATDM_v9.pwn(12115) : warning 219: local variable "pName" shadows a variable at a preceding level
C:\Users\win7\Desktop\SATDM_v9.pwn(12121) : warning 219: local variable "pName" shadows a variable at a preceding level
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Warnings.
Reply
#2

It means you have created a variable called 'pName' somewhere in your script. Instead of having to remove the global variable that you created, you can always just change all the 'pName's in that code to something else, like 'playername' for example.

It depends whether you want to take the easier or the harder route. Although I would recommend you sort out whether you need local or global variables first...
Reply
#3

Can u tell me what to do actually yes i using pname in my script at different place but what to do here?
Reply
#4

Anyone??
Reply
#5

Use This

PHP код:
new messtring[128], PlayerName[56];
GetPlayerName(playerid,PlayerName,sizeof(PlayerName)); 
PHP код:
if(PlayerInfo[playerid][Level] >= 1

    
format(messtringsizeof(messtring), "~w~]Administrator] ~b~ %s(%d) ~w~has ~r~Joined ~w~Server",PlayerNameplayerid); 
    return 
GameTextForAll(messtring5000); 

Co - Owner
PHP код:
if(PlayerInfo[playerid][Level] >= 5

    
format(messtringsizeof(messtring), "~w~]Server CO-OWNER] ~b~ %s(%d) ~w~has ~r~Joined ~w~Server",PlayerNameplayerid); 
    return 
GameTextForAll(messtring5000); 

Owner
PHP код:
if(PlayerInfo[playerid][Level] >= 6

    
format(messtringsizeof(messtring), "~w~]Server OWNER] ~b~ %s(%d) ~w~has ~r~Joined ~w~Server",PlayerNameplayerid); 
    return 
GameTextForAll(messtring5000); 

Reply
#6

The first code i have to post their under on pla
Yer connect or in# define?
Reply
#7

Replace that piece of code with this,

pawn Код:
if(PlayerInfo[playerid][Level] >= 1)
{
    new messtring[128], pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    format(messtring, sizeof(messtring), "~w~]Administrator] ~b~ %s(%d) ~w~has ~r~Joined ~w~Server",pName, playerid);
    return GameTextForAll(messtring, 5000, 3 );
}

if(PlayerInfo[playerid][Level] >= 5)
{
    new messtring[128], pName1[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pName1,MAX_PLAYER_NAME);
    format(messtring, sizeof(messtring), "~w~]Server CO-OWNER] ~b~ %s(%d) ~w~has ~r~Joined ~w~Server", pName1, playerid);
    return GameTextForAll(messtring, 5000, 3 );
}
if(PlayerInfo[playerid][Level] >= 6)
{
    new messtring[128], pName2[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pName2,MAX_PLAYER_NAME)
    format(messtring, sizeof(messtring), "~w~]Server OWNER] ~b~ %s(%d) ~w~has ~r~Joined ~w~Server",pName2, playerid);
    return GameTextForAll(messtring, 5000, 3 );
}
Reply
#8

Just change it:
Код:
//Text Administrator 
    if(PlayerInfo[playerid][Level] >= 1) { 
    new messtring[128], pName[24]; 
    format(messtring, sizeof(messtring), "~w~]Administrator] ~b~ %s(%d) ~w~has ~r~Joined ~w~Server",pName, playerid); 
    return GameTextForAll(messtring, 5000, 3 ); 
    } 
//Text Co-OWNER 
    if(PlayerInfo[playerid][Level] >= 5) { 
    new messtring[128], pName[24]; 
    format(messtring, sizeof(messtring), "~w~]Server CO-OWNER] ~b~ %s(%d) ~w~has ~r~Joined ~w~Server",pName, playerid); 
    return GameTextForAll(messtring, 5000, 3 ); 
    } 
//Text OWNER 
    if(PlayerInfo[playerid][Level] >= 6) { 
    new messtring[128], pName[24]; 
    format(messtring, sizeof(messtring), "~w~]Server OWNER] ~b~ %s(%d) ~w~has ~r~Joined ~w~Server",pName, playerid); 
    return GameTextForAll(messtring, 5000, 3 ); 
    }
To:
Код:
//Text Administrator
    new messtring[128], pName[24];
    if(PlayerInfo[playerid][Level] >= 1) {
    format(messtring, sizeof(messtring), "~w~]Administrator] ~b~ %s(%d) ~w~has ~r~Joined ~w~Server",pName, playerid);
    return GameTextForAll(messtring, 5000, 3 );
    }
//Text Co-OWNER
    if(PlayerInfo[playerid][Level] >= 5) {
    format(messtring, sizeof(messtring), "~w~]Server CO-OWNER] ~b~ %s(%d) ~w~has ~r~Joined ~w~Server",pName, playerid);
    return GameTextForAll(messtring, 5000, 3 );
    }
//Text OWNER
    if(PlayerInfo[playerid][Level] >= 6) {
    format(messtring, sizeof(messtring), "~w~]Server OWNER] ~b~ %s(%d) ~w~has ~r~Joined ~w~Server",pName, playerid);
    return GameTextForAll(messtring, 5000, 3 );
    }
Just like danish007 said.
Reply
#9

to thiss

under onplayerconnect
Quote:

//Text Administrator
new messtring[128], PlayerName[24];
if(PlayerInfo[playerid][Level] >= 1) {
format(messtring, sizeof(messtring), "~w~]Administrator] ~b~ %s(%d) ~w~has ~r~Joined ~w~Server",PlayerName, playerid);
return GameTextForAll(messtring, 5000, 3 );
}
//Text Co-OWNER
if(PlayerInfo[playerid][Level] >= 5) {
format(messtring, sizeof(messtring), "~w~]Server CO-OWNER] ~b~ %s(%d) ~w~has ~r~Joined ~w~Server",PlayerName, playerid);
return GameTextForAll(messtring, 5000, 3 );
}
//Text OWNER
if(PlayerInfo[playerid][Level] >= 6) {
format(messtring, sizeof(messtring), "~w~]Server OWNER] ~b~ %s(%d) ~w~has ~r~Joined ~w~Server",PlayerName, playerid);
return GameTextForAll(messtring, 5000, 3 );
}

Reply
#10

C:\Users\win7\Desktop\SATDM_v9.pwn(12105) : error 021: symbol already defined: "PlayerName"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)