13.05.2009, 10:31
Hello, I'm getting "SERVER: Unknown command." when I do /pickdrugs. Here's the code:
Thank you very much !
pawn Код:
if(strcmp(cmd, "/pickdrugs", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new tmpcar = GetPlayerVehicleID(playerid);
if (IsPlayerInAnyVehicle(playerid))
{
if(PlayerToPoint(4.0, playerid, -72.8756,-1539.0819,2.6172))
{
if(PlayerHaul[tmpcar][pDrugsx] == 0)
{
tmp = strtok(cmdtext, idx);
new check = PlayerHaul[tmpcar][pDrugsx];
if(check >= 50)
{
format(string, sizeof(string), " Your car is full.");
SendClientMessage(playerid, COLOR_RED, string);
return 1;
}
if(GetPlayerMoney(playerid) >= 500000)
{
PlayerHaul[tmpcar][pDrugsx] = 50;
format(string, sizeof(string), " You bought [50] Kilograms of drugs.");
SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
GivePlayerMoney(playerid,-500000);
return 1;
}
else
{
format(string, sizeof(string), "[ERROR] You need $ 500.000 to buy drugs!");
SendClientMessage(playerid, COLOR_RED, string);
return 1;
}
}
else
{
format(string, sizeof(string), "[ERROR] You already bought drugs.");
SendClientMessage(playerid, COLOR_RED, string);
return 1;
}
}
else
{
format(string, sizeof(string), "ERROR: You are not at the drugs load place.");
SendClientMessage(playerid, COLOR_RED, string);
return 1;
}
}
else
{
format(string, sizeof(string), "ERROR: You are not in a car.");
SendClientMessage(playerid, COLOR_RED, string);
return 1;
}
}
return 1;
}
if(strcmp(cmd, "/putdrugs", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new tmpcar = GetPlayerVehicleID(playerid);
if (IsPlayerInAnyVehicle(playerid))
{
if(Drugs <= 1000)
{
if(PlayerToPoint(4.0, playerid, 2735.5935,-2466.1265,13.6484))
{
if(PlayerHaul[tmpcar][pDrugsx] == 50)
{
tmp = strtok(cmdtext, idx);
new check = PlayerHaul[tmpcar][pDrugsx];
if(check <= 50)
{
format(string, sizeof(string), " You don't have drugs in the car");
SendClientMessage(playerid, COLOR_RED, string);
return 1;
}
else if(check >= 50)
{
PlayerHaul[tmpcar][pDrugsx] = 0;
Drugs += 50;
SaveStocks();
format(string, sizeof(string), " You sold 50Kg's of drugs and recieved $520.000 from the handler.");
SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
GivePlayerMoney(playerid,520000);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
return 1;
}
else
{
format(string, sizeof(string), "ERROR: No drugs in the vehicle!");
SendClientMessage(playerid, COLOR_RED, string);
return 1;
}
}
}
else
{
format(string, sizeof(string), "ERROR: You aren't at drugs unload place.");
SendClientMessage(playerid, COLOR_RED, string);
return 1;
}
}
else
{
format(string, sizeof(string), "ERROR: Drug stock full!!");
SendClientMessage(playerid, COLOR_RED, string);
return 1;
}
}
else
{
format(string, sizeof(string), "ERROR: You are not in a car.");
SendClientMessage(playerid, COLOR_RED, string);
return 1;
}
}
return 1;
}