Help!Error at "else"
#1

I have a problem with this it shows those errors at the line i added // ERROR HERE
I need help fixing this
Код:
warning 225: unreachable code
error 029: invalid expression, assumed zero
Код:
for(new h=0; h<=MAX_TELEPORTS; h++)
	{
		if(IsPlayerInRangeOfPoint(playerid, 1, TeleportInfo[h][gstartCX], TeleportInfo[h][gstartCY], TeleportInfo[h][gstartCZ]))
		{
			new file[64];
			format(file,sizeof(file),"teleports/teleport%d.txt",h);
			new Float: X, Float: Y, Float: Z;
			X = dini_Float(file,"endfloatx");
			Y = dini_Float(file,"endfloaty");
			Z = dini_Float(file,"endfloatz");
			new Q = dini_Int(file,"virtualworld");
			new W = dini_Int(file,"interior");
			SetPlayerVirtualWorld(playerid,Q);
			SetPlayerInterior(playerid,W);
			SetPlayerPos(playerid,X,Y,Z);
			return 1;
		}
		else
		{
       		new file[64];
			format(file,sizeof(file),"teleports/teleport%d.txt",h);
			new Float: X, Float: Y, Float: Z;
			X = dini_Float(file,"endfloatx");
			Y = dini_Float(file,"endfloaty");
			Z = dini_Float(file,"endfloatz");
			new Q = dini_Int(file,"endvirtualworld");
			new W = dini_Int(file,"endinterior");
			SetPlayerVirtualWorld(playerid,Q);
			SetPlayerInterior(playerid,W);
			SetPlayerPos(playerid,X,Y,Z);
			return 1;
		}
 	    else
	    {
		   new filee[64];
		   format(filee,sizeof(filee),"teleports/teleport%d.txt",h);
		   new Float: XX, Float: YY, Float: ZZ;
		   XX = dini_Float(filee,"endfloatx");
		   YY = dini_Float(filee,"endfloaty");
		   ZZ = dini_Float(filee,"endfloatz");
		   if(IsPlayerInRangeOfPoint(playerid,1, XX,YY,ZZ))
		   {
		 	   new file[64];
			   format(file,sizeof(file),"teleports/teleport%d.txt",h);
			   new Float: X, Float: Y, Float: Z;
			   X = dini_Float(file,"startfloatx");
			   Y = dini_Float(file,"startfloaty");
			   Z = dini_Float(file,"startfloatz");
			   new Q = dini_Int(file,"startvirtualworld");
			   new W = dini_Int(file,"startinterior");
			   SetPlayerVirtualWorld(playerid,Q);
			   SetPlayerInterior(playerid,W);
			   SetPlayerPos(playerid,X,Y,Z);
			   return 1;
		   }
		   else   // ERROR HERE << 
		   {
			   new file[64];
			   format(file,sizeof(file),"teleports/teleport%d.txt",h);
			   new Float: X, Float: Y, Float: Z;
			   X = dini_Float(file,"startfloatx");
			   Y = dini_Float(file,"startfloaty");
			   Z = dini_Float(file,"startfloatz");
			   new Q = dini_Int(file,"startvirtualworld");
			   new W = dini_Int(file,"startinterior");
			   SetPlayerVirtualWorld(playerid,Q);
			   SetPlayerInterior(playerid,W);
			   SetPlayerPos(playerid,X,Y,Z);
			   return 1;
		   }
	    }
    }
    return 1;
}
Reply
#2

The else doesnt have any if statement. When should the code in that else be executed (under what condition)?
Reply
#3

On CheckEnter(),when using /enter it will only work nearby the bizes,houses,teleports(this),so im modified the script to work for everybody!
Earlier it was with gFaction but it didn't have any error so i have removed that!

This is how it was before i removed gFaction things
Код:
COMMAND:use(playerid)
{
	for(new h=0; h<=MAX_TELEPORTS; h++)
	{
		if(IsPlayerInRangeOfPoint(playerid, 1, TeleportInfo[h][gstartCX], TeleportInfo[h][gstartCY], TeleportInfo[h][gstartCZ]))
		{
			if(TeleportInfo[h][gFaction] == 255)
			{
				new file[64];
			    format(file,sizeof(file),"teleports/teleport%d.txt",h);
			    new Float: X, Float: Y, Float: Z;
			    X = dini_Float(file,"endfloatx");
			 	Y = dini_Float(file,"endfloaty");
			 	Z = dini_Float(file,"endfloatz");
			 	new Q = dini_Int(file,"virtualworld");
			 	new W = dini_Int(file,"interior");
			    SetPlayerVirtualWorld(playerid,Q);
			    SetPlayerInterior(playerid,W);
			    SetPlayerPos(playerid,X,Y,Z);
			    SendClientInfo(playerid, "Done, Good day ! ");
			}
			else
			{
			    if(PlayerInfo[playerid][playerteam]==TeleportInfo[h][gFaction])
				{
					new file[64];
				    format(file,sizeof(file),"teleports/teleport%d.txt",h);
				    new Float: X, Float: Y, Float: Z;
				    X = dini_Float(file,"endfloatx");
				 	Y = dini_Float(file,"endfloaty");
				 	Z = dini_Float(file,"endfloatz");
				 	new Q = dini_Int(file,"endvirtualworld");
				 	new W = dini_Int(file,"endinterior");
				    SetPlayerVirtualWorld(playerid,Q);
				    SetPlayerInterior(playerid,W);
				    SetPlayerPos(playerid,X,Y,Z);
				    SendClientInfo(playerid, "Done, Good day ! ");
				}
				else
				{
				    SendClientError(playerid,"Invalid Faction!");
				}
			}
		}
 		else
		{
			new filee[64];
		    format(filee,sizeof(filee),"teleports/teleport%d.txt",h);
		    new Float: XX, Float: YY, Float: ZZ;
		    XX = dini_Float(filee,"endfloatx");
		 	YY = dini_Float(filee,"endfloaty");
		 	ZZ = dini_Float(filee,"endfloatz");
			if(IsPlayerInRangeOfPoint(playerid,1, XX,YY,ZZ))
		    {
				if(TeleportInfo[h][gFaction] == 255)
				{
					new file[64];
				    format(file,sizeof(file),"teleports/teleport%d.txt",h);
				    new Float: X, Float: Y, Float: Z;
				    X = dini_Float(file,"startfloatx");
				 	Y = dini_Float(file,"startfloaty");
				 	Z = dini_Float(file,"startfloatz");
				 	new Q = dini_Int(file,"startvirtualworld");
				 	new W = dini_Int(file,"startinterior");
				    SetPlayerVirtualWorld(playerid,Q);
				    SetPlayerInterior(playerid,W);
				    SetPlayerPos(playerid,X,Y,Z);
				    SendClientInfo(playerid, "Done, Good day ! ");
				}
				else
				{
					if(PlayerInfo[playerid][playerteam]==TeleportInfo[h][gFaction])
				    {
						new file[64];
					    format(file,sizeof(file),"teleports/teleport%d.txt",h);
					    new Float: X, Float: Y, Float: Z;
					    X = dini_Float(file,"startfloatx");
					 	Y = dini_Float(file,"startfloaty");
					 	Z = dini_Float(file,"startfloatz");
					 	new Q = dini_Int(file,"startvirtualworld");
					 	new W = dini_Int(file,"startinterior");
					    SetPlayerVirtualWorld(playerid,Q);
					    SetPlayerInterior(playerid,W);
					    SetPlayerPos(playerid,X,Y,Z);
					    SendClientInfo(playerid, "Done, Good day ! ");
				    }
				    else
				    {
				        SendClientError(playerid,"Invalid Faction!");
				    }
				}
			}
		}
	}
	return 1;
}
Reply
#4

I'm almost home. Will check on your code on my laptop in a bit!
Reply
#5

Please,help me with this!
Reply
#6

What should i do with it?
Reply
#7

Try the following. There was something wrong with your control flow.
PHP код:
COMMAND:use(playerid)
{
    for(new 
h=0h<=MAX_TELEPORTSh++)
    {
        if(
IsPlayerInRangeOfPoint(playerid1TeleportInfo[h][gstartCX], TeleportInfo[h][gstartCY], TeleportInfo[h][gstartCZ]))
        {
            new 
file[64];
            
format(file,sizeof(file),"teleports/teleport%d.txt",h);
            new 
FloatXFloatYFloatZ;
            
dini_Float(file,"endfloatx");
             
dini_Float(file,"endfloaty");
             
dini_Float(file,"endfloatz");
             new 
dini_Int(file,"virtualworld");
             new 
dini_Int(file,"interior");
            
SetPlayerVirtualWorld(playerid,Q);
            
SetPlayerInterior(playerid,W);
            
SetPlayerPos(playerid,X,Y,Z);
            
SendClientInfo(playerid"Done, Good day ! ");
        }
         else
        {
            new 
filee[64];
            
format(filee,sizeof(filee),"teleports/teleport%d.txt",h);
            new 
FloatXXFloatYYFloatZZ;
            
XX dini_Float(filee,"endfloatx");
             
YY dini_Float(filee,"endfloaty");
             
ZZ dini_Float(filee,"endfloatz");
            if(
IsPlayerInRangeOfPoint(playerid,1XX,YY,ZZ))
            {
                new 
file[64];
                
format(file,sizeof(file),"teleports/teleport%d.txt",h);
                new 
FloatXFloatYFloatZ;
                
dini_Float(file,"startfloatx");
                 
dini_Float(file,"startfloaty");
                 
dini_Float(file,"startfloatz");
                 new 
dini_Int(file,"startvirtualworld");
                 new 
dini_Int(file,"startinterior");
                
SetPlayerVirtualWorld(playerid,Q);
                
SetPlayerInterior(playerid,W);
                
SetPlayerPos(playerid,X,Y,Z);
                
SendClientInfo(playerid"Done, Good day ! ");
            }
        }
    }
    return 
1;

Reply
#8

Talk about being return happy lol.
Reply
#9

Yeey it worked.. Thank you so much +rep
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)