12.05.2017, 20:59
I have a street sweeping job which players can earn money by cleaning streets. They get X money for every meter they clean.
I want also to give cookies, but i want to give 1 cookie every 1000 meters (1km) cleaned, how i can do it?
This is the reward code after a player finishes to clean streets:
I want also to give cookies, but i want to give 1 cookie every 1000 meters (1km) cleaned, how i can do it?
This is the reward code after a player finishes to clean streets:
pawn Код:
if(oldstate == PLAYER_STATE_DRIVER && SweeperJob[playerid])
{
new money = floatround(SweeperDistance[playerid] * MONEY_PER_METER), string[80];
format(string, sizeof(string), "~n~~n~~w~Distance Cleaned: ~b~~h~~h~%d Meters~n~~w~Earned ~g~~h~~h~%d$", SweeperDistance[playerid], money);
GameTextForPlayer(playerid, string, 3000, 3);
new buf[200];
format(buf, sizeof(buf), "~r~%s (%d) ~w~cleaned ~g~%d meters ~w~with Sweeper and earned ~g~%d$.", ReturnPlayerName(playerid), playerid, SweeperDistance[playerid], money);
SendBoxMessage(playerid, buf);
Player[playerid][Cookies] ++;
GivePlayerMoney(playerid, money);
Player[playerid][PSweeperDistance] += SweeperDistance[playerid];
Player[playerid][SweeperMoney] += money;
ResetSweeperInfo(playerid, true);
}