SA-MP Forums Archive
Problem with UNKNOWN CMD - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Problem with UNKNOWN CMD (/showthread.php?tid=255667)



Problem with UNKNOWN CMD - orrgoren11 - 16.05.2011

I have this code I found on LARP GM:
Код:
if(strcmp(cmdtext, "/job", true) == 0)
 	{
	 	new job[64];
	 	new giveplayer[MAX_PLAYER_NAME];
	 	new string[256];
	 	job = strtok(cmdtext, idx);
	 	if(IsPlayerConnected(playerid))
		{
		 	if(!strlen(job)){
				SendClientMessage(playerid, COLOR_GREEN, "* ------------ /job ------------ *");
				SendClientMessage(playerid, COLOR_WHITE, "taxi, bus, cop, medic, limo, sex, fire :афщшейеъ оъчбмеъ");
				SendClientMessage(playerid, COLOR_GREEN, "* --------------------------------- *");
				return 1;
			}
			if(strcmp(job,"medic",true) == 0)
			{
			    if(PlayerInfo[playerid][pJob] == 6)
			    {
		            if(MedicCallTime[playerid] > 0)
		            {
		                SendClientMessage(playerid, COLOR_GREY, "   You have already accepted a Medic Call !");
					    return 1;
		            }

		            if(medicCall < 999)
		            {
		                if(IsPlayerConnected(medicCall))
		                {

		                	GetPlayerName(medicCall, giveplayer, sizeof(giveplayer));
		                	format(string, sizeof(string), "* You have accepted the Medic Call from %s, you have 30 Seconds to get there.",giveplayer);
							SendClientMessage(playerid, COLOR_WHITE, string);
							SendClientMessage(playerid, COLOR_WHITE, "* After the 30 Seconds the Red Marker will dissapear.");
	                        format(string, sizeof(string), "* Medic %s has accepted your Medic Call please wait at your current Position.","d");
							SendClientMessage(medicCall, COLOR_WHITE, string);
							new Float:X,Float:Y,Float:Z;
							GetPlayerPos(medicCall, X, Y, Z);
							SetPlayerCheckpoint(playerid, X, Y, Z, 5);
							GameTextForPlayer(playerid, "~w~Medic Caller~n~~r~Goto redmarker", 5000, 1);
							MedicCallTime[playerid] = 1;
							medicCall = 999;
							return 1;
						}
		            }
		            else
		            {
		                SendClientMessage(playerid, COLOR_GREY, "   No-one called for a Medic yet !");
				    	return 1;
		            }
				}
				else
				{
				    SendClientMessage(playerid, COLOR_GREY, "   You are not a Medic !");
				    return 1;
				}
			}
			else { return 1; }
		}//not connected
		return 1;
	}
And if I try to write "/job" it writes me the taxi, bus, cop, medic, limo, sex, fire .... and if I type "/job medic" - its sais UNKNOWN COMMAND, what is the problem ?

Thank you very much!


Re: Problem with UNKNOWN CMD - lowrida018 - 16.05.2011

Try this:

Код:
if(strcmp(cmdtext, "/job", true) == 3)
 	{
	 	new job[64];
	 	new giveplayer[MAX_PLAYER_NAME];
	 	new string[256];
	 	job = strtok(cmdtext, idx);
	 	if(IsPlayerConnected(playerid))
		{
		 	if(!strlen(job)){
				SendClientMessage(playerid, COLOR_GREEN, "* ------------ /job ------------ *");
				SendClientMessage(playerid, COLOR_WHITE, "taxi, bus, cop, medic, limo, sex, fire :афщшейеъ оъчбмеъ");
				SendClientMessage(playerid, COLOR_GREEN, "* --------------------------------- *");
				return 1;
			}
			if(strcmp(job,"medic",true) == 0)
			{
			    if(PlayerInfo[playerid][pJob] == 6)
			    {
		            if(MedicCallTime[playerid] > 0)
		            {
		                SendClientMessage(playerid, COLOR_GREY, "   You have already accepted a Medic Call !");
					    return 1;
		            }

		            if(medicCall < 999)
		            {
		                if(IsPlayerConnected(medicCall))
		                {

		                	GetPlayerName(medicCall, giveplayer, sizeof(giveplayer));
		                	format(string, sizeof(string), "* You have accepted the Medic Call from %s, you have 30 Seconds to get there.",giveplayer);
							SendClientMessage(playerid, COLOR_WHITE, string);
							SendClientMessage(playerid, COLOR_WHITE, "* After the 30 Seconds the Red Marker will dissapear.");
	                        format(string, sizeof(string), "* Medic %s has accepted your Medic Call please wait at your current Position.","d");
							SendClientMessage(medicCall, COLOR_WHITE, string);
							new Float:X,Float:Y,Float:Z;
							GetPlayerPos(medicCall, X, Y, Z);
							SetPlayerCheckpoint(playerid, X, Y, Z, 5);
							GameTextForPlayer(playerid, "~w~Medic Caller~n~~r~Goto redmarker", 5000, 1);
							MedicCallTime[playerid] = 1;
							medicCall = 999;
							return 1;
						}
		            }
		            else
		            {
		                SendClientMessage(playerid, COLOR_GREY, "   No-one called for a Medic yet !");
				    	return 1;
		            }
				}
				else
				{
				    SendClientMessage(playerid, COLOR_GREY, "   You are not a Medic !");
				    return 1;
				}
			}
			else { return 1; }
		}//not connected
		return 1;
	}



