Unknown Command
#1

Код:
	if(strcmp(cmdtext,"/startjob",true)==0)
	{
	    if (IsPlayerInVehicle(playerid,cargobob))
	    {
	        if(job[playerid] == 0)
	        {
				job[playerid] = 1;
				CheckPointOn[playerid] = 1;
				SetPlayerCheckpoint(playerid, -1495.9570,2502.4172,56.1604, 3.0);
				SendClientMessage(playerid,COLOR_LIGHTBLUE,"You have just started this job. Go take a airplane and head to the checkpoint!");
				SendClientMessage(playerid,COLOR_LIGHTBLUE,"[WARNING]: Every second you'll get -100$ from your payment. So make it fast!");
				JobCash = SetTimerEx("CashJob",5000,true,"i",playerid);
				Cashout[playerid] = 10000;
				return 1;
	       		}
			else if(job[playerid] == 1) return SendClientMessage(playerid,COLOR_GRAY,"You already doing a job!");
			{
			if (GetPlayerVehicleID(!playerid,cargobob)) return SendClientMessage(playerid,COLOR_GRAY,"You aren't in a cargobob!.");
				}
		}
	}
When i do it inside Cargobob id it says unknown command

and a warning on line 'if(GetPlayerVehicleID(blabla....

Код:
C:\Archivos de programa\Rockstar Games\GTA San Andreas\SA-MP 0.3b\Server 0.3b\gamemodes\fierroharb_retardjob.pwn(1147) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
Reply
#2

That is not the correct usage of GetPlayerVehicleID. It returns the ID of the vehicle, and not the model ID. It looks like you want to compare the model ID, for that you need GetVehicleModel and the model ID of the "cargobob" which is available on the SA-MP Wiki. Here is an example:

pawn Код:
if (GetVehicleModel(GetPlayerVehicleID(playerid) == 548) return SendClientMessage(playerid,COLOR_GRAY,"You aren't in a cargobob!.");
Also, it is saying "Unknown Command" because you don't return 1 at the end of the command, so it continues down to the return 0, and when OnPlayerCommandText returns 0 it automatically sends the default Unknown Command message in the client.

I hope this helps!
Reply
#3

ok ty sorry im lil noob and i have defined cargobob
so what about unknown command? :S
Reply
#4

Quote:
Originally Posted by admantis
Посмотреть сообщение
ok ty sorry im lil noob and i have defined cargobob
so what about unknown command? :S
Well if you have defined cargobob as the vehicleid of the cargobob you created, then all you need is:

pawn Код:
if(GetPlayerVehicleID(playerid) == cargobob)
Also, it is saying "Unknown Command" because you don't return 1 at the end of the command, so it continues down to the return 0, and when OnPlayerCommandText returns 0 it automatically sends the default Unknown Command message in the client.
Reply
#5

pawn Код:
if(!GetPlayerVehicleID(playerid) == cargobob) return SendClientMessage(playerid,COLOR_GRAY,"You aren't in a cargobob!.");
Fix that a little for you, you left out the ' ! ' which you had it if they was in a cargobob then they couldn't do what ever he was doing.
Reply
#6

Okay i added it, it worked, no SERVER: Unknow command. But now... It dont do what its supposed to do, create checkpoint and those shit. It worked before in a /startjob command but it was without entering the cargobob but now when it haves to be IN a cargobob it dont work :S
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)