Why is this a Unknown Command?
#1

Hello,
why is this a unknown command? A message (SERVER: Unknown Command) came to my gta when i used this command:

Quote:

if(strcmp(cmd, "/rentcar", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new vehicleid = GetPlayerVehicleID(playerid);
if(RentCars[vehicleid])
{
if(SBizzInfo[11][sbProducts] == 0)
{
GameTextForPlayer(playerid, "~r~Ausverkauft", 5000, 1);
return 1;
}
if (PlayerMoney[playerid] < SBizzInfo[11][sbEntranceCost])
{
SendClientMessage(playerid, COLOR_GRAD2, "Du hast nicht genug Geld!");
return 1;
}
PlayerMoney[playerid] = PlayerMoney[playerid]-SBizzInfo[11][sbEntranceCost];
SBizzInfo[11][sbTill] += SBizzInfo[11][sbEntranceCost];
ExtortionSBiz(11, SBizzInfo[11][sbEntranceCost]);
SBizzInfo[11][sbProducts]--;
}
if(RentCars[vehicleid])
{
if(SBizzInfo[1][sbProducts] == 0)
{
GameTextForPlayer(playerid, "~r~Ausverkauft", 5000, 1);
return 1;
}
if (PlayerMoney[playerid] < SBizzInfo[1][sbEntranceCost])
{
SendClientMessage(playerid, COLOR_GRAD2, "Du hast nicht genug Geld!");
return 1;
}
PlayerMoney[playerid] = PlayerMoney[playerid]-SBizzInfo[1][sbEntranceCost];
SBizzInfo[1][sbTill] += SBizzInfo[1][sbEntranceCost];
ExtortionSBiz(1, SBizzInfo[1][sbEntranceCost]);
SBizzInfo[1][sbProducts]--;
}
if(RentCars[vehicleid])
{
if(SBizzInfo[2][sbProducts] == 0)
{
GameTextForPlayer(playerid, "~r~Ausverkauft", 5000, 1);
return 1;
}
if (PlayerMoney[playerid] < SBizzInfo[1][sbEntranceCost])
{
SendClientMessage(playerid, COLOR_GRAD2, "Du hast nicht genug Geld!");
return 1;
}
PlayerMoney[playerid] = PlayerMoney[playerid]-SBizzInfo[1][sbEntranceCost];
SBizzInfo[2][sbTill] += SBizzInfo[2][sbEntranceCost];
ExtortionSBiz(2, SBizzInfo[2][sbEntranceCost]);
SBizzInfo[2][sbProducts]--;
}
if(HireCar[playerid] != 299)
{
gCarLock[HireCar[playerid]] = 0;
UnLockCar(HireCar[playerid]);
SendClientMessage(playerid, COLOR_GREY, "Du musst dein altes Fahrzeug/Boot/Flugzeug erst abmieten!");
}
HireCar[playerid] = PlayerRentCar[playerid];
OnPropUpdate();
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
format(string, sizeof(string), "~w~Vergesse nicht: ~b~/unrentcar~n~~g~/lock ~w~um dein Fahrzeug abzuschlieЯen.");
GameTextForPlayer(playerid, string, 5000, 3);
TogglePlayerControllable(playerid, 1);
}
return 1;
}

I hope anyone can help me.

Thank you!
Reply
#2

I have the same question
Reply
#3

Use dcmd or sscanf for advanced struture commands. And make more organizated x_x:
pawn Код:
~if(strcmp(cmd, "/rentcar", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new vehicleid = GetPlayerVehicleID(playerid);
if(RentCars[vehicleid])
{
if(SBizzInfo[11][sbProducts] == 0)
{
GameTextForPlayer(playerid, "~r~Ausverkauft", 5000, 1);
return 1;
}
if (PlayerMoney[playerid] < SBizzInfo[11][sbEntranceCost])
{
SendClientMessage(playerid, COLOR_GRAD2, "Du hast nicht genug Geld!");
return 1;
}
PlayerMoney[playerid] = PlayerMoney[playerid]-SBizzInfo[11][sbEntranceCost];
SBizzInfo[11][sbTill] += SBizzInfo[11][sbEntranceCost];
ExtortionSBiz(11, SBizzInfo[11][sbEntranceCost]);
SBizzInfo[11][sbProducts]--;
}
if(RentCars[vehicleid])
{
if(SBizzInfo[1][sbProducts] == 0)
{
GameTextForPlayer(playerid, "~r~Ausverkauft", 5000, 1);
return 1;
}
if (PlayerMoney[playerid] < SBizzInfo[1][sbEntranceCost])
{
SendClientMessage(playerid, COLOR_GRAD2, "Du hast nicht genug Geld!");
return 1;
}
PlayerMoney[playerid] = PlayerMoney[playerid]-SBizzInfo[1][sbEntranceCost];
SBizzInfo[1][sbTill] += SBizzInfo[1][sbEntranceCost];
ExtortionSBiz(1, SBizzInfo[1][sbEntranceCost]);
SBizzInfo[1][sbProducts]--;
}
if(RentCars[vehicleid])
{
if(SBizzInfo[2][sbProducts] == 0)
{
GameTextForPlayer(playerid, "~r~Ausverkauft", 5000, 1);
return 1;
}
if (PlayerMoney[playerid] < SBizzInfo[1][sbEntranceCost])
{
SendClientMessage(playerid, COLOR_GRAD2, "Du hast nicht genug Geld!");
return 1;
}
PlayerMoney[playerid] = PlayerMoney[playerid]-SBizzInfo[1][sbEntranceCost];
SBizzInfo[2][sbTill] += SBizzInfo[2][sbEntranceCost];
ExtortionSBiz(2, SBizzInfo[2][sbEntranceCost]);
SBizzInfo[2][sbProducts]--;
}
if(HireCar[playerid] != 299)
{
gCarLock[HireCar[playerid]] = 0;
UnLockCar(HireCar[playerid]);
SendClientMessage(playerid, COLOR_GREY, "Du musst dein altes Fahrzeug/Boot/Flugzeug erst abmieten!");
}
HireCar[playerid] = PlayerRentCar[playerid];
OnPropUpdate();
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
format(string, sizeof(string), "~w~Vergesse nicht: ~b~/unrentcar~n~~g~/lock ~w~um dein Fahrzeug abzuschlieЯen.");
GameTextForPlayer(playerid, string, 5000, 3);
TogglePlayerControllable(playerid, 1);
}
return 1;
}
}
Reply
#4

Have you used strins? Replace it with format if you have more commands which return unknown command.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)