3 Warnings
#1

Ok i keep getting these 3 warnings and still i tried everything to fix them and doesn't work

The first 2 Warnings
Код:
C:\Users\user\Desktop\*\GLRP.pwn(65281) : warning 219: local variable "i" shadows a variable at a preceding level
C:\Users\user\Desktop\*\GLRP.pwn(65297) : warning 217: loose indentation
The Code:
Код:
 CMD:destroyboombox(playerid, params[])
{
	if(GetPVarType(playerid, "pBoomBox"))
	{
	    DestroyDynamicObject(GetPVarInt(playerid, "pBoomBox"));
	    DestroyDynamic3DTextLabel(Text3D:GetPVarInt(playerid, "pBoomBoxLabel"));
	    DeletePVar(playerid, "pBoomBox"); DeletePVar(playerid, "pBoomBoxStation"); DeletePVar(playerid, "pBoomBoxLabel");
	    DeletePVar(playerid, "pBoomBoxX"); DeletePVar(playerid, "pBoomBoxY"); DeletePVar(playerid, "pBoomBoxZ");
	    if(GetPVarType(playerid, "pBoomBoxArea"))
	    {
         	new string[128];
			format(string, sizeof(string), "* %s has destroyed the boombox.", GetPlayerNameEx(playerid));
	        foreach(Player, i)
	        {
	            if(IsPlayerInDynamicArea(i, GetPVarInt(playerid, "pBoomBoxArea")))
	            {
	                StopAudioStreamForPlayer(playerid);
	                SendClientMessage(i, COLOR_PURPLE, string);
				}
			}
	        DeletePVar(playerid, "pBoomBoxArea");
		}
		SendClientMessage(playerid, COLOR_WHITE, "You've destroyed your boombox!");
	}
	else
	{
     foreach(Player, i) // This is line 65281
	    {
	        if(GetPVarType(i, "pBoomBox"))
	        {
				if(GetPVarInt(i, "pBoomBoxVW") == GetPlayerVirtualWorld(playerid) && GetPVarInt(i, "pBoomBoxInt") == GetPlayerInterior(playerid) && IsPlayerInRangeOfPoint(playerid, 5.0, GetPVarFloat(i, "pBoomBoxX"), GetPVarFloat(i, "pBoomBoxY"), GetPVarFloat(i, "pBoomBoxZ")))
				{
				    DestroyDynamicObject(GetPVarInt(i, "pBoomBox"));
				    DestroyDynamic3DTextLabel(Text3D:GetPVarInt(i, "pBoomBoxLabel"));

				    DeletePVar(i, "pBoomBox");
					DeletePVar(i, "pBoomBoxStation");
					DeletePVar(i, "pBoomBoxLabel");
				    DeletePVar(i, "pBoomBoxX");
					DeletePVar(i, "pBoomBoxY");
					DeletePVar(i, "pBoomBoxZ");
					DeletePVar(i, "pBoomBoxInt");
					DeletePVar(i, "pBoomBoxVW");

        			new string[128];
				    if(GetPVarType(i, "pBoomBoxArea"))
				    {
				        format(string, sizeof(string), "* %s has destroyed the boombox.", GetPlayerNameEx(playerid));
				        for(new i = 0; i < MAX_PLAYERS; i++)
				        {
				            if(IsPlayerInDynamicArea(playerid, GetPVarInt(i, "pBoomBoxArea")))
				            {
				                StopAudioStreamForPlayer(playerid);
				                SendClientMessage(playerid, COLOR_PURPLE, string);
							}
						}
				        DeletePVar(i, "pBoomBoxArea");
					}
				    format(string, sizeof(string), "%s has destroyed your boombox!", GetPlayerNameEx(playerid));
				    SendClientMessage(i, COLOR_WHITE, string);
					return 1;
				}
			}
	    }
    	SendClientMessage(playerid, COLOR_WHITE, "You don't have a boombox or you are not near one to destroy."); // this is line 65297
  	}
  	return 1;
}
the 3rd Warning:
Код:
C:\Users\user\Desktop\*\GLRP.pwn(96019) : warning 203: symbol is never used: "tracecall"
i wish i can supply you with the code,but the Script ends at 96018 There's no such Line!
Reply
#2

Remove tracecall define for 3rd warning and show line 65297.
Reply
#3

