Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
7.7 kB
10
Indexable
Never
#include <YSI\y_hooks>

	//-------------------------------------------------------------------
	//					Project create by #nDP 						   //
	//					Fb.com/nguyenduyphuong.com  			       //
	//					Copyright by nDP" 							   //
	//-------------------------------------------------------------------

//____________________________________________________________________________//

new NV_Pizza = 10;
new NV_Bocvac = 15;
new NV_CuaCay = 20;

CMD:nhiemvu(playerid, params[]) {
	if(PlayerInfo[playerid][pNhanThuongNV] == 1) {
		SendClientMessage(playerid, COLOR_RED, "> Ban da hoan thanh nhiem vu cua ngay hom nay roi, hay doi den hom sau va tiep tuc.");
		return 1;
	}
	ShowNhiemVu(playerid);
	return 1;
}

CMD:testnv(playerid, params[]) {
    PlayerInfo[playerid][pNV][0] = 2;
    PlayerInfo[playerid][pNV][1] = 2;
    PlayerInfo[playerid][pNV][2] = 2;
	return 1;
}

stock ShowNhiemVu(playerid) {
	new pizza[1280], trucker[1280], Khoangsan[1280];
	if(PlayerInfo[playerid][pNV_Pizza] < NV_Pizza)
	    format(pizza, sizeof(pizza), "%d/%d",PlayerInfo[playerid][pNV_Pizza], NV_Pizza);
	else
	    format(pizza, sizeof(pizza), "Da hoan thanh");
	    
	if(PlayerInfo[playerid][pNV_Bocvac] < NV_Bocvac)
	    format(trucker, sizeof(trucker), "%d/%d",PlayerInfo[playerid][pNV_Bocvac], NV_Bocvac);
	else
	    format(trucker, sizeof(trucker), "Da hoan thanh");
    
	if(PlayerInfo[playerid][pNV_CuaCay] < NV_CuaCay)
	    format(Khoangsan, sizeof(Khoangsan), "%d/%d",PlayerInfo[playerid][pNV_CuaCay], NV_CuaCay);
	else
	    format(Khoangsan, sizeof(Khoangsan), "Da hoan thanh");

	new str[2460], str1[2460], str2[2460], str3[2460], name[2460];
	format(str1, sizeof(str), "{ff8c1a}1.\tVan chuyen banh Pizza\t%d banh pizza\t%s    -    %s", NV_Pizza, TinhTrangNhiemVu(PlayerInfo[playerid][pNV][0]), pizza);
	format(str2, sizeof(str), "{ff8c1a}2.\tBoc vac hang hoa\t%d chuyen\t%s    -    %s", NV_Bocvac, TinhTrangNhiemVu(PlayerInfo[playerid][pNV][1]), trucker);
	format(str3, sizeof(str), "{ff8c1a}3.\tCua cay\t%d lan\t%s    -    %s", NV_CuaCay, TinhTrangNhiemVu(PlayerInfo[playerid][pNV][2]), Khoangsan);

	if(PlayerInfo[playerid][pNV][0] == 2 && PlayerInfo[playerid][pNV][1] == 2 && PlayerInfo[playerid][pNV][2] == 2)
		format(str, sizeof(str), "%s\n%s\n%s\n%s\n> {ff0000}Nhan thuong ngay{FFFFFF}", "ID\tTen nhiem vu\tSo luong\tTinh trang    -    Tien do",str1,str2,str3);
	else 
		format(str, sizeof(str), "%s\n%s\n%s\n%s\n%s", "ID\tTen nhiem vu\tSo luong\tTinh trang    -    Tien do",str1,str2,str3);
	
	format(name, sizeof(name), "{ffffff}He thong nhiem vu");
	ShowPlayerDialog(playerid, DIALOG_NHIEMVU, DIALOG_STYLE_TABLIST_HEADERS, name, str, "Dong y", "Huy Bo");
	return 1;
}

hook OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]){
    if(dialogid == DIALOG_NHIEMVU && response == 1){
    	if(listitem == 0) {
    		if(PlayerInfo[playerid][pNV][0] == 0){
	            PlayerInfo[playerid][pNV][0] = 1;
	            PlayerInfo[playerid][pNV_Pizza] = 0;
	            SendClientMessage(playerid, COLOR_YELLOW, "Ban da nhan nhiem vu nay thanh cong , vui long hoan thanh nhiem vu de nhan phan thuong.");
	            return 1;
	        }else SendClientMessage(playerid, COLOR_LIGHTGREEN, "Ban da nhan nhiem vu nay truoc do , khong the nhan tiep vui long hoan thanh nhiem vu.");
    	}   
    	if(listitem == 1) {
    		if(PlayerInfo[playerid][pNV][1] == 0){
	            PlayerInfo[playerid][pNV][1] = 1;
	            PlayerInfo[playerid][pNV_Bocvac] = 0;
	            SendClientMessage(playerid, COLOR_YELLOW, "Ban da nhan nhiem vu nay thanh cong , vui long hoan thanh nhiem vu de nhan phan thuong.");
	            return 1;
	        }else SendClientMessage(playerid, COLOR_LIGHTGREEN, "Ban da nhan nhiem vu nay truoc do , khong the nhan tiep vui long hoan thanh nhiem vu.");
    	}  
    	if(listitem == 2) {
    		if(PlayerInfo[playerid][pNV][2] == 0){
	            PlayerInfo[playerid][pNV][2] = 1;
	            PlayerInfo[playerid][pNV_CuaCay] = 0;
	            SendClientMessage(playerid, COLOR_YELLOW, "Ban da nhan nhiem vu nay thanh cong , vui long hoan thanh nhiem vu de nhan phan thuong.");
	            return 1;
	        }else SendClientMessage(playerid, COLOR_LIGHTGREEN, "Ban da nhan nhiem vu nay truoc do , khong the nhan tiep vui long hoan thanh nhiem vu.");
    	}
    	if(listitem == 3) {
    		if(PlayerInfo[playerid][pNhanThuongNV] == 1) {
    			SendClientMessage(playerid, COLOR_RED, "> Ban da nhan thuong nhiem vu cua ngay hom nay truoc do roi , khong the nhan tiep tuc.");
    			return 1;
    		}
    		SendClientMessage(playerid, COLOR_YELLOW, "Ban da hoan thanh tat ca nhiem vu cua ngay hom nay thanh cong.");
		    SendClientMessage(playerid, -1, "[PHAN THUONG] {00ff00}+150,000${FFFFFF} || {ff0000}3,000 vat lieu{FFFFFF}.");

            PlayerInfo[playerid][pCash] += 150000;
            PlayerInfo[playerid][pMats] += 3000;
            PlayerInfo[playerid][pNhanThuongNV] = 1;
    		return 1;
    	} 
	}
	return 1;
}

