SA-MP Forums Archive
Why is this a Unknown Command? - 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: Why is this a Unknown Command? (/showthread.php?tid=204729)



Why is this a Unknown Command? - nescha - 30.12.2010

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!


Re: Why is this a Unknown Command? - Darklom - 30.12.2010

I have the same question


Re: Why is this a Unknown Command? - blackwave - 30.12.2010

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;
}
}



Re: Why is this a Unknown Command? - Jochemd - 30.12.2010

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