Код:
 CMD:destroyboombox(playerid, params[])
{
	if(GetPVarType(playerid, "pBoomBox"))
	{
	    DestroyDynamicObject(GetPVarInt(playerid, "pBoomBox"));
	    DestroyDynamic3DTextLabel(Text3D:GetPVarInt(playerid, "pBoomBoxLabel"));
	    DeletePVar(playerid, "pBoomBox"); DeletePVar(playerid, "pBoomBoxStation"); DeletePVar(playerid, "pBoomBoxLabel");
	    DeletePVar(playerid, "pBoomBoxX"); DeletePVar(playerid, "pBoomBoxY"); DeletePVar(playerid, "pBoomBoxZ");
	    if(GetPVarType(playerid, "pBoomBoxArea"))
	    {
         	new string[128];
			format(string, sizeof(string), "* %s has destroyed the boombox.", GetPlayerNameEx(playerid));
	        foreach(Player, i)
	        {
	            if(IsPlayerInDynamicArea(i, GetPVarInt(playerid, "pBoomBoxArea")))
	            {
	                StopAudioStreamForPlayer(playerid);
	                SendClientMessage(i, COLOR_PURPLE, string);
				}
			}
	        DeletePVar(playerid, "pBoomBoxArea");
		}
		SendClientMessage(playerid, COLOR_WHITE, "You've destroyed your boombox!");
	}
	else
	{
     foreach(Player, a) // This is line 65281
	    {
	        if(GetPVarType(a, "pBoomBox"))
	        {
				if(GetPVarInt(a, "pBoomBoxVW") == GetPlayerVirtualWorld(playerid) && GetPVarInt(a, "pBoomBoxInt") == GetPlayerInterior(playerid) && IsPlayerInRangeOfPoint(playerid, 5.0, GetPVarFloat(i, "pBoomBoxX"), GetPVarFloat(i, "pBoomBoxY"), GetPVarFloat(i, "pBoomBoxZ")))
				{
				    DestroyDynamicObject(GetPVarInt(i, "pBoomBox"));
				    DestroyDynamic3DTextLabel(Text3D:GetPVarInt(i, "pBoomBoxLabel"));

				    DeletePVar(a, "pBoomBox");
					DeletePVar(a, "pBoomBoxStation");
					DeletePVar(a, "pBoomBoxLabel");
				    DeletePVar(a, "pBoomBoxX");
					DeletePVar(a, "pBoomBoxY");
					DeletePVar(a, "pBoomBoxZ");
					DeletePVar(a, "pBoomBoxInt");
					DeletePVar(a, "pBoomBoxVW");

        			new string[128];
				    if(GetPVarType(a, "pBoomBoxArea"))
				    {
				        format(string, sizeof(string), "* %s has destroyed the boombox.", GetPlayerNameEx(playerid));
				        for(new d = 0; d < MAX_PLAYERS; d++)
				        {
				            if(IsPlayerInDynamicArea(playerid, GetPVarInt(d, "pBoomBoxArea")))
				            {
				                StopAudioStreamForPlayer(playerid);
				                SendClientMessage(playerid, COLOR_PURPLE, string);
							}
						}
				        DeletePVar(d, "pBoomBoxArea");
					}
				    format(string, sizeof(string), "%s has destroyed your boombox!", GetPlayerNameEx(playerid));
				    SendClientMessage(a, COLOR_WHITE, string);
					return 1;
				}
			}
	    }
    	SendClientMessage(playerid, COLOR_WHITE, "You don't have a boombox or you are not near one to destroy."); // this is line 65297
  	}
  	return 1;
}
#pragma unused tracecall
Reply
#4

Quote:
Originally Posted by SimpalK
Посмотреть сообщение
Remove tracecall define for 3rd warning and show line 65297.
the problem is: there is no define the tracecall is a cmd

and in the code i sepecified which line is 65297,

Thanks for reply
Reply
#5

warning 217: loose indentation warnings can be ignored. As for the line where it includes foreach(Player, i) as the i variable to store the information is already taken. Use another, use x or d or anything in replacement of i.

Be sure to replace all i within that loop with the new definition you have specified.
Reply
#6

About the warning 217: loose indentation i fixed 400 before this one,but i can't find any mistake,the first 2 warnings got fixed,but the Tracecall it gave me 4 extra errors when i use #pragma
Reply
#7

