Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Created by: StaLpu
- Credits: Stalpu
- */
- // Colors
- #define COLOR_WHITE 0xFFFFFFFF
- #define COLOR_LIGHTGREEN 0xAFFFA1FF
- // Dialogs
- #define DIALOG_STATUS (333)
- #define DIALOG_JOB (334)
- // Variables
- new Float:HousePos[16][3] = {
- {2013.6630, -1656.3639, 14.0733},
- {2018.2024, -1629.8944, 14.0733},
- {1980.9697, -1719.0088, 17.0321},
- {2066.9150, -1731.6338, 14.0879},
- {2067.4844, -1643.7155, 14.0866},
- {1853.9839, -1914.2035, 15.2474},
- {1938.5319, -1911.3409, 15.1402},
- {1928.5387, -1916.0127, 15.2403},
- {2238.3540, -1906.7906, 14.9349},
- {2307.0564, -1679.1633, 14.2915},
- {2326.7124, -1716.8486, 13.8206},
- {2385.3164, -1711.6276, 14.1911},
- {2696.3904, -1990.4764, 14.1993},
- {2787.2646, -1926.0974, 13.5604},
- {1872.4790, -2132.6597, 15.5008},
- {1667.4546, -2106.8040, 14.0209}
- };
- new
- Timer[MAX_PLAYERS],
- Working[MAX_PLAYERS],
- Gifts[MAX_PLAYERS],
- TotalGifts[MAX_PLAYERS],
- GiftHand[MAX_PLAYERS],
- Vehicle[MAX_PLAYERS],
- Checkpoint[MAX_PLAYERS],
- PlayerText: InfoTD,
- jobVehicles[6],
- jobActor,
- jobPickup;
- public OnGameModeInit() {
- jobActor = CreateActor(112, 2244.5381, -2193.9580, 13.5469, 78.8678);
- SetActorInvulnerable(jobActor, true);
- ApplyActorAnimation(jobActor, "COP_AMBIENT", "Coplook_loop", 4.0, 0, 1, 1, 1, -1);
- jobPickup = CreatePickup(1239, 23, 2243.8152,-2193.8157,13.5469);
- Create3DTextLabel("/startwork", 0x0062FF99, 2243.8152,-2193.8157,13.5469, 10.0, 0);
- jobVehicles[0] = CreateVehicle(482, 2251.4128, -2186.0459, 13.6538, 134.9000, 3, 1, -1);
- jobVehicles[1] = CreateVehicle(482, 2224.4158, -2159.3484, 13.6538, 135.0000, 3, 1, -1);
- jobVehicles[2] = CreateVehicle(482, 2229.6980, -2164.4678, 13.6538, 135.0000, 3, 1, -1);
- jobVehicles[3] = CreateVehicle(482, 2235.2888, -2169.8135, 13.6538, 135.0000, 3, 1, -1);
- jobVehicles[4] = CreateVehicle(482, 2240.5559, -2175.1892, 13.6538, 135.0000, 3, 1, -1);
- jobVehicles[5] = CreateVehicle(482, 2245.7339, -2180.4153, 13.6538, 135.0000, 3, 1, -1);
- CreateObject(19059, 2253.40039, -2183.45166, 17.46260, 0.00000, 90.00000, 45.00000);
- CreateObject(19059, 2226.90356, -2156.94824, 17.46259, 0.00000, 90.00000, 45.00000);
- CreateObject(19060, 2232.17334, -2162.20068, 17.46260, 0.00000, 90.00000, 45.00000);
- CreateObject(19061, 2237.51318, -2167.51025, 17.46260, 0.00000, 90.00000, 45.00000);
- CreateObject(19062, 2242.76733, -2172.80518, 17.46260, 0.00000, 90.00000, 45.00000);
- CreateObject(19063, 2248.10010, -2178.14355, 17.46260, 0.00000, 90.00000, 45.00000);
- CreateObject(2510, 2244.32959, -2186.91162, 20.80740, 0.00000, 0.00000, 90.00000);
- CreateObject(2510, 2225.16260, -2166.36548, 20.80740, 0.00000, 0.00000, 0.00000);
- CreateObject(2510, 2233.41479, -2181.15625, 20.80740, 0.00000, 0.00000, 45.00000);
- CreateObject(1568, 2213.29590, -2165.32520, 13.34210, 0.00000, 0.00000, 0.00000);
- CreateObject(1568, 2244.87207, -2196.93555, 13.34215, 0.00000, 0.00000, 0.00000);
- CreateObject(1568, 2243.37622, -2177.72583, 12.54010, 0.00000, 0.00000, 0.00000);
- CreateObject(1568, 2237.82471, -2172.34839, 12.54010, 0.00000, 0.00000, 0.00000);
- CreateObject(1568, 2232.51343, -2167.08398, 12.54010, 0.00000, 0.00000, 0.00000);
- CreateObject(1568, 2248.67065, -2182.95654, 12.54014, 0.00000, 0.00000, 0.00000);
- CreateObject(1568, 2226.98999, -2161.66821, 12.54010, 0.00000, 0.00000, 0.00000);
- CreateObject(19057, 2786.34985, -2446.70923, 13.13820, 0.00000, 0.00000, 0.00000);
- CreateObject(19054, 2789.31738, -2446.70923, 13.13820, 0.00000, 0.00000, 0.00000);
- CreateObject(19056, 2787.84570, -2446.70923, 13.13820, 0.00000, 0.00000, 0.00000);
- CreateObject(19054, 2789.31738, -2449.86206, 13.13820, 0.00000, 0.00000, 0.00000);
- CreateObject(19057, 2789.31738, -2448.29248, 13.13820, 0.00000, 0.00000, 0.00000);
- CreateObject(19056, 2777.63428, -2462.71924, 13.13820, 0.00000, 0.00000, 359.89999);
- CreateObject(19055, 2786.34985, -2448.29248, 13.13820, 0.00000, 0.00000, 0.00000);
- CreateObject(19055, 2787.84570, -2449.86206, 13.13820, 0.00000, 0.00000, 0.00000);
- CreateObject(19058, 2787.84570, -2448.29248, 13.13820, 0.00000, 0.00000, 0.00000);
- CreateObject(19057, 2789.31738, -2464.06738, 13.13820, 0.00000, 0.00000, 0.00000);
- CreateObject(19054, 2789.31738, -2465.52002, 13.13816, 0.00000, 0.00000, 0.00000);
- CreateObject(19054, 2789.31738, -2462.62280, 13.13820, 0.00000, 0.00000, 0.00000);
- CreateObject(19056, 2787.84570, -2462.62280, 13.13820, 0.00000, 0.00000, 0.00000);
- CreateObject(19058, 2787.84570, -2464.06738, 13.13820, 0.00000, 0.00000, 0.00000);
- CreateObject(19055, 2787.84570, -2465.52002, 13.13820, 0.00000, 0.00000, 0.00000);
- CreateObject(19056, 2786.34985, -2465.52002, 13.13820, 0.00000, 0.00000, 0.00000);
- CreateObject(19055, 2786.34985, -2464.06738, 13.13820, 0.00000, 0.00000, 0.00000);
- CreateObject(19057, 2786.34985, -2462.62280, 13.13820, 0.00000, 0.00000, 0.00000);
- CreateObject(2510, 2773.17163, -2456.02759, 17.16240, 0.00000, -10.00000, -90.00000);
- CreateObject(1568, 2773.80566, -2461.31982, 12.63910, 0.00000, 0.00000, 0.00000);
- CreateObject(1568, 2773.80566, -2450.53760, 12.63907, 0.00000, 0.00000, 0.00000);
- CreateObject(19056, 2786.34985, -2449.86206, 13.13820, 0.00000, 0.00000, 0.00000);
- CreateObject(19055, 2778.33594, -2447.31152, 13.13820, 0.00000, 0.00000, 0.00000);
- CreateObject(19056, 2780.14063, -2446.76660, 13.13820, 0.00000, 0.00000, 0.00000);
- CreateObject(19057, 2779.72119, -2448.80005, 13.13820, 0.00000, 0.00000, 0.00000);
- CreateObject(19057, 2780.64990, -2464.70923, 13.13820, 0.00000, 0.00000, 0.00000);
- CreateObject(19058, 2778.50708, -2464.92896, 13.13820, 0.00000, 0.00000, 359.89999);
- CreateObject(19055, 2779.95483, -2462.62939, 13.13820, 0.00000, 0.00000, 359.89999);
- CreateObject(2469, 2791.98853, -2461.35938, 14.27980, 0.00000, 0.00000, 180.00000);
- CreateObject(2464, 2783.76294, -2461.34741, 14.45417, 0.00000, 0.00000, 0.00000);
- CreateObject(2469, 2783.71924, -2450.59106, 14.32223, 0.00000, 0.00000, 0.00000);
- CreateObject(2464, 2783.71167, -2450.90771, 12.84029, 0.00000, 0.00000, 0.00000);
- CreateObject(2480, 2783.78296, -2450.94409, 15.75139, 0.00000, 0.00000, 0.00000);
- CreateObject(2474, 2791.78979, -2450.48413, 12.74016, 0.00000, 0.00000, 0.00000);
- CreateObject(2464, 2791.92749, -2450.95142, 15.24909, 0.00000, 0.00000, 0.00000);
- CreateObject(2485, 2792.01172, -2451.08716, 14.32813, 0.00000, 0.00000, 0.00000);
- CreateObject(2466, 2783.76294, -2461.34741, 13.65120, 0.00000, 0.00000, 180.00000);
- CreateObject(2468, 2791.80713, -2461.36426, 13.43120, 0.00000, 0.00000, 180.00000);
- CreateObject(2484, 2794.80347, -2448.80249, 13.52007, 0.00000, 0.00000, 45.00000);
- CreateObject(2492, 2794.05786, -2466.00391, 13.73340, 0.00000, 0.00000, -135.00000);
- CreateObject(2493, 2793.82397, -2465.78564, 13.73340, 0.00000, 0.00000, 45.00000);
- CreateObject(2494, 2794.05420, -2465.77173, 13.73340, 0.00000, 0.00000, -45.00000);
- CreateObject(2491, 2793.93652, -2465.53589, 12.73470, 0.00000, 0.00000, 45.00000);
- SetTimer("jobCheck", 1000, true);
- print("\nJob Christmass loaded...");
- print("Credits: Edison, Valentino.");
- return 1;
- }
- public OnPlayerConnect(playerid) {
- Working[playerid] = -1;
- Gifts[playerid] = 0;
- Checkpoint[playerid] = -1;
- TotalGifts[playerid] = 0;
- InfoTD = CreatePlayerTextDraw(playerid, 173.821395, 374.500091, "");
- PlayerTextDrawLetterSize(playerid, InfoTD, 0.256500, 1.279167);
- PlayerTextDrawAlignment(playerid, InfoTD, 1);
- PlayerTextDrawColor(playerid, InfoTD, -1);
- PlayerTextDrawSetShadow(playerid, InfoTD, 0);
- PlayerTextDrawSetOutline(playerid, InfoTD, 1);
- PlayerTextDrawBackgroundColor(playerid, InfoTD, 51);
- PlayerTextDrawFont(playerid, InfoTD, 1);
- PlayerTextDrawSetProportional(playerid, InfoTD, 1);
- RemoveBuildingForPlayer(playerid, 3744, 2241.2969, -2183.9766, 15.1016, 0.25);
- RemoveBuildingForPlayer(playerid, 3744, 2226.3203, -2168.9922, 15.1016, 0.25);
- RemoveBuildingForPlayer(playerid, 1226, 2224.7813, -2185.7422, 16.3516, 0.25);
- RemoveBuildingForPlayer(playerid, 3574, 2226.3203, -2168.9922, 15.1016, 0.25);
- RemoveBuildingForPlayer(playerid, 3574, 2241.2969, -2183.9766, 15.1016, 0.25);
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason) {
- JobFailed(playerid);
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[]) {
- if(strcmp("/stopwork", cmdtext, true, 10) == 0)
- {
- if(Working[playerid] == -1) return 1;
- DisablePlayerCheckpoint(playerid);
- Working[playerid] = -1;
- Gifts[playerid] = 0;
- Checkpoint[playerid] = -1;
- TotalGifts[playerid] = 0;
- if(Vehicle[playerid] != -1) SetVehicleToRespawn(Vehicle[playerid]);
- Vehicle[playerid] = -1;
- SendClientMessage(playerid, COLOR_WHITE, "Stop working...");
- if(Timer[playerid] >= 1) { Timer[playerid] = -1; PlayerTextDrawHide(playerid, InfoTD); }
- return 1;
- }
- return 0;
- }
- public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger) {
- if(vehicleid == jobVehicles[0] || vehicleid == jobVehicles[1] || vehicleid == jobVehicles[2] || vehicleid == jobVehicles[3] || vehicleid == jobVehicles[4] || vehicleid == jobVehicles[5]) {
- if(Working[playerid] == -1) {
- new Float: Position[3];
- GetPlayerPos(playerid, Position[0], Position[1], Position[2]);
- SetPlayerPos(playerid, Position[0], Position[1], Position[2]+1);
- SendClientMessage(playerid, COLOR_WHITE, "You do not work!");
- }
- else {
- if(Timer[playerid] >= 1) { Timer[playerid] = -1; PlayerTextDrawHide(playerid, InfoTD); }
- }
- }
- return 1;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) {
- new string[256];
- if(newkeys == KEY_NO) {
- if(Working[playerid] == -1) return 1;
- if(IsPlayerInAnyVehicle(playerid)) return 1;
- if(Vehicle[playerid] == -1 && Working[playerid] == 1) return SendClientMessage(playerid, COLOR_LIGHTGREEN, "* You must to climb in a vehicle and after upload gifts.");
- if(CheckPlayerDistanceToVehicle(5.0, playerid, Vehicle[playerid])) {
- RemovePlayerAttachedObject(playerid, 5);
- if(TotalGifts[playerid] == 0) return 1;
- if(GiftHand[playerid] == -1) {
- GiftHand[playerid] = 1;
- SetPlayerSpecialAction(playerid, SPECIAL_ACTION_CARRY);
- new rand = random(4), gift;
- if(rand == 0) gift = 19054;
- else if(rand == 1) gift = 19055;
- else if(rand == 2) gift = 19056;
- else if(rand == 3) gift = 19057;
- else if(rand == 4) gift = 19058;
- SetPlayerAttachedObject( playerid, 5, gift, 1, 0.179536, 0.436568, -0.047055, 0.000000, 84.821968, 77.998138, 0.405070, 1.000000, 0.225547 );
- SendClientMessage(playerid, COLOR_WHITE, "* You have took one gift from your vehicle!");
- }
- else if(GiftHand[playerid] == 1) {
- GiftHand[playerid] = -1;
- RemovePlayerAttachedObject(playerid, 5);
- SetPlayerSpecialAction(playerid, 0);
- SendClientMessage(playerid, COLOR_WHITE, "* You have put the gift in your vehicle!");
- if(TotalGifts[playerid] < 9 && Checkpoint[playerid] == -1) {
- format(string, sizeof(string), "{FFBC63}Want to get gifts?\nCurrently, you have only {94FF63}%d gifts{FFFFFF}.", TotalGifts[playerid]);
- ShowPlayerDialog(playerid, DIALOG_STATUS, DIALOG_STYLE_MSGBOX, " ", string, "Yes", "No");
- }
- if(Gifts[playerid] == 10) {
- format(string, sizeof(string), "{FFBC63}Congratulations, {638DFF}%s{FFBC63}!\nYou have {94FF63}finished{FFBC63} the step one. Next step consist to distrbuite gifts on different houses. Success!", GetName(playerid));
- ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, " ", string, "Okay", "");
- new rand = random(sizeof(HousePos));
- SetPlayerCheckpoint(playerid, HousePos[rand][0] ,HousePos[rand][1], HousePos[rand][2], 2.0);
- format(string, sizeof(string), "You have still %d gifts distributed! Distance: %0.2fm", Gifts[playerid], GetPlayerDistanceFromPoint(playerid, HousePos[rand][0] ,HousePos[rand][1], HousePos[rand][2]));
- SendClientMessage(playerid, 0xFFFF00FF, string);
- Checkpoint[playerid] = 1;
- }
- }
- }
- else if(IsPlayerInRangeOfPoint(playerid, 5.0,2779.7212, -2448.8000, 13.1382) || IsPlayerInRangeOfPoint(playerid, 5.0,2787.8457, -2449.8621, 13.1382)
- || IsPlayerInRangeOfPoint(playerid, 5.0,2787.8457, -2462.6228, 13.1382) || IsPlayerInRangeOfPoint(playerid, 5.0,2779.9548, -2462.6294, 13.1382)) {
- if(Gifts[playerid] == 10) return SendClientMessage(playerid, COLOR_LIGHTGREEN, "* You have a maximum gifts (10).");
- if(GiftHand[playerid] == 1) return SendClientMessage(playerid, COLOR_LIGHTGREEN, "* You already have a gift in your hands!");
- Gifts[playerid] ++;
- TotalGifts[playerid] ++;
- new rand = random(4), gift;
- if(rand == 0) gift = 19054;
- else if(rand == 1) gift = 19055;
- else if(rand == 2) gift = 19056;
- else if(rand == 3) gift = 19057;
- else if(rand == 4) gift = 19058;
- SetPlayerAttachedObject( playerid, 5, gift, 1, 0.179536, 0.436568, -0.047055, 0.000000, 84.821968, 77.998138, 0.405070, 1.000000, 0.225547 );
- SetPlayerSpecialAction(playerid, SPECIAL_ACTION_CARRY);
- GiftHand[playerid] = 1;
- }
- }
- return 1;
- }
- public OnPlayerExitVehicle(playerid, vehicleid) {
- if(Working[playerid] == 1 && TotalGifts[playerid] >= 1 && vehicleid == jobVehicles[0] || vehicleid == jobVehicles[1] || vehicleid == jobVehicles[2] || vehicleid == jobVehicles[3] || vehicleid == jobVehicles[4] || vehicleid == jobVehicles[5] && Gifts[playerid] != 0) {
- SendClientMessage(playerid, COLOR_WHITE, "You have one minute to distribute gift on the checkpoint!");
- Timer[playerid] = 60;
- PlayerTextDrawSetString(playerid, InfoTD, "~y~Gift Distributor~w~~h~~n~You have 60 seconds until you enter in the vehicle.");
- PlayerTextDrawShow(playerid, InfoTD);
- }
- return 1;
- }
- public OnPlayerStateChange(playerid, newstate, oldstate) {
- if(newstate == PLAYER_STATE_DRIVER) {
- new vehicleid = GetPlayerVehicleID(playerid);
- if(vehicleid == jobVehicles[0] || vehicleid == jobVehicles[1] || vehicleid == jobVehicles[2] || vehicleid == jobVehicles[3] || vehicleid == jobVehicles[4] || vehicleid == jobVehicles[5] && Gifts[playerid] == 0) {
- if(TotalGifts[playerid] != 0) return 1;
- Vehicle[playerid] = vehicleid;
- SendClientMessage(playerid, COLOR_WHITE, "Go to red checkpoint to load gifts!");
- SetPlayerCheckpoint(playerid, 2774.2368, -2455.7124, 12.6391, 8.0);
- Checkpoint[playerid] = 3;
- }
- }
- return 1;
- }
- public OnPlayerEnterCheckpoint(playerid) {
- new string[256];
- if(Checkpoint[playerid] == 1) {
- if(GiftHand[playerid] == -1) return SendClientMessage(playerid, COLOR_LIGHTGREEN, "* You do not have a gift in your hands!");
- DisablePlayerCheckpoint(playerid);
- SetPlayerSpecialAction(playerid, 0);
- Gifts[playerid] --;
- GiftHand[playerid] = -1;
- RemovePlayerAttachedObject(playerid, 5);
- new rand = random(sizeof(HousePos));
- SetPlayerCheckpoint(playerid, HousePos[rand][0] ,HousePos[rand][1], HousePos[rand][2], 2.0);
- if(Gifts[playerid] != 0) {
- Checkpoint[playerid] = 1;
- format(string, sizeof(string), "You have still %d gifts distributed! Distance: %0.2fm", Gifts[playerid], GetPlayerDistanceFromPoint(playerid, HousePos[rand][0] ,HousePos[rand][1], HousePos[rand][2]));
- SendClientMessage(playerid, 0xFFFF00FF, string);
- }
- // de terminat
- if(Gifts[playerid] == 0) {
- Gifts[playerid] = -1;
- DisablePlayerCheckpoint(playerid);
- SetPlayerCheckpoint(playerid, 2251.8628, -2206.0054, 13.4719, 9.0);
- Checkpoint[playerid] = 2;
- format(string, sizeof(string), "{FFBC63}Congratulations, {638DFF}%s{FFBC63}!\nYou have {94FF63}finished{FFBC63} the step two. The last step is to go to the checkpoint to take the money!", GetName(playerid));
- ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, " ", string, "Okay", "");
- }
- return 1;
- }
- if(Checkpoint[playerid] == 2) {
- if(IsPlayerInVehicle(playerid, Vehicle[playerid])) SetVehicleToRespawn(Vehicle[playerid]);
- DisablePlayerCheckpoint(playerid);
- new money = 1000 + random(500) * TotalGifts[playerid];
- format(string, sizeof(string), "You delivered %d gifts.", TotalGifts[playerid]);
- SendClientMessage(playerid, 0x25B336FF, string);
- format(string, sizeof(string), "Congratulations, you have earned $%d.", money);
- SendClientMessage(playerid, 0x25B336FF, string);
- GivePlayerMoney(playerid, money);
- TotalGifts[playerid] = 0;
- Checkpoint[playerid] = -1;
- Working[playerid] = -1;
- return 1;
- }
- if(Checkpoint[playerid] == 3) {
- DisablePlayerCheckpoint(playerid);
- SendClientMessage(playerid, COLOR_LIGHTGREEN, "* Go to gifts and use key N to load a gift!");
- Checkpoint[playerid] = -1;
- return 1;
- }
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
- new string[256];
- switch(dialogid) {
- case DIALOG_STATUS: {
- if(response) return SendClientMessage(playerid, COLOR_LIGHTGREEN, "* Continue to take gifts!");
- format(string, sizeof(string), "{FFBC63}Congratulations, {638DFF}%s{FFBC63}!\nYou have {94FF63}finished{FFBC63} the step one. Next step consist to distrbuite gifts on different houses. Success!", GetName(playerid));
- ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, " ", string, "Okay", "");
- new rand = random(sizeof(HousePos));
- SetPlayerCheckpoint(playerid, HousePos[rand][0] ,HousePos[rand][1], HousePos[rand][2], 2.0);
- format(string, sizeof(string), "You have still %d gifts distributed! Distance: %0.2fm", Gifts[playerid], GetPlayerDistanceFromPoint(playerid, HousePos[rand][0] ,HousePos[rand][1], HousePos[rand][2]));
- SendClientMessage(playerid, 0xFFFF00FF, string);
- Checkpoint[playerid] = 1;
- }
- case DIALOG_JOB: {
- if(!response) return 1;
- if(Working[playerid] == 1) return 1;
- Working[playerid] = 1;
- TotalGifts[playerid] = 0;
- Gifts[playerid] = 0;
- SendClientMessage(playerid, COLOR_LIGHTGREEN, "* Congratulations! Now you can working on job.");
- }
- }
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- SetPlayerPos(playerid, 2224.7813, -2185.7422, 16.3516);
- return 1;
- }
- public OnPlayerPickUpPickup(playerid, pickupid)
- {
- if(pickupid == jobPickup) {
- if(Working[playerid] == 1) return 1;
- new string[1024];
- strcat(string, "{FFBC63}Welcome to job {638DFF}Gift Distribuitor{FFBC63}!\n\nInformations:\n{638DFF}•{FFBC63} There are two steps to this job.\n{638DFF}•{FFBC63} The first step is that you must go to the warehouse to load");
- strcat(string, "gifts in the vehicle from job.\n{638DFF}•{FFBC63} The second and final step at the same time have to go to some houses (depending on how many");
- strcat(string, "gifts you get from the warehouse).\n{638DFF}•{FFBC63} Finally, you get a checkpoint and have to go to him. Once you get into it, get some money");
- strcat(string, "(depending on how many gifts you had).\n{638DFF}•{FFBC63} If you want to not work, use the command {638DFF}/stopwork{FFBC63}!\n\nDo you start work? If so, click the button {94FF63}Start!{FFBC63}");
- ShowPlayerDialog(playerid, DIALOG_JOB, DIALOG_STYLE_MSGBOX, " ", string, "Start", "Close");
- }
- return 1;
- }
- forward jobCheck();
- public jobCheck() {
- new string[256];
- for(new i = 0; i < MAX_PLAYERS; i++) {
- if(IsPlayerConnected(i)) {
- if(Timer[i] >= 1) {
- Timer[i] --;
- format(string, sizeof(string), "~y~Gift Distributor~w~~h~~n~You have %d seconds until you enter the vehicle.", Timer);
- PlayerTextDrawSetString(i, InfoTD, string);
- PlayerTextDrawShow(i, InfoTD);
- if(Timer[i] == 0) {
- Timer[i] = -1;
- JobFailed(i);
- PlayerTextDrawHide(i, InfoTD);
- }
- }
- }
- }
- return 1;
- }
- stock JobFailed(playerid) {
- if(Working[playerid] == 1) {
- DisablePlayerCheckpoint(playerid);
- Working[playerid] = -1;
- Gifts[playerid] = 0;
- Checkpoint[playerid] = -1;
- TotalGifts[playerid] = 0;
- SetVehicleToRespawn(Vehicle[playerid]);
- Vehicle[playerid] = -1;
- SendClientMessage(playerid, COLOR_LIGHTGREEN, "* Job failed!");
- SendClientMessage(playerid, COLOR_WHITE, "You lost the car and gifts.");
- }
- return 1;
- }
- stock GetName(playerid) {
- new
- pName[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
- return pName;
- }
- stock CheckPlayerDistanceToVehicle(Float:radi, playerid, vehicleid) {
- if(IsPlayerConnected(playerid)) {
- new Float:PX,Float:PY,Float:PZ,Float:X,Float:Y,Float:Z;
- GetPlayerPos(playerid,PX,PY,PZ);
- GetVehiclePos(vehicleid, X,Y,Z);
- new Float:Distance = (X-PX)*(X-PX)+(Y-PY)*(Y-PY)+(Z-PZ)*(Z-PZ);
- if(Distance <= radi*radi) return 1;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement