19.10.2015, 16:34
Can someone please help me to find the mistake?
So, the problem is, params[0] acts weird... First of all it does not really check if params[0] is smaller or bigger then the allowed amount, also it takes less cash and less units then it should. I tried to debug it by printing the value of params[0], if the params are 20000, it would print that the params[0] value is 50... and i cant figure it out why.
HEres the code.
I am not rly changing the value of params anywhere...
So, the problem is, params[0] acts weird... First of all it does not really check if params[0] is smaller or bigger then the allowed amount, also it takes less cash and less units then it should. I tried to debug it by printing the value of params[0], if the params are 20000, it would print that the params[0] value is 50... and i cant figure it out why.
HEres the code.
Код:
CMD:loadtruck(playerid, params[])
{
if(PlayerLogged[playerid] == 0) return true;
if(PlayerInfo[playerid][pJob] != J_TRUCKER) return SendClientMessage(playerid, COLOR_GREY, "This job is not suitable for you");
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_GREY, "You need to be the driver");
if(IsPlayerInRangeOfPoint(playerid, 15.0 ,-2365.9382,-1362.3243,302.3563))
{
if(GetVehicleModel(GetPlayerVehicleID(playerid)) != 406) return SendClientMessage(playerid, COLOR_GREY, "you have to be in dumper");
if(params[0] > 20000 || params[0]< 1) return SendClientMessage(playerid, COLOR_GREY, "You can only load between 1 - 20000 units");
if(params[0] > RudaStock) return SendClientMessage(playerid, COLOR_GREY, "Not enough units");
if(GetMoney(playerid) < params[0]*2) return SendClientMessage(playerid, COLOR_GREY, "You dont have that much money.");
GiveMoney(playerid, -params[0]*2);
RudaStock = RudaStock - params[0];
format(string, 50, "Params[0] = i", params[0]);
SendClientMessage(playerid, COLOR_GREEN, string);
}
return 1;
}