stock TinhTrangNhiemVu(idnv){
	new name[1280];
	switch(idnv){
		case 0: name = "Chua dang ky";
		case 1: name = "Da dang ky";
		case 2: name = "Da hoan thanh";
	}
	return name;
}

stock CheckNV_Pizza(playerid) {
	if(PlayerInfo[playerid][pNV][0] == 1){
	    PlayerInfo[playerid][pNV_Pizza] += 1;
	    if(PlayerInfo[playerid][pNV_Pizza] == NV_Pizza) {
	    	PlayerInfo[playerid][pNV][0] = 2;
	    	SendClientMessage(playerid, COLOR_YELLOW, "[NHIEM VU HANG NGAY] Ban da hoan thanh nhiem vu.");
	    	return 1;
	    }
 	    new thongbao[1280];
        format(thongbao, sizeof(thongbao), "[NHIEM VU HANG NGAY] Ban da hoan thanh [%d / %d] trong nhiem vu giao Pizza.", PlayerInfo[playerid][pNV_Pizza], NV_Pizza);
        SendClientMessage(playerid, COLOR_YELLOW, thongbao);
		return 1;
	}
	return 1;
}

stock CheckNV_Bocvac(playerid) {
	if(PlayerInfo[playerid][pNV][1] == 1){
	    PlayerInfo[playerid][pNV_Bocvac] += 1;
	    if(PlayerInfo[playerid][pNV_Bocvac] == NV_Bocvac) {
	    	PlayerInfo[playerid][pNV][1] = 2;
	    	SendClientMessage(playerid, COLOR_YELLOW, "[NHIEM VU HANG NGAY] Ban da hoan thanh nhiem vu.");
	    	return 1;
	    }
	    new thongbao[1280];
        format(thongbao, sizeof(thongbao), "[NHIEM VU HANG NGAY] Ban da hoan thanh [%d / %d] trong nhiem vu boc vac.", PlayerInfo[playerid][pNV_Bocvac], NV_Bocvac);
        SendClientMessage(playerid, COLOR_YELLOW, thongbao);
		return 1;
	}
	return 1;
}

stock CheckNV_CuaCay(playerid) {
	if(PlayerInfo[playerid][pNV][2] == 1){
	    PlayerInfo[playerid][pNV_CuaCay] += 1;
	    if(PlayerInfo[playerid][pNV_CuaCay] == NV_CuaCay) {
	    	PlayerInfo[playerid][pNV][2] = 2;
	    	SendClientMessage(playerid, COLOR_YELLOW, "[NHIEM VU HANG NGAY] Ban da hoan thanh nhiem vu.");
	    	return 1;
	    }
	    new thongbao[1280];
        format(thongbao, sizeof(thongbao), "[NHIEM VU HANG NGAY] Ban da hoan thanh [%d / %d] trong nhiem vu ve sinh moi truong.", PlayerInfo[playerid][pNV_CuaCay], NV_CuaCay);
        SendClientMessage(playerid, COLOR_YELLOW, thongbao);
		return 1;
	}
	return 1;
}

GetDate_VZZZ(&day, &month, &year)
{
   getdate(year, month, day);
}

forward ResetNhiemVu(playerid);
public ResetNhiemVu(playerid)
{
	new d, m, y;
	GetDate_VZZZ(d, m, y);
	if(d != PlayerInfo[playerid][pDateNV])
	{
		PlayerInfo[playerid][pDateNV] = d;
		PlayerInfo[playerid][pNV][0] = 0;
		PlayerInfo[playerid][pNV][1] = 0;
		PlayerInfo[playerid][pNV][2] = 0;
		PlayerInfo[playerid][pNV_Pizza] = 0;
		PlayerInfo[playerid][pNV_Bocvac] = 0;
		PlayerInfo[playerid][pNV_CuaCay] = 0;
		PlayerInfo[playerid][pNhanThuongNV] = 0;
	}
	return 1;
}
Leave a Comment