if(strcmp(cmd, "/loadheroin", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pJob] == 16)
{
new tmpcar = GetPlayerVehicleID(playerid);
if(IsPlayerInRangeOfPoint(playerid, 30, -2172.7830,-215.0502,35.3203))
{
if(GetVehicleModel(tmpcar) == 433 || GetVehicleModel(tmpcar) == 440 || GetVehicleModel(tmpcar) == 514 || GetVehicleModel(tmpcar) == 428 || GetVehicleModel(tmpcar) == 403 || GetVehicleModel(tmpcar) == 515)
{
if(PlayerHaul[tmpcar][pHeroin] < PlayerHaul[tmpcar][pCapasity])
{
new amount;
new compcost = 30;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SCM(playerid, COLOR_GRAD1, "USAGE: /loadheroin [amount]");
return 1;
}
amount = strval(tmp);
if(amount < 1 || amount > 100) { SCM(playerid, COLOR_GREY, " Can't buy less then 1 gram or more then 100!"); return 1; }
new check = PlayerHaul[tmpcar][pHeroin] + amount;
if(check > PlayerHaul[tmpcar][pCapasity])
{
format(string, sizeof(string), " You went over the Truck heroin Carry Limit of %d, you currently carry %d.",PlayerHaul[tmpcar][pCapasity],PlayerHaul[tmpcar][pHeroin]);
SCM(playerid, COLOR_GREY, string);
return 1;
}
new cost = amount*compcost;
if(GetPlayerMoney(playerid) >= cost)
{
PlayerHaul[tmpcar][pHeroin] = amount;
format(string, sizeof(string), "Heroin: %d/%d.", PlayerHaul[tmpcar][pHeroin],PlayerHaul[tmpcar][pCapasity]);
SCM(playerid, TEAM_GROVE_COLOR, string);
format(string, sizeof(string), "You bought %d grams of heroin for $%d. please wait for it to load.", amount,cost);
SCM(playerid, TEAM_GROVE_COLOR, string);
SafeGivePlayerMoney(playerid,-cost);
TogglePlayerControllable(playerid, 0);
SetTimer("Unfreezeply", 10000, 0);
return 1;
}
else
{
format(string, sizeof(string), "You cant afford %d grams Heroin at $%d!", amount,cost);
SCM(playerid, TEAM_GROVE_COLOR, string);
return 1;
}
}
else
{
format(string, sizeof(string), "Heroin: %d/%d.", PlayerHaul[tmpcar][pHeroin],PlayerHaul[tmpcar][pCapasity]);
SCM(playerid, TEAM_GROVE_COLOR, string);
return 1;
}
}
else
{
SCM(playerid, TEAM_GROVE_COLOR, "This Vehicle does not deliver Heroin.");
return 1;
}
}
else
{
SCM(playerid, COLOR_GREY, "You are not in heroin place.");
return 1;
}
}
}
return 1;
}
if(PlayerHaul[tmpcar][pHeroin] < PlayerHaul[tmpcar][pCapasity])
if(PlayerHaul[playerid][pHeroin] < PlayerHaul[playerid][pCapasity])
I don't know what is the purpose of the enum PlayerHaul, but I believe it has something to do with players?
pawn Код:
pawn Код:
|
enum pHaul
{
pCapasity,
pMaterials,
pHeroin,
pIron,
pLoad,
};
new PlayerHaul[113][pHaul];
if(strcmp(cmd, "/loadheroin", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pJob] == 16)
{
new tmpcar = GetPlayerVehicleID(playerid);
if(IsPlayerInRangeOfPoint(playerid, 30, -2172.7830,-215.0502,35.3203))
{
if(GetVehicleModel(tmpcar) == 433 || GetVehicleModel(tmpcar) == 440 || GetVehicleModel(tmpcar) == 514 || GetVehicleModel(tmpcar) == 428 || GetVehicleModel(tmpcar) == 403 || GetVehicleModel(tmpcar) == 515)
{
if(PlayerHaul[tmpcar][pHeroin] < PlayerHaul[tmpcar][pCapasity])
{
new amount;
new compcost = 30;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SCM(playerid, COLOR_GRAD1, "USAGE: /loadheroin [amount]");
return 1;
}
amount = strval(tmp);
if(amount < 1 || amount > 100) { SCM(playerid, COLOR_GREY, " Can't buy less then 1 gram or more then 100!"); return 1; }
new check = PlayerHaul[tmpcar][pHeroin] + amount;
if(check > PlayerHaul[tmpcar][pCapasity])
{
format(string, sizeof(string), " You went over the Truck heroin Carry Limit of %d, you currently carry %d.",PlayerHaul[tmpcar][pCapasity],PlayerHaul[tmpcar][pHeroin]);
SCM(playerid, COLOR_GREY, string);
return 1;
}
new cost = amount*compcost;
if(GetPlayerMoney(playerid) >= cost)
{
PlayerHaul[tmpcar][pHeroin] = amount;
format(string, sizeof(string), "Heroin: %d/%d.", PlayerHaul[tmpcar][pHeroin],PlayerHaul[tmpcar][pCapasity]);
SCM(playerid, TEAM_GROVE_COLOR, string);
format(string, sizeof(string), "You bought %d grams of heroin for $%d. please wait for it to load.", amount,cost);
SCM(playerid, TEAM_GROVE_COLOR, string);
SafeGivePlayerMoney(playerid,-cost);
TogglePlayerControllable(playerid, 0);
SetTimer("Unfreezeply", 10000, 0);
return 1;
}
else
{
format(string, sizeof(string), "You cant afford %d grams Heroin at $%d!", amount,cost);
SCM(playerid, TEAM_GROVE_COLOR, string);
}
}
else
{
format(string, sizeof(string), "Heroin: %d/%d.", PlayerHaul[tmpcar][pHeroin],PlayerHaul[tmpcar][pCapasity]);
SCM(playerid, TEAM_GROVE_COLOR, string);
}
}
else
{
SCM(playerid, TEAM_GROVE_COLOR, "This Vehicle does not deliver Heroin.");
}
}
else
{
SCM(playerid, COLOR_GREY, "You are not in heroin place.");
}
}
}
return 1;
}
pawn Код:
|