Untitled
unknown
plain_text
2 months ago
15 kB
1
Indexable
Never
#include <YSI\YSI_Coding\y_hooks> //#include <YSI\y_hooks> #define DIALOG_JOB_PIZZA 3105 new nDPPizza = 0; // 0 : Giao vi tri co dinh | 1 : Giao vi tri = house new jobPizza = 5; enum E_PIZZA { pizzaStatus, pizzaAmount, pizzaGiaoBanh, pizzaMoney, pizzaVehicle, }; new PizzaInfo[MAX_PLAYERS][E_PIZZA]; new Float:PointPizzaLS[][4] = { {2135.827880, -1315.667114, 24.518321, 1.903822}, {2193.490722, -1278.601928, 24.661674, 226.960525}, {2389.240722, -1294.757202, 25.353956, 124.418472}, {2468.093750, -1296.399658, 29.828996, 90.264846}, {2501.791259, -1495.318359, 24.000000, 178.016220}, {1888.010986, -1116.735961, 25.273437, 221.610534}, {1921.934448, -1118.140502, 26.085937, 184.950180}, {2000.363403, -1117.590454, 26.781250, 180.458435}, {2087.926513, -1169.126586, 25.489664, 100.004165}, {2526.426513, -1034.539306, 69.578582, 178.369964}, {2671.776123, -1238.646850, 55.710636, 270.908569}, {1894.233276, -2135.854003, 15.162654, 180.957580}, {1781.306762, -2103.170654, 13.546875, 179.681015}, {1674.955200, -2120.784423, 13.546875, 313.870208}, {1667.535034, -2109.478759, 13.546875, 201.486984}, {1869.145263, -2037.077392, 13.546875, 277.314392}, {1863.9536, -1601.4451, 13.5455, 180.1412}, {980.45890, -1813.8331, 13.9737, 345.2250}, {1064.5179, -1131.5391, 23.8281, 178.2377}, {2145.0283, -1085.2521, 24.6917, 154.4034}, {2351.3228, -1169.3722, 28.0118, 354.2885}, {2374.0972, -1139.3608, 29.0588, 176.9193}, {2383.2510, -1366.2479, 24.4914, 84.3598}, {2488.0415, -1135.9165, 39.1792, 176.4783}, {2747.0078, -1609.4508, 13.0102, 88.3082}, {1044.5594, -1308.5437, 13.5469, 265.5287}, {853.04070, -1520.3749, 13.5547, 263.7741}, {1074.2513, -1581.6788, 13.5278, 355.8926} }; // --------------------------------------------------- /* Lay house random */ new saveHouseID[MAX_HOUSES]; new houseID = 0; stock countHouse() { new count = 0; for (new i = 0; i < MAX_HOUSES - 1; i++) { if(HouseInfo[i][hExteriorX] != 0.0) { saveHouseID[houseID] = i; houseID ++; count += 1; } } return count; } // -------------------------------------------------- CMD:giaobanh(playerid, params[]) { if(PlayerInfo[playerid][pJob] != jobPizza && PlayerInfo[playerid][pJob2] != jobPizza) { SendClientMessage(playerid, -1, "Ban chua nhan cong viec Pizza."); return 1; } if(!IsPlayerInAnyVehicle(playerid)) { SendClientMessage(playerid, -1, "Ban khong o tren phuong tien nao het."); return 1; } if(GetPlayerVehicleID(playerid) != PizzaInfo[playerid][pizzaVehicle]) { SendClientMessage(playerid, -1, "Ban da len nham phuong tien giao banh khong phai cua ban."); return 1; } if(PizzaInfo[playerid][pizzaGiaoBanh] == 1) { SendClientMessage(playerid, -1, "Ban dang trong qua trinh giao banh roi, vui long giao xong hoac huy bo van chuyen banh."); return 1; } if(countHouse() == 0) { SendClientMessage(playerid, -1, "Hien tai may chu chua co can nha nao het."); return 1; } if(nDPPizza == 0) { new rand = random(sizeof(PointPizzaLS)); SetPVarInt(playerid, "pizzaHouseID", rand); SetPlayerCheckpoint(playerid, PointPizzaLS[rand][0], PointPizzaLS[rand][1], PointPizzaLS[rand][2], 4.0); new string[1280]; format(string, sizeof(string), "Vi tri giao banh pizza da duoc danh dau, hay giao banh toi do ngay!."); SendClientMessage(playerid, -1, string); } else { new rand = random(countHouse()); SetPVarInt(playerid, "pizzaHouseID", rand); SetPlayerCheckpoint(playerid, HouseInfo[saveHouseID[rand]][hExteriorX], HouseInfo[saveHouseID[rand]][hExteriorY], HouseInfo[saveHouseID[rand]][hExteriorZ], 3.0); new string[1280]; format(string, sizeof(string), "Ban hay giao 1 chiec banh pizza, den can nha %d.", saveHouseID[rand]); SendClientMessage(playerid, -1, string); } PizzaInfo[playerid][pizzaGiaoBanh] = 1; return 1; } CMD:laybanh(playerid, params[]) { if(PlayerInfo[playerid][pJob] != jobPizza && PlayerInfo[playerid][pJob2] != jobPizza) { SendClientMessage(playerid, -1, "Ban chua nhan cong viec Pizza."); return 1; } new rand = GetPVarInt(playerid, "pizzaHouseID"); if(nDPPizza == 0) { if(IsPlayerInRangeOfPoint(playerid, 30.0, PointPizzaLS[rand][0], PointPizzaLS[rand][1], PointPizzaLS[rand][2])) { if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER || IsPlayerInAnyVehicle(playerid)) { SendClientMessage(playerid, -1, "{ff0000}[!]{FFFFFF} Ban dang o tren phuong tien, khong the lay banh duoc."); return 1; } if(GetPVarInt(playerid, "LayBanhDuaTao") == 0) { new Float:Pos[3]; GetVehiclePos(PizzaInfo[playerid][pizzaVehicle], Pos[0], Pos[1], Pos[2]); if(!IsPlayerInRangeOfPoint(playerid, 5.0, Pos[0], Pos[1], Pos[2])) { SendClientMessage(playerid, -1, "Ban khong o gan phuong tien giao banh pizza cua ban."); return 1; } SetPlayerAttachedObject( playerid, 0, 1582, 1, 0.002953, 0.469660, -0.009797, 269.851104, 88.443557, 0.000000, 0.804894, 1.000000, 0.822361 ); SetPlayerSpecialAction(playerid, SPECIAL_ACTION_CARRY); SetPVarInt(playerid, "LayBanhDuaTao", 1); SendClientMessage(playerid, COLOR_GREEN, "Ban da lay thanh cong mot chiec banh Pizza , hay giao cho khach hang."); return 1; } else SendClientMessage(playerid, COLOR_GREEN, "Ban da lay banh pizza truoc do roi , khong the lay tiep tuc."); } else { SendClientMessage(playerid, -1, "Ban can phai dung gan ngoi nha can van chuyen banh it nhan 30m."); } } else { if(IsPlayerInRangeOfPoint(playerid, 30.0, HouseInfo[saveHouseID[rand]][hExteriorX], HouseInfo[saveHouseID[rand]][hExteriorY], HouseInfo[saveHouseID[rand]][hExteriorZ])) { if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER || IsPlayerInAnyVehicle(playerid)) { SendClientMessage(playerid, -1, "{ff0000}[!]{FFFFFF} Ban dang o tren phuong tien, khong the lay banh duoc."); return 1; } if(GetPVarInt(playerid, "LayBanhDuaTao") == 0) { new Float:Pos[3]; GetVehiclePos(PizzaInfo[playerid][pizzaVehicle], Pos[0], Pos[1], Pos[2]); if(!IsPlayerInRangeOfPoint(playerid, 5.0, Pos[0], Pos[1], Pos[2])) { SendClientMessage(playerid, -1, "Ban khong o gan phuong tien giao banh pizza cua ban."); return 1; } SetPlayerAttachedObject( playerid, 0, 1582, 1, 0.002953, 0.469660, -0.009797, 269.851104, 88.443557, 0.000000, 0.804894, 1.000000, 0.822361 ); SetPlayerSpecialAction(playerid, SPECIAL_ACTION_CARRY); SetPVarInt(playerid, "LayBanhDuaTao", 1); SendClientMessage(playerid, COLOR_GREEN, "Ban da lay thanh cong mot chiec banh Pizza , hay giao cho khach hang."); return 1; } else SendClientMessage(playerid, COLOR_GREEN, "Ban da lay banh pizza truoc do roi , khong the lay tiep tuc."); } else { SendClientMessage(playerid, -1, "Ban can phai dung gan ngoi nha can van chuyen banh it nhan 30m."); } } return 1; } hook OnGameModeInit() { CreateDynamic3DTextLabel("{00ff00}Pizza Boy\n{ffffff}Su dung {789258}Y{ffffff} de xem viec.", -1, 2088.9136,-1807.3293,13.5469, 10.0); return 1; } hook OnPlayerEnterCheckpoint(playerid) { if(PizzaInfo[playerid][pizzaGiaoBanh] == 1) { new rand = GetPVarInt(playerid, "pizzaHouseID"); if(nDPPizza == 0) { if(IsPlayerInRangeOfPoint(playerid, 4.0, PointPizzaLS[rand][0], PointPizzaLS[rand][1], PointPizzaLS[rand][2])) { if(GetPVarInt(playerid, "LayBanhDuaTao") == 1) { new money = 100 + random(1000); PizzaInfo[playerid][pizzaAmount] -= 1; PizzaInfo[playerid][pizzaGiaoBanh] = 0; new string[1280]; format(string, sizeof(string), "Ban da giao thanh cong %d/10 banh pizza, lan giao banh nay ban nhan duoc %s$", (10 - PizzaInfo[playerid][pizzaAmount]), number_format(money)); SendClientMessage(playerid, COLOR_YELLOW, string); PizzaInfo[playerid][pizzaMoney] += money; DeletePVar(playerid, "LayBanhDuaTao"); DeletePVar(playerid, "pizzaHouseID"); RemovePlayerAttachedObject(playerid,0); SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE); DisablePlayerCheckpoint(playerid); if(PizzaInfo[playerid][pizzaAmount] == 0) { SendClientMessage(playerid, COLOR_YELLOW, "Ban da van chuyen thanh cong 10 banh pizza, bay gio hay quay ve tra xe va nhan thuong thoi nao."); SetPlayerCheckpoint(playerid, 2114.6863,-1778.5049,13.0945, 5.0); PizzaInfo[playerid][pizzaGiaoBanh] = 2; } else { if(nDPPizza == 0) { new rand = random(sizeof(PointPizzaLS)); SetPVarInt(playerid, "pizzaHouseID", rand); SetPlayerCheckpoint(playerid, PointPizzaLS[rand][0], PointPizzaLS[rand][1], PointPizzaLS[rand][2], 4.0); new string[1280]; format(string, sizeof(string), "Vi tri giao banh pizza da duoc danh dau, hay giao banh toi do ngay!."); SendClientMessage(playerid, -1, string); } else { new rand = random(countHouse()); SetPVarInt(playerid, "pizzaHouseID", rand); SetPlayerCheckpoint(playerid, HouseInfo[saveHouseID[rand]][hExteriorX], HouseInfo[saveHouseID[rand]][hExteriorY], HouseInfo[saveHouseID[rand]][hExteriorZ], 3.0); new string[1280]; format(string, sizeof(string), "Ban hay giao 1 chiec banh pizza, den can nha %d.", saveHouseID[rand]); SendClientMessage(playerid, -1, string); } } } else { SendClientMessage(playerid, -1, "Ban chua cam mot hop banh pizza nao de giao cho khach hang het, hay quay lai xe lay banh (( /laybanh ))."); } } } else { if(IsPlayerInRangeOfPoint(playerid, 4.0, HouseInfo[saveHouseID[rand]][hExteriorX], HouseInfo[saveHouseID[rand]][hExteriorY], HouseInfo[saveHouseID[rand]][hExteriorZ])) { if(GetPVarInt(playerid, "LayBanhDuaTao") == 1) { new money = 100 + random(1000); PizzaInfo[playerid][pizzaAmount] -= 1; PizzaInfo[playerid][pizzaGiaoBanh] = 0; new string[1280]; format(string, sizeof(string), "Ban da giao thanh cong %d/10 banh pizza, lan giao banh nay ban nhan duoc %s$", (10 - PizzaInfo[playerid][pizzaAmount]), number_format(money)); SendClientMessage(playerid, COLOR_YELLOW, string); PizzaInfo[playerid][pizzaMoney] += money; DeletePVar(playerid, "LayBanhDuaTao"); DeletePVar(playerid, "pizzaHouseID"); RemovePlayerAttachedObject(playerid,0); SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE); DisablePlayerCheckpoint(playerid); if(PizzaInfo[playerid][pizzaAmount] == 0) { SendClientMessage(playerid, COLOR_YELLOW, "Ban da van chuyen thanh cong 10 banh pizza, bay gio hay quay ve tra xe va nhan thuong thoi nao."); SetPlayerCheckpoint(playerid, 2114.6863,-1778.5049,13.0945, 5.0); PizzaInfo[playerid][pizzaGiaoBanh] = 2; } else { if(nDPPizza == 0) { new rand = random(sizeof(PointPizzaLS)); SetPVarInt(playerid, "pizzaHouseID", rand); SetPlayerCheckpoint(playerid, PointPizzaLS[rand][0], PointPizzaLS[rand][1], PointPizzaLS[rand][2], 4.0); new string[1280]; format(string, sizeof(string), "Vi tri giao banh pizza da duoc danh dau, hay giao banh toi do ngay!."); SendClientMessage(playerid, -1, string); } else { new rand = random(countHouse()); SetPVarInt(playerid, "pizzaHouseID", rand); SetPlayerCheckpoint(playerid, HouseInfo[saveHouseID[rand]][hExteriorX], HouseInfo[saveHouseID[rand]][hExteriorY], HouseInfo[saveHouseID[rand]][hExteriorZ], 3.0); new string[1280]; format(string, sizeof(string), "Ban hay giao 1 chiec banh pizza, den can nha %d.", saveHouseID[rand]); SendClientMessage(playerid, -1, string); } } } else { SendClientMessage(playerid, -1, "Ban chua cam mot hop banh pizza nao de giao cho khach hang het, hay quay lai xe lay banh (( /laybanh ))."); } } } } if(PizzaInfo[playerid][pizzaGiaoBanh] == 2) { if(IsPlayerInRangeOfPoint(playerid, 5.0, 2114.6863,-1778.5049,13.0945)) { DeletePVar(playerid, "LayBanhDuaTao"); DeletePVar(playerid, "pizzaHouseID"); PizzaInfo[playerid][pizzaStatus] = 0; PizzaInfo[playerid][pizzaAmount] = 0; RemovePlayerFromVehicle(playerid); DestroyVehicle(PizzaInfo[playerid][pizzaVehicle]); new string[1280]; format(string, sizeof(string), "Ban da hoan thanh cong viec xuat sac va nhan duoc tien thuong tu viec van chuyen banh la %s$", number_format(PizzaInfo[playerid][pizzaMoney])); SendClientMessage(playerid, COLOR_GREEN, string); PlayerInfo[playerid][pCash] += PizzaInfo[playerid][pizzaMoney]; PizzaInfo[playerid][pizzaMoney] = 0; RemovePlayerAttachedObject(playerid,0); SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE); DisablePlayerCheckpoint(playerid); return 1; } } return 1; } hook OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { if(newkeys & KEY_YES) { if(IsPlayerInRangeOfPoint(playerid, 2.0, 2088.9136,-1807.3293,13.5469)) { if(PlayerInfo[playerid][pJob] != jobPizza && PlayerInfo[playerid][pJob2] != jobPizza) ShowPlayerDialog(playerid, DIALOG_JOB_PIZZA, DIALOG_STYLE_LIST, "Cong viec", "> Xin viec\n> Nghi viec", "Chon", "Huy bo"); else ShowPlayerDialog(playerid, DIALOG_JOB_PIZZA, DIALOG_STYLE_LIST, "Cong viec", "> Xin viec\n> Nghi viec\n{ff0000}> Giao banh{FFFFFF}", "Chon", "Huy bo"); } } return 1; } hook OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { if(dialogid == DIALOG_JOB_PIZZA && response == 1) { if(listitem == 0) return 1; // Xin vi?c if(listitem == 1) return 1; // Ngh? vi?c if(listitem == 2) { // Giao bánh if(PizzaInfo[playerid][pizzaStatus] == 1) { SendClientMessage(playerid, -1, "Ban da nhan cong viec giao banh truoc do roi, khong the giao banh tiep tuc (( /huybo giaobanh ))."); return 1; } PizzaInfo[playerid][pizzaStatus] = 1; PizzaInfo[playerid][pizzaAmount] = 10; PizzaInfo[playerid][pizzaVehicle] = CreateVehicle(560, 2096.2087,-1817.0609,13.0881,89.2241, 3, 3, -1); IsPlayerEntering{playerid} = true; PutPlayerInVehicle(playerid, PizzaInfo[playerid][pizzaVehicle], 0); SetPlayerCheckpoint(playerid, 2096.2087,-1817.0609,13.0881, 5.0); CP[playerid] = 252000; SendClientMessage(playerid, -1, "Ban da lay thanh cong 10 banh pizza, hay giao banh ngay (( /giaobanh ))."); return 1; } } return 1; }