Problem...
#1

Hy when i compile the gamemode:I get this error:
warning 219: local variable "i" shadows a variable at a preceding level


Код:
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)
	    {
	        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));
				        foreach(Player, 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.");
  	}
  	return 1;
}
Reply
#2

Can someone help me about Server.
Thus I do not know how to put the house on sale I have an entire server to complete strangers, but to put the house to be purchased
Thanks in advance!
Reply
#3

You have defined the variable "i" twice, re-name it to something else.
_____

EDIT1: PS: What is wrong with the indentation, it makes it non-readable good with that way even if in my editor is fine..
EDIT2:
Quote:
Originally Posted by marin890
Посмотреть сообщение
Can someone help me about Server.
Thus I do not know how to put the house on sale I have an entire server to complete strangers, but to put the house to be purchased
Thanks in advance!
It is not nice to reply on someone's thread just to ask help for your stuff. Ask for help on the Scripting Help
_____

@dxslide,
Код:
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)
	    {
	        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));
				        foreach(Player, k)
				        {
				            if(IsPlayerInDynamicArea(playerid, GetPVarInt(k, "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.");
  	}
  	return 1;
}
Reply
#4

Thx
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)