unknown command please help
#1

Код:
public parkCloseForPublic(playerid)
{
	KillTimer(AdvertTimer);
	AdvertTimer=-1;
	StuntParkIsOpen=false;
    SendClientMessageToAll(COLOR_PINK ,"The Stunt Park is closed. Come back tomorrow!");
    if(gTeam[playerid] == TEAM_PAKISTAN)
	{
	   new rand = random(sizeof(PakistanSpawn));
	   SetPlayerPos(playerid, PakistanSpawn[rand][0], PakistanSpawn[rand][1], PakistanSpawn[rand][2]);
	}
	else if(gTeam[playerid] == TEAM_CHINA)
	{
       new rand = random(sizeof(ChinaSpawn));
	   SetPlayerPos(playerid, ChinaSpawn[rand][0], ChinaSpawn[rand][1], ChinaSpawn[rand][2]);
	}
	else if(gTeam[playerid] == TEAM_INDIA)
	{
       new rand = random(sizeof(IndiaSpawn));
	   SetPlayerPos(playerid, IndiaSpawn[rand][0], IndiaSpawn[rand][1], IndiaSpawn[rand][2]);
	}
	else if(gTeam[playerid] == TEAM_NEPAL)
	{
       new rand = random(sizeof(NepalSpawn));
	   SetPlayerPos(playerid, NepalSpawn[rand][0], NepalSpawn[rand][1], NepalSpawn[rand][2]);
	}
	else if(gTeam[playerid] == TEAM_USA)
	{
       new rand = random(sizeof(USSpawn));
	   SetPlayerPos(playerid, USSpawn[rand][0], USSpawn[rand][1], USSpawn[rand][2]);
	}
	else if(gTeam[playerid] == TEAM_DUBAI)
	{
       new rand = random(sizeof(DubaiSpawn));
	   SetPlayerPos(playerid, DubaiSpawn[rand][0], DubaiSpawn[rand][1], DubaiSpawn[rand][2]);
	}
	else if(gTeam[playerid] == TEAM_ML)
	{
       new rand = random(sizeof(MLSpawn));
	   SetPlayerPos(playerid, MLSpawn[rand][0], MLSpawn[rand][1], MLSpawn[rand][2]);
	}
}
public OnPlayerCommandText(playerid, cmdtext[])
{
 if( !strcmp(cmdtext, "/stuntpark", true) )
	{
		if(StuntParkIsOpen) // IF the stunt park is open, this command teleports the player there.
		{
			IsPlayerAllowedToTeleportBack[playerid]=true; //This Allows player to use /parking
			SetPlayerPos(playerid,-1262.3549,-502.5197,19.5345);// Teleport the player
			SetPlayerInterior(playerid,0); // if the player is in an interior, this will set him to outside
			SendClientMessage(playerid,COLOR_LIGHTBLUE,"Welcome to the Stunt Park! Please use /parking to exit.");
			return 1;
		}
		else  // Shows this message when you type /stuntpark and the timer is not activated.
		{
			SendClientMessage(playerid,COLOR_LIGHTBLUE,"Stunt Park is CLOSED! Please come back.");
			SendClientMessage(playerid,COLOR_LIGHTBLUE,"You'll get a message when it's opened again!");
			return 1;
		}
	}
 if( !strcmp(cmdtext,"/parking", true) )
	{
		if( IsPlayerAllowedToTeleportBack[playerid] )
		{
			SetPlayerPos(playerid,-2026.6072,-99.0327,35.1641);// Teleport the player outside the Stunt Park.
			IsPlayerAllowedToTeleportBack[playerid]=false;
			SendClientMessage(playerid,COLOR_ORANGE,"Thank you for participating at the Stunt Park!");
			return 1;
		}
		else // Sends this message if you type /parking and that you are not allowed to Teleport back.
		{
			SendClientMessage(playerid,COLOR_ORANGE,"You are not allowed to use this command");
			return 1;
		}
	}

	if( !strcmp(cmdtext,"/stuntpark help", true) ) // That's a simple text command wich will explain how to use the Stunt Park
	{
		SendClientMessage(playerid,COLOR_ORANGE,"====) STUNTPARK (====");
		SendClientMessage(playerid,COLOR_LIGHTBLUE,"The stuntpark event allow people to access a nice stunt area");
		SendClientMessage(playerid,COLOR_LIGHTBLUE,"based in the San Fierro School yard.");
		SendClientMessage(playerid,COLOR_LIGHTBLUE,"You may colllect money for stunt bonuses.");
		SendClientMessage(playerid,COLOR_GREEN,"Use /stuntpark to enter it and use /parking to leave it.");
		SendClientMessage(playerid,COLOR_GREEN,"**CREDITS: Anurag");
		SendClientMessage(playerid,COLOR_ORANGE,"====) CMD MENU (====");
		return 1;
	}

	return 0; // shows unknown command else.
}
What's Wrong In It When i type a command it says unknown command
Reply
#2

because your returning 0
Replace it
Код:
	return 0; // shows unknown command else.
}
with
Код:
	return 1; // shows unknown command else.
}
Reply
#3

Quote:
Originally Posted by FuNkYTheGreat
Посмотреть сообщение
because your returning 0
Replace it
Код:
	return 0; // shows unknown command else.
}
with
Код:
	return 1; // shows unknown command else.
}
*cough*
https://sampwiki.blast.hk/wiki/OnPlayerCommandText
Quote:

public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/help", true))
{
SendClientMessage(playerid, -1, "SERVER: This is the /help command!");
return 1;
// Returning 1 informs the server that the command has been processed.
// OnPlayerCommandText won't be called in other scripts.
}
return 0;
// Returning 0 informs the server that the command hasn't been processed by this script.
// OnPlayerCommandText will be called in other scripts until one returns 1.
// If no scripts return 1, the 'SERVER: Unknown Command' message will be shown to the player.
}

Reply
#4

Not fixed The error
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)