Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
1.8 kB
6
Indexable
stock buyFastFood(playerid, i) {
	if(PlayerInfo[playerid][pCash] < ThucAnInfo[i][food_giatien]) {
		SendClientMessage(playerid, -1, "{ff0000}[!]{FFFFFF} Ban khong du tien de mua thuc an nhanh nay.");
		return 1;
	}

	if(PlayerInfo[playerid][pDoiBung] > 100) {
		SendClientMessage(playerid, -1, "{ff0000}[!]{FFFFFF} Ban hien tai khong doi bung.");
		return 1;
	}

	PlayerInfo[playerid][pCash] -= ThucAnInfo[i][food_giatien];

	if(ThucAnInfo[i][food_loai] == 1) {
		PlayerInfo[playerid][pDoiBung] += ThucAnInfo[i][food_hoiphuc];
		ApplyAnimation(playerid, "FOOD", "EAT_Burger", 3.0, 1, 0, 0, 0, 0, 1);
	}else {
		PlayerInfo[playerid][pKhatNuoc] += ThucAnInfo[i][food_hoiphuc];
		ApplyAnimation(playerid, "PED", "WALK_DRUNK", 4.0, 1, 1, 1, 1, 1, 1);
	}

	if(PlayerInfo[playerid][pDoiBung] > 100) PlayerInfo[playerid][pDoiBung] = 100;

	SetPlayerProgressBarColor(playerid, PB_Hunger[playerid][0], COLOR_YELLOW);
	SetPlayerProgressBarValue(playerid, PB_Hunger[playerid][0], PlayerInfo[playerid][pDoiBung]);
	ShowPlayerProgressBar(playerid, PB_Hunger[playerid][0]);

	SetPlayerProgressBarColor(playerid, PB_Hunger[playerid][1], COLOR_GREEN);
	SetPlayerProgressBarValue(playerid, PB_Hunger[playerid][1], PlayerInfo[playerid][pKhatNuoc]);
	ShowPlayerProgressBar(playerid, PB_Hunger[playerid][1]);

	/*SetPlayerProgressBarColor(playerid, PB_Hunger[playerid][2], COLOR_RED);
	SetPlayerProgressBarValue(playerid, PB_Hunger[playerid][2], PlayerInfo[playerid][pBuonNgu]);
	ShowPlayerProgressBar(playerid, PB_Hunger[playerid][2]);*/

	new string[1280];
	format(string, sizeof(string), "Ban vua mua %s voi gia %s$ thanh cong.", ThucAnInfo[i][food_tenthucan], number_format(ThucAnInfo[i][food_giatien]));
	SendClientMessage(playerid, COLOR_YELLOW, string);
	return 1;
}
Leave a Comment