Help for warning
#1

hi gays!
i want to make a countdown timer for capturing family wars
it works but give me this warning
Код:
D:\Game Mods\GalaXy Gaming\gamemodes\GG.pwn(51597) : warning 219: local variable "playerb" shadows a variable at a preceding level
D:\Game Mods\GalaXy Gaming\gamemodes\GG.pwn(51596) : warning 204: symbol is assigned a value that is never used: "playerb"
line 51597:
Код:
	foreach(Player, playerb)
line 51596:
Код:
new playerb = PlayerInfo[playerid][pFam];
full code:
Код:
forward WarAlireza(playerid,idx);
public WarAlireza(playerid, idx)
{
new string[128];
new playerb = PlayerInfo[playerid][pFam];
	foreach(Player, playerb)
	{
	 if(WarAlirezA ==1)
	 {
	 WarTimer[playerid] ++;
 	 format(string,sizeof(string),"~n~~n~~n~~n~~n~~n~~n~~n~~r~Point Time Left: ~w~%d ~r~seconds", WarTimer[playerid]);
     GameTextForPlayer(playerid, string,1000, 3);
	 }
   }
   return 1;
}
and the timer just shows to player who is capturing but i want to show to all players that are in a family
Plz help for +rep Tnx
Reply
#2

Quote:
Originally Posted by Airblog
Посмотреть сообщение
hi gays!
i want to make a countdown timer for capturing family wars
it works but give me this warning
Код:
D:\Game Mods\GalaXy Gaming\gamemodes\GG.pwn(51597) : warning 219: local variable "playerb" shadows a variable at a preceding level
D:\Game Mods\GalaXy Gaming\gamemodes\GG.pwn(51596) : warning 204: symbol is assigned a value that is never used: "playerb"
line 51597:
Код:
	foreach(Player, playerb)
line 51596:
Код:
new playerb = PlayerInfo[playerid][pFam];
full code:
Код:
forward WarAlireza(playerid,idx);
public WarAlireza(playerid, idx)
{
new string[128];
new playerb = PlayerInfo[playerid][pFam];
	foreach(Player, playerb)
	{
	 if(WarAlirezA ==1)
	 {
	 WarTimer[playerid] ++;
 	 format(string,sizeof(string),"~n~~n~~n~~n~~n~~n~~n~~n~~r~Point Time Left: ~w~%d ~r~seconds", WarTimer[playerid]);
     GameTextForPlayer(playerid, string,1000, 3);
	 }
   }
   return 1;
}
and the timer just shows to player who is capturing but i want to show to all players that are in a family
Plz help for +rep Tnx
full code:
Код:
forward WarAlireza(playerid,idx);
public WarAlireza(playerid, idx)
{
new string[128];
new playerb = PlayerInfo[playerid][pFam];
	foreach(Player, playerb)
	{
	 if(Playerinfo[playerid][pFam] = WarAlireza)
	 {
	 WarTimer[playerid] ++;
 	 format(string,sizeof(string),"~n~~n~~n~~n~~n~~n~~n~~n~~r~Point Time Left: ~w~%d ~r~seconds", WarTimer[playerid]);
     GameTextForPlayer(playerid, string,1000, 3);
	 }
   }
   return 1;
}
Reply
#3

wtf is this?
Reply
#4

you maked playerb variable twice in 1 function
change name one of them.
for example
pawn Код:
//change it
new playerb = PlayerInfo[playerid][pFam];
//to:
new player2 = PlayerInfo[playerid][pFam];

and you maked a loop between players but you didn't use it !!

pawn Код:
foreach(Player, playerb)
    {
     if(WarAlirezA ==1)
     {
     WarTimer[playerid] ++;
     format(string,sizeof(string),"~n~~n~~n~~n~~n~~n~~n~~n~~r~Point Time Left: ~w~%d ~r~seconds", WarTimer[playerid]);
     GameTextForPlayer(playerid, string,1000, 3);
     }
   }
where used "playerb" ?!
Reply
#5

Do you want an FS for your family wars?
Reply
#6

Quote:
Originally Posted by M4D
Посмотреть сообщение
you maked playerb variable twice in 1 function
change name one of them.
for example
pawn Код:
//change it
new playerb = PlayerInfo[playerid][pFam];
//to:
new player2 = PlayerInfo[playerid][pFam];

and you maked a loop between players but you didn't use it !!

pawn Код:
foreach(Player, playerb)
    {
     if(WarAlirezA ==1)
     {
     WarTimer[playerid] ++;
     format(string,sizeof(string),"~n~~n~~n~~n~~n~~n~~n~~n~~r~Point Time Left: ~w~%d ~r~seconds", WarTimer[playerid]);
     GameTextForPlayer(playerid, string,1000, 3);
     }
   }
where used "playerb" ?!
you mean
Код:
	
new playerb2 = PlayerInfo[playerid][pFam];
foreach(Player, playerb2)
	{
	 if(WarAlirezA ==1)
	 {
	 WarTimer[playerb2] ++;
 	 format(string,sizeof(string),"~n~~n~~n~~n~~n~~n~~n~~n~~r~Point Time Left: ~w~%d ~r~seconds", WarTimer[playerb2]);
     GameTextForPlayer(playerb2, string,1000, 3);
	 }
   }
?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)