Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #if defined ADD_TO_GAMEMODDE
- ["BEHIND DEFINES"]
- #define Function::%0(%1) forward %0(%1); public %0(%1)
- #endif
- #if defined ADD_TO_DATABASE
- ["PHPMYADMIN"]
- ACESTE LUCRURI NECESITA ADAUGARE IN DATABASE-UL VOSTRU:
- ALTER TABLE `your_players_table` ADD `user_hcandy` tinyint(3) NOT NULL DEFAULT '0';
- ALTER TABLE `your_players_table` ADD `user_hpoints` tinyint(3) NOT NULL DEFAULT '0';
- ALTER TABLE `your_players_table` ADD `user_htricked` tinyint(3) NOT NULL DEFAULT '0';
- ALTER TABLE `your_players_table` ADD `user_htaken` varchar(128) NOT NULL DEFAULT '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0';
- ALTER TABLE `your_players_table` ADD `user_items` varchar(64) NOT NULL DEFAULT '0 0 0';
- ALTER TABLE `your_players_table` ADD `user_togitems` varchar(64) NOT NULL DEFAULT '0 0 0';
- #endif
- #include "YSI\y_hooks"
- DEFINE_HOOK_REPLACEMENT(OnPlayer, OP_);
- #define MAX_TRICK_POS 22
- #define START_HALLOWEEN_QUEST 1931.9956,147.5708,37.2813
- #define DIALOG_H_SHOP 5421
- #define DIALOG_H_ACCS 5422
- #define DIALOG_H_TOG 5423
- new
- PlayerText: H_TD[MAX_PLAYERS][12],
- trickArea[MAX_PLAYERS][MAX_TRICK_POS],
- trickIcon[MAX_PLAYERS][MAX_TRICK_POS],
- PlayerText3D: trickLabel[MAX_PLAYERS][MAX_TRICK_POS],
- trickPickup[MAX_PLAYERS][MAX_TRICK_POS],
- bool: takenHouse[MAX_PLAYERS][MAX_TRICK_POS],
- h_Candy[MAX_PLAYERS],
- h_Points[MAX_PLAYERS],
- h_Tricked[MAX_PLAYERS],
- bool: halloweenStarted[MAX_PLAYERS],
- bool: followCP[MAX_PLAYERS],
- bool: h_objStatus[MAX_PLAYERS][3],
- bool: h_objItems[MAX_PLAYERS][3];
- new Float: halloween_Positions[MAX_TRICK_POS][3] = {
- {2200.2559,-37.3183,28.1535},
- {2197.6106,-60.6269,28.1535},
- {2203.2383,-89.2961,28.1535},
- {2245.4875,-122.2916,28.1535},
- {2272.3247,-119.1340,28.1535},
- {2293.7932,-124.9638,28.1535},
- {2313.7847,-124.9644,28.1536},
- {2322.2407,-124.9646,28.1536},
- {2367.3530,-49.1274,28.1535},
- {2392.3962,-54.9645,28.1536},
- {2415.4785,-52.2845,28.1535},
- {2392.3962,-54.9645,28.1536},
- {2415.4785,-52.2845,28.1535},
- {2438.8215,-54.9646,28.1535},
- {2484.4668,-28.4039,28.4416},
- {2513.3257,-28.4039,28.4416},
- {2551.2224,-5.5376,27.6756},
- {2549.2295,25.1517,27.6756},
- {2551.2224,57.1389,27.6756},
- {2518.4509,128.9880,27.6756},
- {2458.9387,128.9881,27.6756},
- {2323.8462,116.1741,28.4416}
- };
- new grandmaSkins[] = {10, 39, 54, 58, 77, 130, 133, 161, 182, 197, 199, 218, 232};
- hook OnGameModeInit()
- {
- AddStaticPickup(19320, 23, START_HALLOWEEN_QUEST, 0);
- Create3DTextLabel("{ED872D}Halloween Quest\nType '/starthalloween' to start.", -1, START_HALLOWEEN_QUEST, 20.0, 0, 0);
- ShowPlayerMarkers(0);
- return true;
- }
- hook OP_EnterDynamicArea(playerid, areaid)
- {
- new ho = Streamer_GetIntData(STREAMER_TYPE_AREA, areaid, E_STREAMER_EXTRA_ID);
- if(-1 <= ho <= MAX_TRICK_POS)
- {
- if(IsPlayerInRangeOfPoint(playerid, 1.5, halloween_Positions[ho][0], halloween_Positions[ho][1], halloween_Positions[ho][2]))
- SetPVarInt(playerid, "hHouse", ho);
- }
- return true;
- }
- hook OP_LeaveDynamicArea(playerid, areaid)
- {
- new ho = Streamer_GetIntData(STREAMER_TYPE_AREA, areaid, E_STREAMER_EXTRA_ID);
- if(-1 <= ho <= MAX_TRICK_POS)
- {
- if(!IsPlayerInRangeOfPoint(playerid, 1.5, halloween_Positions[ho][0], halloween_Positions[ho][1], halloween_Positions[ho][2]))
- DeletePVar(playerid, "hHouse");
- }
- return true;
- }
- hook OnPlayerConnect(playerid)
- {
- halloweenStarted[playerid] =
- followCP[playerid] =
- h_objStatus[playerid][0] =
- h_objStatus[playerid][1] =
- h_objStatus[playerid][2] =
- h_objItems[playerid][0] =
- h_objItems[playerid][1] =
- h_objItems[playerid][2] = false;
- H_TD[playerid][0] = CreatePlayerTextDraw(playerid, 1.111127, 159.635574, "box");
- PlayerTextDrawLetterSize(playerid, H_TD[playerid][0], 0.000000, 11.066666);
- PlayerTextDrawTextSize(playerid, H_TD[playerid][0], 138.000000, 0.000000);
- PlayerTextDrawAlignment(playerid, H_TD[playerid][0], 1);
- PlayerTextDrawColor(playerid, H_TD[playerid][0], -1);
- PlayerTextDrawUseBox(playerid, H_TD[playerid][0], 1);
- PlayerTextDrawBoxColor(playerid, H_TD[playerid][0], 102);
- PlayerTextDrawSetShadow(playerid, H_TD[playerid][0], 0);
- PlayerTextDrawSetOutline(playerid, H_TD[playerid][0], 0);
- PlayerTextDrawBackgroundColor(playerid, H_TD[playerid][0], 255);
- PlayerTextDrawFont(playerid, H_TD[playerid][0], 1);
- PlayerTextDrawSetProportional(playerid, H_TD[playerid][0], 1);
- PlayerTextDrawSetShadow(playerid, H_TD[playerid][0], 0);
- H_TD[playerid][1] = CreatePlayerTextDraw(playerid, 69.555618, 160.133361, "HALLOWEEN_PRIZE");
- PlayerTextDrawLetterSize(playerid, H_TD[playerid][1], 0.204888, 1.385954);
- PlayerTextDrawTextSize(playerid, H_TD[playerid][1], 0.000000, 137.000000);
- PlayerTextDrawAlignment(playerid, H_TD[playerid][1], 2);
- PlayerTextDrawColor(playerid, H_TD[playerid][1], -1);
- PlayerTextDrawUseBox(playerid, H_TD[playerid][1], 1);
- PlayerTextDrawBoxColor(playerid, H_TD[playerid][1], 255);
- PlayerTextDrawSetShadow(playerid, H_TD[playerid][1], 0);
- PlayerTextDrawSetOutline(playerid, H_TD[playerid][1], -2);
- PlayerTextDrawBackgroundColor(playerid, H_TD[playerid][1], 255);
- PlayerTextDrawFont(playerid, H_TD[playerid][1], 2);
- PlayerTextDrawSetProportional(playerid, H_TD[playerid][1], 1);
- PlayerTextDrawSetShadow(playerid, H_TD[playerid][1], 0);
- H_TD[playerid][2] = CreatePlayerTextDraw(playerid, 73.888854, 164.955566, "");
- PlayerTextDrawLetterSize(playerid, H_TD[playerid][2], 0.000000, 0.000000);
- PlayerTextDrawTextSize(playerid, H_TD[playerid][2], 90.000000, 90.000000);
- PlayerTextDrawAlignment(playerid, H_TD[playerid][2], 1);
- PlayerTextDrawColor(playerid, H_TD[playerid][2], -1);
- PlayerTextDrawSetShadow(playerid, H_TD[playerid][2], 0);
- PlayerTextDrawSetOutline(playerid, H_TD[playerid][2], 0);
- PlayerTextDrawBackgroundColor(playerid, H_TD[playerid][2], 0);
- PlayerTextDrawFont(playerid, H_TD[playerid][2], 5);
- PlayerTextDrawSetProportional(playerid, H_TD[playerid][2], 0);
- PlayerTextDrawSetShadow(playerid, H_TD[playerid][2], 0);
- PlayerTextDrawSetPreviewModel(playerid, H_TD[playerid][2], 197);
- PlayerTextDrawSetPreviewRot(playerid, H_TD[playerid][2], 0.000000, 360.000000, 350.000000, 1.000000);
- H_TD[playerid][3] = CreatePlayerTextDraw(playerid, 1.888888, 211.746612, "");
- PlayerTextDrawLetterSize(playerid, H_TD[playerid][3], 0.000000, 0.000000);
- PlayerTextDrawTextSize(playerid, H_TD[playerid][3], 24.000000, 13.000000);
- PlayerTextDrawAlignment(playerid, H_TD[playerid][3], 1);
- PlayerTextDrawColor(playerid, H_TD[playerid][3], -1);
- PlayerTextDrawSetShadow(playerid, H_TD[playerid][3], 0);
- PlayerTextDrawSetOutline(playerid, H_TD[playerid][3], 0);
- PlayerTextDrawBackgroundColor(playerid, H_TD[playerid][3], 0);
- PlayerTextDrawFont(playerid, H_TD[playerid][3], 5);
- PlayerTextDrawSetProportional(playerid, H_TD[playerid][3], 0);
- PlayerTextDrawSetShadow(playerid, H_TD[playerid][3], 0);
- PlayerTextDrawSetPreviewModel(playerid, H_TD[playerid][3], 18646);
- PlayerTextDrawSetPreviewRot(playerid, H_TD[playerid][3], 270.000000, 0.000000, 210.000000, 1.000000);
- H_TD[playerid][4] = CreatePlayerTextDraw(playerid, -6.111110, 180.884414, "");
- PlayerTextDrawLetterSize(playerid, H_TD[playerid][4], 0.000000, 0.000000);
- PlayerTextDrawTextSize(playerid, H_TD[playerid][4], 49.000000, 24.000000);
- PlayerTextDrawAlignment(playerid, H_TD[playerid][4], 1);
- PlayerTextDrawColor(playerid, H_TD[playerid][4], -1);
- PlayerTextDrawSetShadow(playerid, H_TD[playerid][4], 0);
- PlayerTextDrawSetOutline(playerid, H_TD[playerid][4], 0);
- PlayerTextDrawBackgroundColor(playerid, H_TD[playerid][4], 0);
- PlayerTextDrawFont(playerid, H_TD[playerid][4], 5);
- PlayerTextDrawSetProportional(playerid, H_TD[playerid][4], 0);
- PlayerTextDrawSetShadow(playerid, H_TD[playerid][4], 0);
- PlayerTextDrawSetPreviewModel(playerid, H_TD[playerid][4], 1274);
- PlayerTextDrawSetPreviewRot(playerid, H_TD[playerid][4], 0.000000, 0.000000, 210.000000, 1.000000);
- H_TD[playerid][5] = CreatePlayerTextDraw(playerid, 4.111111, 219.213272, "");
- PlayerTextDrawLetterSize(playerid, H_TD[playerid][5], 0.000000, 0.000000);
- PlayerTextDrawTextSize(playerid, H_TD[playerid][5], 24.000000, 13.000000);
- PlayerTextDrawAlignment(playerid, H_TD[playerid][5], 1);
- PlayerTextDrawColor(playerid, H_TD[playerid][5], -2139062017);
- PlayerTextDrawSetShadow(playerid, H_TD[playerid][5], 0);
- PlayerTextDrawSetOutline(playerid, H_TD[playerid][5], 0);
- PlayerTextDrawBackgroundColor(playerid, H_TD[playerid][5], 0);
- PlayerTextDrawFont(playerid, H_TD[playerid][5], 5);
- PlayerTextDrawSetProportional(playerid, H_TD[playerid][5], 0);
- PlayerTextDrawSetShadow(playerid, H_TD[playerid][5], 0);
- PlayerTextDrawSetPreviewModel(playerid, H_TD[playerid][5], 18646);
- PlayerTextDrawSetPreviewRot(playerid, H_TD[playerid][5], 270.000000, 0.000000, 210.000000, 1.000000);
- H_TD[playerid][6] = CreatePlayerTextDraw(playerid, 12.111112, 213.239929, "");
- PlayerTextDrawLetterSize(playerid, H_TD[playerid][6], 0.000000, 0.000000);
- PlayerTextDrawTextSize(playerid, H_TD[playerid][6], 24.000000, 13.000000);
- PlayerTextDrawAlignment(playerid, H_TD[playerid][6], 1);
- PlayerTextDrawColor(playerid, H_TD[playerid][6], -1378294017);
- PlayerTextDrawSetShadow(playerid, H_TD[playerid][6], 0);
- PlayerTextDrawSetOutline(playerid, H_TD[playerid][6], 0);
- PlayerTextDrawBackgroundColor(playerid, H_TD[playerid][6], 0);
- PlayerTextDrawFont(playerid, H_TD[playerid][6], 5);
- PlayerTextDrawSetProportional(playerid, H_TD[playerid][6], 0);
- PlayerTextDrawSetShadow(playerid, H_TD[playerid][6], 0);
- PlayerTextDrawSetPreviewModel(playerid, H_TD[playerid][6], 18646);
- PlayerTextDrawSetPreviewRot(playerid, H_TD[playerid][6], 270.000000, 0.000000, 210.000000, 1.000000);
- H_TD[playerid][7] = CreatePlayerTextDraw(playerid, -6.111110, 180.884414, "");
- PlayerTextDrawLetterSize(playerid, H_TD[playerid][7], 0.000000, 0.000000);
- PlayerTextDrawTextSize(playerid, H_TD[playerid][7], 49.000000, 24.000000);
- PlayerTextDrawAlignment(playerid, H_TD[playerid][7], 1);
- PlayerTextDrawColor(playerid, H_TD[playerid][7], -1);
- PlayerTextDrawSetShadow(playerid, H_TD[playerid][7], 0);
- PlayerTextDrawSetOutline(playerid, H_TD[playerid][7], 0);
- PlayerTextDrawBackgroundColor(playerid, H_TD[playerid][7], 0);
- PlayerTextDrawFont(playerid, H_TD[playerid][7], 5);
- PlayerTextDrawSetProportional(playerid, H_TD[playerid][7], 0);
- PlayerTextDrawSetShadow(playerid, H_TD[playerid][7], 0);
- PlayerTextDrawSetPreviewModel(playerid, H_TD[playerid][7], 1274);
- PlayerTextDrawSetPreviewRot(playerid, H_TD[playerid][7], 0.000000, 0.000000, 210.000000, 1.000000);
- H_TD[playerid][8] = CreatePlayerTextDraw(playerid, -23.888887, 236.635528, "");
- PlayerTextDrawLetterSize(playerid, H_TD[playerid][8], 0.000000, 0.000000);
- PlayerTextDrawTextSize(playerid, H_TD[playerid][8], 64.000000, 36.000000);
- PlayerTextDrawAlignment(playerid, H_TD[playerid][8], 1);
- PlayerTextDrawColor(playerid, H_TD[playerid][8], -1);
- PlayerTextDrawSetShadow(playerid, H_TD[playerid][8], 0);
- PlayerTextDrawSetOutline(playerid, H_TD[playerid][8], 0);
- PlayerTextDrawBackgroundColor(playerid, H_TD[playerid][8], 0);
- PlayerTextDrawFont(playerid, H_TD[playerid][8], 5);
- PlayerTextDrawSetProportional(playerid, H_TD[playerid][8], 0);
- PlayerTextDrawSetShadow(playerid, H_TD[playerid][8], 0);
- PlayerTextDrawSetPreviewModel(playerid, H_TD[playerid][8], 19528);
- PlayerTextDrawSetPreviewRot(playerid, H_TD[playerid][8], 450.000000, 340.000000, 80.000000, 1.000000);
- H_TD[playerid][9] = CreatePlayerTextDraw(playerid, 40.222301, 186.017807, "100.000$");
- PlayerTextDrawLetterSize(playerid, H_TD[playerid][9], 0.222665, 1.540266);
- PlayerTextDrawAlignment(playerid, H_TD[playerid][9], 1);
- PlayerTextDrawColor(playerid, H_TD[playerid][9], -1);
- PlayerTextDrawSetShadow(playerid, H_TD[playerid][9], 0);
- PlayerTextDrawSetOutline(playerid, H_TD[playerid][9], -1);
- PlayerTextDrawBackgroundColor(playerid, H_TD[playerid][9], 255);
- PlayerTextDrawFont(playerid, H_TD[playerid][9], 2);
- PlayerTextDrawSetProportional(playerid, H_TD[playerid][9], 1);
- PlayerTextDrawSetShadow(playerid, H_TD[playerid][9], 0);
- H_TD[playerid][10] = CreatePlayerTextDraw(playerid, 39.777839, 214.888900, "100_CANDY");
- PlayerTextDrawLetterSize(playerid, H_TD[playerid][10], 0.222665, 1.540266);
- PlayerTextDrawAlignment(playerid, H_TD[playerid][10], 1);
- PlayerTextDrawColor(playerid, H_TD[playerid][10], -1);
- PlayerTextDrawSetShadow(playerid, H_TD[playerid][10], 0);
- PlayerTextDrawSetOutline(playerid, H_TD[playerid][10], -1);
- PlayerTextDrawBackgroundColor(playerid, H_TD[playerid][10], 255);
- PlayerTextDrawFont(playerid, H_TD[playerid][10], 2);
- PlayerTextDrawSetProportional(playerid, H_TD[playerid][10], 1);
- PlayerTextDrawSetShadow(playerid, H_TD[playerid][10], 0);
- H_TD[playerid][11] = CreatePlayerTextDraw(playerid, 39.777832, 242.764465, "100_H.P");
- PlayerTextDrawLetterSize(playerid, H_TD[playerid][11], 0.222665, 1.540266);
- PlayerTextDrawAlignment(playerid, H_TD[playerid][11], 1);
- PlayerTextDrawColor(playerid, H_TD[playerid][11], -1);
- PlayerTextDrawSetShadow(playerid, H_TD[playerid][11], 0);
- PlayerTextDrawSetOutline(playerid, H_TD[playerid][11], -1);
- PlayerTextDrawBackgroundColor(playerid, H_TD[playerid][11], 255);
- PlayerTextDrawFont(playerid, H_TD[playerid][11], 2);
- PlayerTextDrawSetProportional(playerid, H_TD[playerid][11], 1);
- PlayerTextDrawSetShadow(playerid, H_TD[playerid][11], 0);
- return true;
- }
- hook OnPlayerSpawn(playerid)
- {
- sTime(playerid);
- return true;
- }
- hook OnPlayerDeath(playerid)
- {
- sTime(playerid);
- return true;
- }
- hook OnPlayerDisconnect(playerid)
- {
- sTime(playerid);
- return true;
- }
- hook OnPlayerEnterCheckpoint(playerid)
- {
- if(followCP[playerid] == true) DisablePlayerCheckpoint(playerid);
- return true;
- }
- hook OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- switch(dialogid)
- {
- case DIALOG_H_ACCS:
- {
- if(!response) return true;
- switch(listitem)
- {
- case 0:
- {
- if(h_Candy[playerid] < 700) return SCM(playerid, -1, "You don't have enough Halloween Candy.");
- h_Candy[playerid] -= 700;
- h_objItems[playerid][0] = true;
- SCM(playerid, -1, "{ED872D}Congratulations! You bought a Halloween Hat. You can use /tog to use your hat.");
- new QUERY[128];
- mysql_format(SQL, QUERY, sizeof QUERY, "UPDATE `users` SET `user_hcandy` = '%d', `user_items` = '%d %d %d' WHERE `user_name` = '%e' LIMIT 1;", h_Candy[playerid], h_objItems[playerid][0], h_objItems[playerid][1], h_objItems[playerid][2], GetName(playerid));
- mysql_tquery(SQL, QUERY, "", "");
- }
- case 1:
- {
- if(h_Candy[playerid] < 700) return SCM(playerid, -1, "You don't have enough Halloween Candy.");
- h_Candy[playerid] -= 700;
- h_objItems[playerid][2] = true;
- SCM(playerid, -1, "{ED872D}Congratulations! You bought a Halloween Chainsaw. You can use /tog to use your chainsaw.");
- new QUERY[128];
- mysql_format(SQL, QUERY, sizeof QUERY, "UPDATE `users` SET `user_hcandy` = '%d', `user_items` = '%d %d %d' WHERE `user_name` = '%e' LIMIT 1;", h_Candy[playerid], h_objItems[playerid][0], h_objItems[playerid][1], h_objItems[playerid][2], GetName(playerid));
- mysql_tquery(SQL, QUERY, "", "");
- }
- }
- }
- case DIALOG_H_SHOP:
- {
- if(!response) return true;
- switch(listitem)
- {
- case 0:
- {
- if(h_Points[playerid] < 1000) return SCM(playerid, -1, "You don't have enough Halloween Points.");
- h_Points[playerid] -= 1000;
- new QUERY[128];
- mysql_format(SQL, QUERY, sizeof QUERY, "UPDATE `users` SET `user_hpoints` = '%d' WHERE `user_name` = '%e' LIMIT 1;", h_Points[playerid], GetName(playerid));
- mysql_tquery(SQL, QUERY, "", "");
- new r_Money = 5000000 + random(5000000);
- GivePlayerMoney(playerid, r_Money);
- new winStr[127];
- format(winStr, sizeof winStr, "{ffff00}You won: $%s.", FormatNumber(r_Money));
- SCM(playerid, -1, winStr);
- }
- case 1:
- {
- if(h_Points[playerid] < 1000) return SCM(playerid, -1, "You don't have enough Halloween Points.");
- h_Points[playerid] -= 1000;
- h_objItems[playerid][1] = true;
- SCM(playerid, -1, "{ED872D}Congratulations! You bought a Halloween Skin. You can use /tog to use your skin.");
- new QUERY[128];
- mysql_format(SQL, QUERY, sizeof QUERY, "UPDATE `users` SET `user_hpoints` = '%d', `user_items` = '%d %d %d' WHERE `user_name` = '%e' LIMIT 1;", h_Points[playerid], h_objItems[playerid][0], h_objItems[playerid][1], h_objItems[playerid][2], GetName(playerid));
- mysql_tquery(SQL, QUERY, "", "");
- }
- }
- }
- case DIALOG_H_TOG:
- {
- if(!response) return DeletePVar(playerid, "lastSkin");
- switch(listitem)
- {
- case 0 .. 2:
- {
- if(h_objItems[playerid][listitem] == false) return SCM(playerid, -1, "{ED872D}You don't have this accessory. Use [/halloweenaccs] to buy.");
- h_objStatus[playerid][listitem] = !h_objStatus[playerid][listitem];
- if(h_objStatus[playerid][listitem] == true) _hAction(playerid, listitem, true);
- if(h_objStatus[playerid][listitem] == false) _hAction(playerid, listitem, false);
- new QUERY[128];
- mysql_format(SQL, QUERY, sizeof QUERY, "UPDATE `users` SET `user_togitems` = '%d %d %d' WHERE `user_name` = '%e' LIMIT 1;", (h_objStatus[playerid][0] == true) ? (1):(0), (h_objStatus[playerid][1] == true) ? (1):(0), (h_objStatus[playerid][2]== true) ? (1):(0), GetName(playerid));
- mysql_tquery(SQL, QUERY, "", "");
- }
- }
- }
- }
- return true;
- }
- hook OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- switch(newkeys)
- {
- case KEY_YES:
- {
- if(GetPVarInt(playerid, "hHouse") != -1 && halloweenStarted[playerid] == true && takenHouse[playerid][GetPVarInt(playerid, "hHouse")] == false)
- {
- new
- str[128],
- tdStr[10],
- r_Money = 20000 + random(30000),
- r_Candy = 50 + random(55),
- r_Skin = random(sizeof(grandmaSkins)),
- r_hPoints = 50 + random(50);
- ApplyAnimation(playerid, "PED", "IDLE_CHAT", 4.0, 0, 0, 0, 0, 0);
- RemovePlayerMapIcon(playerid, GetPVarInt(playerid, "hHouse"));
- DeletePlayer3DTextLabel(playerid, trickLabel[playerid][GetPVarInt(playerid, "hHouse")]);
- DestroyDynamicPickup(trickPickup[playerid][GetPVarInt(playerid, "hHouse")]);
- takenHouse[playerid][GetPVarInt(playerid, "hHouse")] = true;
- h_Tricked[playerid] ++;
- if(h_Tricked[playerid] < MAX_TRICK_POS)
- {
- SCM(playerid, -1, "--------------------------------------------------------------------------------------------------");
- format(str, sizeof str, "{FFFF00}Halloween Quest: You have to collar "#MAX_TRICK_POS" houses. [You rode: %d/"#MAX_TRICK_POS"]", h_Tricked[playerid]);
- SCM(playerid, -1, str);
- format(str, sizeof str, "{FFFF00}Halloween Quest: You roamed this house and received: $%s, %d candy, %d Halloween Points.", FormatNumber(r_Money), r_Candy, r_hPoints);
- SCM(playerid, -1, str);
- SCM(playerid, -1, "{FFFF00}Halloween Quest: You can use the /halloweenshop order to buy you something and /halloweenaccs to get halloween attachments.");
- SCM(playerid, -1, "--------------------------------------------------------------------------------------------------");
- new QUERY[128];
- mysql_format(SQL, QUERY, sizeof QUERY, "UPDATE `users` SET `user_hcandy` = '%d', `user_hpoints` = '%d' WHERE `user_name` = '%e' LIMIT 1;", h_Candy[playerid], h_Points[playerid], GetName(playerid));
- mysql_tquery(SQL, QUERY, "", "");
- }
- if(h_Tricked[playerid] == MAX_TRICK_POS)
- {
- format(str, sizeof str, "{ED872D}Congratulations! You complete the Halloween quest. You won: $5.000.000, 500 Candy, 1000 Halloween Points.");
- SCM(playerid, -1, str);
- GivePlayerMoney(playerid, 5000000);
- h_Candy[playerid] += 500;
- h_Points[playerid] += 1000;
- sTime(playerid);
- }
- format(tdStr, sizeof tdStr, "$%s", FormatNumber(r_Money));
- PlayerTextDrawSetString(playerid, H_TD[playerid][9], tdStr);
- format(tdStr, sizeof tdStr, "%d_CANDY", r_Candy);
- PlayerTextDrawSetString(playerid, H_TD[playerid][10], tdStr);
- format(tdStr, sizeof tdStr, "%d_H.P", r_hPoints);
- PlayerTextDrawSetString(playerid, H_TD[playerid][11], tdStr);
- PlayerTextDrawSetPreviewModel(playerid, H_TD[playerid][2], grandmaSkins[r_Skin]);
- for(new x, k = 12; x < k; x++)
- PlayerTextDrawShow(playerid, H_TD[playerid][x]);
- SetTimerEx("hideHTD", 6500, false, "i", playerid);
- GivePlayerMoney(playerid, r_Money);
- h_Candy[playerid] += r_Candy;
- h_Points[playerid] += r_hPoints;
- }
- }
- }
- return true;
- }
- // COMMANDS
- /*
- (!) ------------------------------------------------- (!)
- If you use ZCMD, replace this line with:
- CMD:starthalloween(playerid)
- (!) ------------------------------------------------- (!)
- */
- YCMD:sethpoints(playerid, params[], help)
- {
- new
- pID,
- pHP,
- QUERY[128];
- if(sscanf(params, "ui", pID, pHP)) return SCM(playerid, -1, "/sethp [playerid/name] [Halloween Points]");
- h_Points[playerid] = pHP;
- format(QUERY, sizeof QUERY, "{ED872D}Administrator %s has set your Halloween Points to: %d.", GetName(playerid), pHP);
- SCM(pID, -1, QUERY);
- mysql_format(SQL, QUERY, sizeof QUERY, "UPDATE `users` SET `user_hpoints` = '%d' WHERE `user_name` = '%e' LIMIT 1;", pHP, GetName(playerid));
- mysql_tquery(SQL, QUERY, "", "");
- return true;
- }
- YCMD:setcpoints(playerid, params[], help)
- {
- new
- pID,
- pCP,
- QUERY[128];
- if(sscanf(params, "ui", pID, pCP)) return SCM(playerid, -1, "/setcp [playerid/name] [Halloween Candy]");
- h_Candy[playerid] = pCP;
- format(QUERY, sizeof QUERY, "{ED872D}Administrator %s has set your Halloween Candy to: %d.", GetName(playerid), pCP);
- SCM(pID, -1, QUERY);
- mysql_format(SQL, QUERY, sizeof QUERY, "UPDATE `users` SET `user_hcandy` = '%d' WHERE `user_name` = '%e' LIMIT 1;", pCP, GetName(playerid));
- mysql_tquery(SQL, QUERY, "", "");
- return true;
- }
- YCMD:gotohalloween(playerid, params[], help)
- {
- SetPlayerVirtualWorld(playerid, 0);
- SetPlayerPos(playerid, START_HALLOWEEN_QUEST);
- SCM(playerid, -1, "You have been teleported.");
- return true;
- }
- YCMD:starthalloween(playerid, params[], help)
- {
- if(h_Tricked[playerid] == MAX_TRICK_POS) return SCM(playerid, -1, "You finished the 'Halloween Quest'.");
- if(!IsPlayerInRangeOfPoint(playerid, 5.0, START_HALLOWEEN_QUEST)) return SCM(playerid, -1, "You're not at the place where you can start halloween carols."), SetPlayerCheckpoint(playerid, START_HALLOWEEN_QUEST, 2.0), followCP[playerid] = true;
- for(new i, j = MAX_TRICK_POS; i < j; i++)
- {
- if(takenHouse[playerid][i] == false)
- {
- trickArea[playerid][i] = CreateDynamicSphere(halloween_Positions[i][0], halloween_Positions[i][1], halloween_Positions[i][2], 1.5, -1, -1, -1, 0);
- Streamer_SetIntData(STREAMER_TYPE_AREA, trickArea[playerid][i], E_STREAMER_EXTRA_ID, i);
- trickLabel[playerid][i] = CreatePlayer3DTextLabel(playerid, "{ED872D}Halloween House\nPress 'Y' to say 'Trick or Treat'", 0xFFFFFFFF, halloween_Positions[i][0], halloween_Positions[i][1], halloween_Positions[i][2], 40.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID,0);
- trickIcon[playerid][i] = SetPlayerMapIcon(playerid, i, halloween_Positions[i][0], halloween_Positions[i][1], halloween_Positions[i][2], 56, 0, MAPICON_GLOBAL);
- trickPickup[playerid][i] = CreateDynamicPickup(19320,23, halloween_Positions[i][0], halloween_Positions[i][1], halloween_Positions[i][2], 0,-1,-1,50);
- if(i == MAX_TRICK_POS) break;
- }
- }
- halloweenStarted[playerid] = true;
- SetPlayerTime(playerid, 20, 0);
- SetPlayerWeather(playerid, 32);
- SetPlayerVirtualWorld(playerid, 0);
- new str[84];
- format(str, sizeof str, "{FFFF00}Halloween Quest: You have to collar "#MAX_TRICK_POS" houses. [You rode: %d/"#MAX_TRICK_POS"]", h_Tricked[playerid]);
- SCM(playerid, -1, str);
- return true;
- }
- YCMD:halloweenshop(playerid, params[], help)
- {
- new hShop[256], hTitle[50];
- format(hTitle, sizeof hTitle, "{ffffff}Halloween Shop: {E0218A}%d points", h_Points[playerid]);
- strcat(hShop, "Item\tPrice\n{ffffff}Random Money\t{E0218A}1000 H.P\n{ffffff}Halloween Skin\t{E0218A}1000 H.P");
- ShowPlayerDialog(playerid, DIALOG_H_SHOP, DIALOG_STYLE_TABLIST_HEADERS, hTitle, hShop, "Buy", "Cancel");
- return true;
- }
- YCMD:halloweenaccs(playerid, params[], help)
- {
- new hAccs[256], hTitle[50];
- format(hTitle, sizeof hTitle, "{ffffff}Halloween Accs: {ED872D}%d candy", h_Candy[playerid]);
- strcat(hAccs, "Item\tPrice\n{ffffff}Halloween Hat\t{ED872D}700 candy\n{ffffff}Halloween chainsaw\t{ED872D}700 candy");
- ShowPlayerDialog(playerid, DIALOG_H_ACCS, DIALOG_STYLE_TABLIST_HEADERS, hTitle, hAccs, "Buy", "Cancel");
- return true;
- }
- YCMD:tog(playerid, params[], help)
- {
- new togString[256];
- strcat(togString, "Item\tStatus\n");
- format(togString, sizeof togString, "%sHalloween Hat\t%s\nHalloween Skin\t%s\nHalloween Chainsaw\t%s", togString, (h_objStatus[playerid][0] == true) ? ("{008000}Enabled"):("{ff0000}Disabled"), (h_objStatus[playerid][1] == true) ? ("{008000}Enabled"):("{ff0000}Disabled"), (h_objStatus[playerid][2] == true) ? ("{008000}Enabled"):("{ff0000}Disabled"));
- ShowPlayerDialog(playerid, DIALOG_H_TOG, DIALOG_STYLE_TABLIST_HEADERS, "Tog Items", togString, "Select", "Exit");
- SetPVarInt(playerid, "lastSkin", GetPlayerSkin(playerid));
- return true;
- }
- // Functions
- Function:: hideHTD(const playerid)
- {
- for(new x, k = 12; x < k; x++)
- PlayerTextDrawHide(playerid, H_TD[playerid][x]);
- TogglePlayerControllable(playerid, true);
- return true;
- }
- // Stocks
- stock GetName(const playerid) {
- new name[MAX_PLAYER_NAME];
- GetPlayerName(playerid, name, sizeof name);
- return name;
- }
- /*
- (!) ------------------------------------------------- (!)
- Add when this function when the player's data is loaded.
- The function will call this form: loadHalloweenVars(playerid);
- (!) ------------------------------------------------- (!)
- */
- loadHalloweenVars(const playerid)
- {
- new
- szExplode[64],
- takenDate[23],
- boolDates[6];
- h_Candy[playerid] = cache_get_field_content_int(0, "user_hcandy");
- h_Points[playerid] = cache_get_field_content_int(0, "user_hpoints");
- h_Tricked[playerid] = cache_get_field_content_int(0, "user_htricked");
- cache_get_field_content(0, "user_htaken", szExplode);
- sscanf(szExplode, "p<|>iiiiiiiiiiiiiiiiiiiiii", takenDate[0], takenDate[1], takenDate[2], takenDate[3], takenDate[4],
- takenDate[5], takenDate[6], takenDate[7], takenDate[8], takenDate[9],
- takenDate[10], takenDate[11], takenDate[12], takenDate[13], takenDate[14],
- takenDate[15], takenDate[16], takenDate[17], takenDate[18], takenDate[19],
- takenDate[20], takenDate[21], takenDate[22]);
- cache_get_field_content(0, "user_items", szExplode);
- sscanf(szExplode, "p<|>iii", boolDates[0], boolDates[4], boolDates[5]);
- h_objItems[playerid][0] = boolDates[0] == 1 ? (true):(false);
- h_objItems[playerid][1] = boolDates[4] == 1 ? (true):(false);
- h_objItems[playerid][2] = boolDates[5] == 1 ? (true):(false);
- cache_get_field_content(0, "user_togitems", szExplode);
- sscanf(szExplode, "p<|>iii", boolDates[1], boolDates[2], boolDates[3]);
- h_objStatus[playerid][0] = boolDates[1] == 1 ? (true):(false);
- h_objStatus[playerid][1] = boolDates[2] == 1 ? (true):(false);
- h_objStatus[playerid][2] = boolDates[3] == 1 ? (true):(false);
- for(new i, j = MAX_TRICK_POS; i < j; i++)
- takenHouse[playerid][i] = takenDate[i] == 1 ? (true) : (false);
- if(h_objStatus[playerid][0] == true) SetPlayerAttachedObject( playerid, 8, 19528, 2, 0.142636, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 1.000000, 1.000000, 1.000000 );
- if(h_objStatus[playerid][2] == true) SetPlayerAttachedObject( playerid, 7, 341, 1, -0.349702, -0.235238, 0.000000, 0.000000, 0.000000, 0.000000, 1.000000, 1.000000, 1.000000 );
- return true;
- }
- sTime(const playerid)
- {
- new h, m, s;
- gettime(h,m,s);
- SetPlayerTime(playerid, h,m);
- DeletePVar(playerid, "hHouse");
- for(new i, j = MAX_TRICK_POS; i < j; i++)
- {
- DeletePlayer3DTextLabel(playerid, trickLabel[playerid][i]);
- RemovePlayerMapIcon(playerid, i);
- DestroyDynamicPickup(trickPickup[playerid][i]);
- if(i == MAX_TRICK_POS) break;
- }
- new QUERY[256];
- mysql_format(SQL, QUERY, sizeof QUERY, "UPDATE `users` SET `user_htaken` = '%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d', `user_htricked` = '%d', `user_hpoints` = '%d', `user_hcandy` = '%d' WHERE `user_name` = '%e' LIMIT 1;", takenHouse[playerid][0], takenHouse[playerid][1], takenHouse[playerid][2], takenHouse[playerid][3],
- takenHouse[playerid][4], takenHouse[playerid][5], takenHouse[playerid][6], takenHouse[playerid][7],
- takenHouse[playerid][8], takenHouse[playerid][9], takenHouse[playerid][10], takenHouse[playerid][11],
- takenHouse[playerid][12], takenHouse[playerid][13], takenHouse[playerid][14], takenHouse[playerid][15],
- takenHouse[playerid][16], takenHouse[playerid][17], takenHouse[playerid][18], takenHouse[playerid][19],
- takenHouse[playerid][20], takenHouse[playerid][21], h_Tricked[playerid], h_Points[playerid], h_Candy[playerid], GetName(playerid));
- mysql_tquery(SQL, QUERY, "", "");
- return true;
- }
- FormatNumber(number) {
- new numOfPeriods = 0, tmp = number,str[32];
- while(tmp > 1000) tmp = floatround(tmp / 1000, floatround_floor), ++numOfPeriods;
- valstr(str, number);
- new slen = strlen(str);
- for(new i = 1; i != numOfPeriods + 1; ++i) strins(str, ".", slen - 3*i);
- return str;
- }
- _hAction(const playerid, lAction, bool: iAction)
- {
- switch(lAction)
- {
- case 0:
- {
- if(iAction == true) SetPlayerAttachedObject( playerid, 8, 19528, 2, 0.142636, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 1.000000, 1.000000, 1.000000 );
- if(iAction == false) RemovePlayerAttachedObject(playerid, 8);
- }
- case 1:
- {
- if(iAction == true) SetPlayerSkin(playerid, 264);
- if(iAction == false) SetPlayerSkin(playerid, GetPVarInt(playerid, "lastSkin"));
- }
- case 2:
- {
- if(iAction == true) SetPlayerAttachedObject( playerid, 7, 341, 1, -0.349702, -0.235238, 0.000000, 0.000000, 0.000000, 0.000000, 1.000000, 1.000000, 1.000000 );
- if(iAction == false) RemovePlayerAttachedObject(playerid, 7);
- }
- }
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement