Returning wrong if statement.
#1

Hey there i have coded a command were if a player types "/teleport [DESTINATION]" it teleports them to that destination but its always returning the first if statement no matter what you type heres the command :

Код:
CMD:teleport(playerid, params[])
{
	new TeleportLocation[50];
	
	if (sscanf(params, "z", TeleportLocation)) SendClientMessage(playerid, CommandError, "Usage: /teleport [LocationID/Name]");
	else
	{
	  if(strcmp(TeleportLocation, "help",true) || strcmp(TeleportLocation, "00",true))
	  {
			SendClientMessage(playerid, CommandError, ".:: Using /teleport ::.");
			SendClientMessage(playerid, CommandSuccess, "To use the /teleport command you must have the Name/ID of the place you want to teleport to.");
			SendClientMessage(playerid, CommandSuccess, "To obtain a list of destination names and id's type /teleport names.");
		}
		
		else if(strcmp(TeleportLocation, "names", true) || strcmp(TeleportLocation, "01", true))
	  {
			SendClientMessage(playerid, CommandError, ".:: Destination names and ID's ::.");
			SendClientMessage(playerid, CommandSuccess, "SF Airport (Planes) [Name: fly] [ID: 02]");
		}
		
	  else if(strcmp(TeleportLocation, "fly", true) || strcmp(TeleportLocation, "02", true))
	  {
			if(GetPlayerState(playerid) == 2)
			{
				SetVehiclePos(GetPlayerVehicleID(playerid),-1891.1072,-733.9356,347.8068);
			} else SetPlayerPos(playerid, -1891.1072,-733.9356,347.8068);
		}

	}
	return 1;
}
Reply


Messages In This Thread
Returning wrong if statement. - by Christopher. - 27.02.2010, 14:51
Re: Returning wrong if statement. - by Joe Staff - 27.02.2010, 14:52
Re: Returning wrong if statement. - by Christopher. - 27.02.2010, 14:56
Re: Returning wrong if statement. - by Christopher. - 27.02.2010, 15:23
Re: Returning wrong if statement. - by yoan103 - 27.02.2010, 16:05
Re: Returning wrong if statement. - by Christopher. - 27.02.2010, 16:56
Re: Returning wrong if statement. - by Double-O-Seven - 27.02.2010, 16:57
Re: Returning wrong if statement. - by Miguel - 27.02.2010, 18:25

Forum Jump:


Users browsing this thread: 2 Guest(s)