29.06.2013, 14:05
Okay, Im not sure if these are params witch will I ask you to help me with but if you get the idea I'd like you to help me
Here is the code (it works)
Now, what I want is that, I could use /loadlogs "1" or "2" or "3" up to 100. And if I typed "1" it would cost 300$ and I would get 850$ for it. I have no idea how to make this, so if you showed me how to make like one, or two I'll then make others myself, thanks in advance!
Here is the code (it works)
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/loadlogs", cmdtext, true, 10) == 0)
{
new cID = GetPlayerVehicleID(playerid);
if(CarInfo[cID][logloaded] == 0)
{
if(IsATruck(cID))
{
if(GetVehicleDistanceFromPoint(GetPlayerVehicleID(playerid), -1419.1344,-297.8153,13.6995) <= 10 )
{
CarInfo[cID][logloaded] = 1;
GivePlayerMoney(playerid, -3000);
SendClientMessage(playerid, COLOR_GREEN, "You've loaded your truck with logs, and paid 3000$ for it");
}
else return SendClientMessage(playerid, COLOR_RED, "You're not in range of loading point.");
}
else return SendClientMessage(playerid, COLOR_RED, "You're not in truck.");
}
else return SendClientMessage(playerid, COLOR_RED, "Your truck is loaded already, go and unload.");
return 1;
}
if (strcmp("/unloadlogs", cmdtext, true, 10) == 0)
{
new cID = GetPlayerVehicleID(playerid);
if(CarInfo[cID][logloaded] == 1)
{
if(GetVehicleDistanceFromPoint(GetPlayerVehicleID(playerid), 1529.6150,-1691.1863,13.0234) <= 10 )
{
new cash = random(15000-3000)+3000;
new string[128];
GivePlayerMoney(playerid, cash);
format(string,sizeof(string), "You've earned %i$ from the delivery.",cash);
CarInfo[cID][logloaded] = 0;
SendClientMessage(playerid, COLOR_GREEN, "You've unloaded your logs.");
SendClientMessage(playerid, COLOR_GREEN, string);
}
else return SendClientMessage(playerid, COLOR_RED, "You're not in range of unloading point.");
}
else return SendClientMessage(playerid, COLOR_RED, "Your truck is empety, go and load it first.");
return 1;
}
return 0;
}