Untitled

 avatar
user_0390871
plain_text
a year ago
3.1 kB
1
Indexable
Never
#define 	POS_FARMER			-382.0112,-1441.1260,25.7266
#define bSEED_PRICE 5000

new Float:PosFarmer[][3] = {
	{-322.9297, -1421.7920, 14.6123},
	{-259.7950, -1409.7078, 9.6790},
	{-176.0775, -1402.0597, 3.0257},
	{-185.3857, -1358.3467, 4.3609},
	{-245.3685, -1366.4951, 9.8912},
	{-311.2144, -1369.3693, 9.4959},
	{-318.2766, -1331.7560, 9.1046},
	{-259.7927, -1326.1300, 8.9329},
	{-203.1490, -1326.6619, 9.4899},
	{-173.2914, -1312.6517, 5.2639},
	{-279.5865, -1318.6311, 9.1976}
};

CMD:muahatgiong(playerid)
{
	if(!Lock_Job) return SendClientMessage(playerid, -1, "[{AA3333}!{FFFFFF}] {FFFF00}JOB Nong Dan{FFFFFF} Dung Hoat Dong Tu 22h - 07h .");
	if(PlayerInfo[playerid][pJob] != 7 && PlayerInfo[playerid][pJob2] != 7) return SendClientMessage(playerid, COLOR_GREY, "Ban khong phai Nong Dan.");
	if(!IsPlayerInRangeOfPoint(playerid, 3.0, POS_bSEED_FARMER)) return SendClientMessage(playerid, COLOR_GREY, "Ban khong dung gan noi mua hat giong.");
	if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_GREY, "Ban phai ngoi tren xe cong nong de lam dieu nay.");
	if(!IsAFarmerCar(GetPlayerVehicleID(playerid), 1)) return SendClientMessage(playerid, COLOR_GREY, "Ban khong ngoi tren xe cong nong de gieo hat giong.");
	if(GetPVarInt(playerid, "Farmer_CP") != 0) return SendClientMessage(playerid, COLOR_GREY, "Ban dang lam gieo hat giong.");

	// ShowPlayerDialog(playerid, DIALOG_FARMER_BUYSEED, DIALOG_STYLE_MSGBOX, "Mua Hat Giong", "{FFFFFF}Ban muon mua 1 bao hat giong de gieo khong? Gia $5,000/bao", "Mua", "Thoat");
	ShowPlayerDialog(playerid, DIALOG_bSEED, DIALOG_STYLE_INPUT, "NONG DAN", "Mua hat giong de gieo trong !\n=====\nNhap vao so luong can mua", "Nhap", "Thoat");
	return 1;
}

stock OnDialogResponse()
{
	if(dialogid == DIALOG_bSEED)
    {
        if(response)
        {
            new amount = strval(inputtext);
            if(isnull(inputtext))
                SendClientMessageEx(playerid, -1, "Khong duoc bo trong !");
            else if(!IsNumeric(inputtext) || amount < 1 || amount > 101) 
                SendClientMessageEx(playerid, -1,  "Hay nhap so luong hat giong muon mua !");
            else if(PlayerInfo[playerid][pBSeed] < amount)
                SendClientMessageEx(playerid, -1,  "Ban khong co du so luong de ban !");
            else
            {
                new money = bSEED_PRICE * amount;
                GivePlayerCash(playerid, -money);
                PlayerInfo[playerid][pBSeed] += amount;
                SendClientMessage(playerid, -1, sprintf("Ban da mua %s hat giong voi gia $%s", number_format(amount), number_format(money)));
				SendClientMessageEx(playerid, -1, "Hay den dia diem mau do de bat dau gieo trong");
				SetPlayerCheckpoint(playerid, PosFarmer[cpid][0], PosFarmer[cpid][1], PosFarmer[cpid][2], 3.0);
				PlayerPlaySound(playerid, 1056, 0.0, 0.0, 0.0);
			}
        }
    }
	return 1;
}

stock OnplayerEnterCheckpoint(playerid)
{
	if(GetPVarInt(playerid, "FarmerJob") > 0)
	{
		
	}
	return 1;
}