Unkown command?
#1

My code:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp("/work", cmdtext, true))
{
new pvehiclemodel = GetVehicleModel(GetPlayerVehicleID(playerid));
if(IsPlayerInMission[playerid] >= 1)return SendClientMessage(playerid,-1,"You already have a mission!");
if (pvehiclemodel == 520 || pvehiclemodel == 511 || pvehiclemodel == 519)
{
PilotJob[playerid] = 1;
SetPlayerCheckpoint(playerid, -1301.9893,-347.4291,14.1484,40.0);
SendClientMessage(playerid, -1,"~g~Info: ~w~Mission started! Please follow the check point!");
GameTextForPlayer(playerid,"~w~Mission~g~Started!" , 3000, 3);
return 1;
}
SendClientMessage(playerid, -1,"{CE0000}You have to be on a plane to start the job!");
}
return 0;
}

but error is:

Still it does not show the checkpoint/ mission is not get started
Reply
#2

Try to put "else" above "SendClientMessage(playerid, -1,"{CE0000}You have to be on a plane to start the job!");"
Reply
#3

Well i did already. its not about the plane. its about if i enter the plane and /work it does not work
my full codes:
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if(!strcmp("/work", cmdtext, true))
	{
		new pvehiclemodel = GetVehicleModel(GetPlayerVehicleID(playerid));
		if(IsPlayerInMission[playerid] >= 1)return SendClientMessage(playerid,-1,"You already have a mission!");
		if (pvehiclemodel == 520 || pvehiclemodel == 511 || pvehiclemodel == 519)
		{
			PilotJob[playerid] = 1;
			SetPlayerCheckpoint(playerid, -1301.9893,-347.4291,14.1484,40.0);
			SendClientMessage(playerid, -1,"~g~Info: ~w~Mission started! Please follow the check point!");
			GameTextForPlayer(playerid,"~w~Mission~g~Started!", 3000, 3);
			return 1;
		}
		SendClientMessage(playerid, -1,"{CE0000}You have to be on a plane to start the job!");
	}
	return 0;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
	if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 519 || 511 || 520)
	{
		SendClientMessage(playerid,-1,"Must use /work to start the mission");
	}
	return 0;
}
public OnPlayerEnterCheckpoint(playerid)
{
	if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 519 || 511 || 520)
	{
		if(PilotJob[playerid] == 1){
			PilotJob[playerid] = 2;
			SetPlayerCheckpoint(playerid, 1562.4001,-2414.3513,13.5547,40.0);
			GameTextForPlayer(playerid,"~w~ Flight ~g~ Started!", 3000, 3);
			return 1;
		}
		if(PilotJob[playerid] == 2){
			PilotJob[playerid] = 0;
			DisablePlayerCheckpoint(playerid);
			SendClientMessage(playerid, -1,"Info: Flight Completed! Earned 20,000$ & 5 score");
			GivePlayerMoney(playerid,20000);
			GameTextForPlayer(playerid,"~w~ Flight ~g~ Completed!", 3000, 3);
			SetPlayerScore(playerid,5);
		}
	}
	return 1;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
	if(PilotJob[playerid] > 0)
	{
		PilotJob[playerid] = 0;
		SendClientMessage(playerid, -1, "Flight Cannceled Due to: You exited the plane!");
		DisablePlayerCheckpoint(playerid);
	}
}
Reply
#4

I am not experianced but I think that "return 1;" or "return 0;" cause that..Wait for someone who can help you more..
Reply
#5

Try to put the code in OnPlayerCommandRecieved.
Reply
#6

Quote:
Originally Posted by krytans
Посмотреть сообщение
Try to put the code in OnPlayerCommandRecieved.
1- OnPlayerCommandRecieved is zcmd only.
2- He's not using zcmd.
3- Even if he is, OnPlayerCommandRecieved isn't the place to create commands.
Reply
#7

sO WHAT TO DO NOW.
Reply
#8

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp("/work", cmdtext, true))
{
new pvehiclemodel = GetVehicleModel(GetPlayerVehicleID(playerid));
if(IsPlayerInMission[playerid] == 1) return SendClientMessage(playerid,-1,"You already have a mission!");
if (pvehiclemodel != 520 || pvehiclemodel != 511 || pvehiclemodel != 519) return SendClientMessage(playerid, -1,"{CE0000}You have to be on a plane to start the job!");
PilotJob[playerid] = 1;
SetPlayerCheckpoint(playerid, -1301.9893,-347.4291,14.1484,40.0);
SendClientMessage(playerid, -1,"~g~Info: ~w~Mission started! Please follow the check point!");
GameTextForPlayer(playerid,"~w~Mission~g~Started!" , 3000, 3);
}
return 0;
}
Try this and let me know.
Reply
#9

still same...
Reply
#10

Quote:
Originally Posted by Tuntun
Посмотреть сообщение
still same...
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp("/work", cmdtext, true))
    {
        new pvehiclemodel = GetVehicleModel(GetPlayerVehicleID(playerid));
        if(IsPlayerInMission[playerid] == 1) return SendClientMessage(playerid,-1,"You already have a mission!");
        if (pvehiclemodel != 520 || pvehiclemodel != 511 || pvehiclemodel != 519) return SendClientMessage(playerid, -1,"{CE0000}You have to be on a plane to start the job!");
        PilotJob[playerid] = 1;
        SetPlayerCheckpoint(playerid, -1301.9893,-347.4291,14.1484,40.0);
        SendClientMessage(playerid, -1,"~g~Info: ~w~Mission started! Please follow the check point!");
        GameTextForPlayer(playerid,"~w~Mission~g~Started!" , 3000, 3);
        return 1; // we have processed a command, so let's aviod the "SERVER: Unknown Command."
    }
    return 0;
}
This should help.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)