use this :-
pawn Код:
CMD:destroyboombox(playerid, params[])
{
    if(GetPVarType(playerid, "pBoomBox"))
    {
        DestroyDynamicObject(GetPVarInt(playerid, "pBoomBox"));
        DestroyDynamic3DTextLabel(Text3D:GetPVarInt(playerid, "pBoomBoxLabel"));
        DeletePVar(playerid, "pBoomBox"); DeletePVar(playerid, "pBoomBoxStation"); DeletePVar(playerid, "pBoomBoxLabel");
        DeletePVar(playerid, "pBoomBoxX"); DeletePVar(playerid, "pBoomBoxY"); DeletePVar(playerid, "pBoomBoxZ");
        if(GetPVarType(playerid, "pBoomBoxArea"))
        {
            new string[128];
            format(string, sizeof(string), "* %s has destroyed the boombox.", GetPlayerNameEx(playerid));
            foreach(Player, i)
            {
                if(IsPlayerInDynamicArea(i, GetPVarInt(playerid, "pBoomBoxArea")))
                {
                    StopAudioStreamForPlayer(playerid);
                    SendClientMessage(i, COLOR_PURPLE, string);
                }
            }
            DeletePVar(playerid, "pBoomBoxArea");
        }
        SendClientMessage(playerid, COLOR_WHITE, "You've destroyed your boombox!");
    }
    else
    {
    foreach(Player, i) // This is line 65281
    {
            if(GetPVarType(i, "pBoomBox"))
            {
                if(GetPVarInt(i, "pBoomBoxVW") == GetPlayerVirtualWorld(playerid) && GetPVarInt(i, "pBoomBoxInt") == GetPlayerInterior(playerid) && IsPlayerInRangeOfPoint(playerid, 5.0, GetPVarFloat(i, "pBoomBoxX"), GetPVarFloat(i, "pBoomBoxY"), GetPVarFloat(i, "pBoomBoxZ")))
                {
                    DestroyDynamicObject(GetPVarInt(i, "pBoomBox"));
                    DestroyDynamic3DTextLabel(Text3D:GetPVarInt(i, "pBoomBoxLabel"));

                    DeletePVar(i, "pBoomBox");
                    DeletePVar(i, "pBoomBoxStation");
                    DeletePVar(i, "pBoomBoxLabel");
                    DeletePVar(i, "pBoomBoxX");
                    DeletePVar(i, "pBoomBoxY");
                    DeletePVar(i, "pBoomBoxZ");
                    DeletePVar(i, "pBoomBoxInt");
                    DeletePVar(i, "pBoomBoxVW");

                    new string[128];
                    if(GetPVarType(i, "pBoomBoxArea"))
                    {
                        format(string, sizeof(string), "* %s has destroyed the boombox.", GetPlayerNameEx(playerid));
                        for(new i = 0; i < MAX_PLAYERS; i++)
                        {
                            if(IsPlayerInDynamicArea(playerid, GetPVarInt(i, "pBoomBoxArea")))
                            {
                                StopAudioStreamForPlayer(playerid);
                                SendClientMessage(playerid, COLOR_PURPLE, string);
                            }
                        }
                        DeletePVar(i, "pBoomBoxArea");
                    }
                    format(string, sizeof(string), "%s has destroyed your boombox!", GetPlayerNameEx(playerid));
                    SendClientMessage(i, COLOR_WHITE, string);
                    return 1;
                }
            }
    }
    SendClientMessage(playerid, COLOR_WHITE, "You don't have a boombox or you are not near one to destroy."); // this is line 65297
    }
    return 1;
}
Reply
#8

Thank you,That fixed all the 2 warnings completely About the Tracecall one,i'll put the command so you can help me Please i have never defined the tracecall all i have under that is another one in Commentary line

Код:
cmd:tracecall(playerid, params[]) // By mahdi sharawi
{
	new string[128], traced[128], phonenumb;

	if(sscanf(params, "d", phonenumb)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE:/tracecall [phonenumber]");

	if (PlayerInfo[playerid][pJailTime] > 0)
	{
        SendClientMessageEx(playerid,COLOR_GREY,"You can't use your phone while in jail.");
		return 1;
	}
	if (PlayerInfo[playerid][pJob] == 1)
	{
	    SendClientMessage(playerid, COLOR_GREY, "You're not a Detective!");
	}
	foreach(player, i)
	{
		if(PlayerInfo[i][pNumber] == phonenumb && phonenumb != 0)
		{
		    new giveplayerid = i;
		    Mobile[playerid] = giveplayerid;
		    if(IsPlayerConnected(giveplayerid))
		    {
		        if(giveplayerid != INVALID_PLAYER_ID)
		        {
		            if(PhoneOnline[giveplayerid] > 0)
		            {
		                SendClientMessageEx(playerid, COLOR_WHITE, "That Player Phone is Switched OFF!");
						Mobile[playerid] = INVALID_PLAYER_ID;
						return 1;
					}
					if(Mobile[giveplayerid] != INVALID_PLAYER_ID)
					{
						SendClientMessageEx(playerid, COLOR_GRAD2, "Incorrect Phone Number!");
						Mobile[playerid] = INVALID_PLAYER_ID;
						return 1;
					}
					if(Spectating[giveplayerid]!=0)
					{
						SendClientMessageEx(playerid, COLOR_GRAD2, "Incorrect Phone Number!");
						Mobile[playerid] = INVALID_PLAYER_ID;
						return 1;
					}
					if (Mobile[giveplayerid] == INVALID_PLAYER_ID)
					{
					    format(string, sizeof(string), "You Are Tracing %s Phone,it will last  60 SECONDS!", GetPlayerNameEx(giveplayerid));
						SendClientMessageEx(playerid, COLOR_WHITE, string);
						SetPlayerColor(giveplayerid, COLOR_CYAN);
						format(traced, sizeof(traced), " You are Currently Traced by: %s", GetPlayerNameEx(playerid));
						SendClientMessageEx(giveplayerid, COLOR_WHITE, traced);
						KillTimer(Traced[giveplayerid]);
						Traced[giveplayerid] = SetTimerEx("TraceClear", 1000, 1, "i", giveplayerid);
					}
				}
			}
		}
	}
	return 1;
}
Reply
#9

Hmm, open your script and search :
new tracecall; or #define tracecall
Reply
#10

Quote:
Originally Posted by SimpalK
Посмотреть сообщение
Hmm, open your script and search :
new tracecall; or #define tracecall
No Dear sir,i found nothing,it just the cmd that is called TraceCall
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)