Hay leute hab ein problem.
Und zwar geht es um den Job Firmenliferant.
wenn ich zB. "/buyprods 100" eingeben kommt immer nur Pordukte:0/0. wo liegt der fehler das ich keine Produkte Kaufen kann.
if(strcmp(cmd, "/buyprods", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pJob] != 8)
{
SendClientMessage(playerid, COLOR_GREY, " Du bist kein Trucker!");
return 1;
}
new tmpcar = GetPlayerVehicleID(playerid);
new compcost = 5;
if(IsPlayerInRangeOfPoint(playerid,60.0, 1691.0383,-1477.1121,13.4765) || IsPlayerInRangeOfPoint(playerid,40.0,1689.8845,-1459.6440,13.6405))
{
if(IsATruck(tmpcar))
{
if(PlayerHaul[tmpcar][pLoad] < PlayerHaul[tmpcar][pCapasity])
{
new amount;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_BIJELA1, "Verwendung: /buyprods [menge]");
return 1;
}
amount = strval(tmp);
if(amount < 1 || amount > 500) { SendClientMessage(playerid, COLOR_GREY, " Du kannst maximal 500 Produkte kaufen !"); return 1; }
new check= PlayerHaul[tmpcar][pLoad] + amount;
if(check > PlayerHaul[tmpcar][pCapasity])
{
format(string, sizeof(string), "Carry Limit: %d, derzeit trägst du: %d.",PlayerHaul[tmpcar][pCapasity],PlayerHaul[tmpcar][pLoad]);
SendClientMessage(playerid, COLOR_GREY, string);
return 1;
}
new cost = amount*compcost;
if(GetPlayerCash(playerid) >= cost)
{
PlayerHaul[tmpcar][pLoad] += amount;
format(string, sizeof(string), "Produkte: %d/%d.", PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
SendClientMessage(playerid, COLOR_ZELENA, string);
format(string, sizeof(string), "Du hast %d Produkte für €%d gekauft.", amount,cost);
SendClientMessage(playerid, COLOR_ZELENA, string);
GivePlayerCash(playerid,-cost);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
return 1;
}
else
{
format(string, sizeof(string), "Du kannst keine %d Produkte für €%d verkaufen !", amount,cost);
SendClientMessage(playerid, COLOR_ZELENA, string);
return 1;
}
}
else
{
format(string, sizeof(string), "Produkte: %d/%d.", PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
SendClientMessage(playerid, COLOR_ZELENA, string);
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_ZELENA, "Das ist kein LKW für Firmenlieferanten.");
return 1;
}
}
}
return 1;
}
mfg
Maik