Unkown command? -
Tuntun - 20.08.2014
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
Re: Unkown command? -
Gogorakis - 20.08.2014
Try to put "else" above "SendClientMessage(playerid, -1,"{CE0000}You have to be on a plane to start the job!");"
Re: Unkown command? -
Tuntun - 20.08.2014
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);
}
}
Re: Unkown command? -
Gogorakis - 20.08.2014
I am not experianced but I think that "return 1;" or "return 0;" cause that..Wait for someone who can help you more..
Re: Unkown command? -
krytans - 20.08.2014
Try to put the code in OnPlayerCommandRecieved.
Re: Unkown command? -
Stinged - 20.08.2014
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.
Re: Unkown command? -
Tuntun - 20.08.2014
sO WHAT TO DO NOW.
Re: Unkown command? -
MikeEd - 20.08.2014
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.
Re: Unkown command? -
Tuntun - 21.08.2014
still same...
Re: Unkown command? -
iFarbod - 21.08.2014
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.