Re: Problem with UNKNOWN CMD - orrgoren11 - 16.05.2011

now neither the /job nor the /job medic works (UnKnown Command).


Re: Problem with UNKNOWN CMD - lowrida018 - 16.05.2011

You don't have a job command in there for starters.

And try this:

Код:
if(strcmp(cmdtext, "/job", true) == 0)
 	{
	 	new job[64];
	 	new giveplayer[MAX_PLAYER_NAME];
	 	new string[256];
	 	job = strtok(cmdtext, idx);
	 	if(IsPlayerConnected(playerid))
		{
		 	if(!job( {
				SendClientMessage(playerid, COLOR_GREEN, "* ------------ /job ------------ *");
				SendClientMessage(playerid, COLOR_WHITE, "taxi, bus, cop, medic, limo, sex, fire :афщшейеъ оъчбмеъ");
				SendClientMessage(playerid, COLOR_GREEN, "* --------------------------------- *");
				return 1;
			}
			if(strcmp(job,"medic",true) == 0)
			{
			    if(PlayerInfo[playerid][pJob] == 6)
			    {
		            if(MedicCallTime[playerid] > 0)
		            {
		                SendClientMessage(playerid, COLOR_GREY, "   You have already accepted a Medic Call !");
					    return 1;
		            }

		            if(medicCall < 999)
		            {
		                if(IsPlayerConnected(medicCall))
		                {

		                	GetPlayerName(medicCall, giveplayer, sizeof(giveplayer));
		                	format(string, sizeof(string), "* You have accepted the Medic Call from %s, you have 30 Seconds to get there.",giveplayer);
							SendClientMessage(playerid, COLOR_WHITE, string);
							SendClientMessage(playerid, COLOR_WHITE, "* After the 30 Seconds the Red Marker will dissapear.");
	                        format(string, sizeof(string), "* Medic %s has accepted your Medic Call please wait at your current Position.","d");
							SendClientMessage(medicCall, COLOR_WHITE, string);
							new Float:X,Float:Y,Float:Z;
							GetPlayerPos(medicCall, X, Y, Z);
							SetPlayerCheckpoint(playerid, X, Y, Z, 5);
							GameTextForPlayer(playerid, "~w~Medic Caller~n~~r~Goto redmarker", 5000, 1);
							MedicCallTime[playerid] = 1;
							medicCall = 999;
							return 1;
						}
		            }
		            else
		            {
		                SendClientMessage(playerid, COLOR_GREY, "   No-one called for a Medic yet !");
				    	return 1;
		            }
				}
				else
				{
				    SendClientMessage(playerid, COLOR_GREY, "   You are not a Medic !");
				    return 1;
				}
			}
			else { return 1; }
		}//not connected
		return 1;
	}



Re: Problem with UNKNOWN CMD - orrgoren11 - 16.05.2011

I changed it to Job - in the LARP it's /accept.
And this one again did a Unknown Command for the /job medic, and the /job alone works perfect.


Re: Problem with UNKNOWN CMD - lowrida018 - 16.05.2011

Lol, why didn't I see this, theres no !jobmedic or /jobmedic.


Re: Problem with UNKNOWN CMD - orrgoren11 - 16.05.2011

I said in the LARP it's /accept ...
to find the /accept, search for: if(strcmp(cmdtext,"/accept",tru
to find the /accept medic, search for: if(strcmp(xjob,"medic"


Re: Problem with UNKNOWN CMD - orrgoren11 - 16.05.2011

Someone ? Sorry for the double.


Re: Problem with UNKNOWN CMD - orrgoren11 - 17.05.2011

Help Please.