30.05.2014, 23:00
Hi guys. Few days ago i start with a GM (Raven's Roleplay's UnknowGamers' Edition) but i have a problem with the Trucker Job.
Here's the code:
In the game, when you are on those RangePoint and you are on a Truck; and you use the /buyprods cmd, nothing happens Something is wrong but i dont know what.
I hope your answers. Thanks a lots guys
Here's the code:
PHP код:
YCMD:buyprods(playerid, params[], help)
{
if(help) return SCM(playerid, COLOR_GREY, "Not supported");
if(IsPlayerConnected(playerid))
{
new string[256], amount, tmpcar = GetPlayerVehicleID(playerid), compcost = 20;
if(IsPlayerInRangeOfPoint(playerid, 70, 2468.4919,-2092.9902,13.5469))
{
if(IsATruck(tmpcar))
{
if(PlayerHaul[tmpcar][pLoad] < PlayerHaul[tmpcar][pCapasity])
{
if(sscanf(params, "d", amount))
{
SCM(playerid, COLOR_GRAD1, "USAGE: /buyprods [amount]");
return 1;
}
if(amount < 1 || amount > 500) { SCM(playerid, COLOR_GREY, " Can't buy less then 1 Product or more then 500!"); return 1; }
new check= PlayerHaul[tmpcar][pLoad] + amount;
if(check > PlayerHaul[tmpcar][pCapasity])
{
format(string, sizeof(string), " You went over the Truck Products Carry Limit of %d, you currently carry %d.",PlayerHaul[tmpcar][pCapasity],PlayerHaul[tmpcar][pLoad]);
SCM(playerid, COLOR_GREY, string);
return 1;
}
new cost = amount*compcost;
if(GetPlayerMoney(playerid) >= cost)
{
PlayerHaul[tmpcar][pLoad] += amount;
format(string, sizeof(string), "Products: %d/%d.", PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
SCM(playerid, TEAM_GROVE_COLOR, string);
format(string, sizeof(string), "You bought %d Products for $%d.", amount,cost);
SCM(playerid, TEAM_GROVE_COLOR, string);
SafeGivePlayerMoney(playerid,-cost);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
return 1;
}
else
{
format(string, sizeof(string), "You cant afford %d Products at $%d!", amount,cost);
SCM(playerid, TEAM_GROVE_COLOR, string);
return 1;
}
}
else
{
format(string, sizeof(string), "Products: %d/%d.", PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
SCM(playerid, TEAM_GROVE_COLOR, string);
return 1;
}
}
else
{
SCM(playerid, TEAM_GROVE_COLOR, "This Vehicle does not deliver Products.");
return 1;
}
}
else
{
SCM(playerid, COLOR_GREY, "You are not in trucker place.");
return 1;
}
}
return 1;
}
I hope your answers. Thanks a lots guys