if(strcmp(cmd, "/loadmats", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new tmpcar = GetPlayerVehicleID(playerid);
new compcost = 30;
if(IsPlayerInRangeOfPoint(playerid, 20, -2687.8723,1413.9987,7.1016))
{
if(IsATruck(tmpcar) || IsATrailer(tmpcar))
{
if(PlayerHaul[tmpcar][pMaterials] < PlayerHaul[tmpcar][pCapasity])
{
new amount;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SCM(playerid, COLOR_GRAD1, "USAGE: /loadmats [amount]");
return 1;
}
amount = strval(tmp);
if(amount < 1 || amount > 100) { SCM(playerid, COLOR_GREY, " Can't buy less then 1 material or more then 100!"); return 1; }
new check = PlayerHaul[tmpcar][pMaterials] + amount;
if(check > PlayerHaul[tmpcar][pCapasity])
{
format(string, sizeof(string), " You went over the Truck Carry Limit of %d, you currently carry %d.",PlayerHaul[tmpcar][pCapasity],PlayerHaul[tmpcar][pMaterials]);
SCM(playerid, COLOR_GREY, string);
return 1;
}
new cost = amount*compcost;
if(GetPlayerMoney(playerid) >= cost)
{
PlayerHaul[tmpcar][pMaterials] = amount;
format(string, sizeof(string), "Materials: %d/%d.", PlayerHaul[tmpcar][pMaterials],PlayerHaul[tmpcar][pCapasity]);
SCM(playerid, TEAM_GROVE_COLOR, string);
format(string, sizeof(string), "You bought %d materials for $%d.", amount,cost);
SCM(playerid, TEAM_GROVE_COLOR, string);
SafeGivePlayerMoney(playerid,-cost);
return 1;
}
else
{
format(string, sizeof(string), "You cant afford %d Materials at $%d!", amount,cost);
SCM(playerid, TEAM_GROVE_COLOR, string);
return 1;
}
}
else
{
/*----->*/ SCM(playerid, TEAM_GROVE_COLOR,"A Truck can only carry 1-100, if you want to carry up too 1000 you will need a Trailer."); //This line comes when I try to use the cmd
return 1;
}
}
else
{
SCM(playerid, TEAM_GROVE_COLOR, "This Vehicle does not deliver materials.");
return 1;
}
}
else
{
SCM(playerid, COLOR_GREY, "You are not in materials place.");
return 1;
}
}
return 1;
}
/*for(new i=0; i < MAX_VEHICLES; i++)
{
if(IsATruck(i))
{
PlayerHaul[i][pCapacity] = 100;
}
else if(IsATrailer(i))
{
PlayerHaul[i][pCapacity] = 1000;
}
}*/
for(new i=0; i < MAX_VEHICLES; i++)
{
PlayerHaul[i][pCapacity] = 100;
}
public IsATruck(carid)
{
new m = GetVehicleModel(carid);
if(m == 433 || m == 403 || m == 406 || m == 482 || m == 440 || m == 408 || m == 414 || m == 443 || m == 456 || m == 455 || m == 498 || m == 499 || m == 514 || m == 515 || m == 609 || m == 413 || m == 428)
{
return 1;
}
return 0;
}
public IsATrailer(carid)
{
new m = GetVehicleModel(carid);
if(m == 435 || m == 450 || m == 591)
{
return 1;
}
return 0;
}
yes i have'nt any explication but i have fixed that probleme with changing || by && ^^
|