| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575 |
- /*
- /$$ /$$ /$$$$$$ /$$$$$$$ /$$$$$$$
- | $$$ | $$ /$$__ $$ | $$__ $$| $$__ $$
- | $$$$| $$| $$ \__/ | $$ \ $$| $$ \ $$
- | $$ $$ $$| $$ /$$$$ /$$$$$$| $$$$$$$/| $$$$$$$/
- | $$ $$$$| $$|_ $$|______/| $$__ $$| $$____/
- | $$\ $$$| $$ \ $$ | $$ \ $$| $$
- | $$ \ $$| $$$$$$/ | $$ | $$| $$
- |__/ \__/ \______/ |__/ |__/|__/
- Treasure System
- Next Generation Gaming, LLC
- (created by Next Generation Gaming Development Team)
-
- * Copyright (c) 2016, Next Generation Gaming, LLC
- *
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are not permitted in any case.
- *
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
- FoundTreasure(playerid)
- {
- new szMessage[128];
- switch(PlayerInfo[playerid][pTreasureSkill])
- {
- case 1..149:
- {
- new FoundAnything = Random(1, 100);
- if(FoundAnything >= 1 && FoundAnything <= 50)
- {
- new ItemFound = Random(1, 10);
- if(ItemFound >= 1 && ItemFound <= 2)
- {
- SetPVarInt(playerid, "junkmetal", GetPVarInt(playerid, "junkmetal")+1);
- SaveTreasureInventory(playerid);
- format(szMessage, 128, "%s's sweeps the ground with a metal detector and finds junk metal.", GetPlayerNameEx(playerid));
- ProxDetector(30.0, playerid, szMessage, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- }
- else if(ItemFound >= 3 && ItemFound <= 4)
- {
- SetPVarInt(playerid, "newcoin", GetPVarInt(playerid, "newcoin")+1);
- SaveTreasureInventory(playerid);
- format(szMessage, 128, "%s's sweeps the ground with a metal detector and finds a new coin.", GetPlayerNameEx(playerid));
- ProxDetector(30.0, playerid, szMessage, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- }
- else if(ItemFound >= 5 && ItemFound <= 6)
- {
- SetPVarInt(playerid, "oldcoin", GetPVarInt(playerid, "oldcoin")+1);
- SaveTreasureInventory(playerid);
- format(szMessage, 128, "%s's sweeps the ground with a metal detector and finds a old coin.", GetPlayerNameEx(playerid));
- ProxDetector(30.0, playerid, szMessage, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- }
- else if(ItemFound >= 7 && ItemFound <= 8)
- {
- SetPVarInt(playerid, "brokenwatch", GetPVarInt(playerid, "brokenwatch")+1);
- SaveTreasureInventory(playerid);
- format(szMessage, 128, "%s's sweeps the ground with a metal detector and finds a broken watch.", GetPlayerNameEx(playerid));
- ProxDetector(30.0, playerid, szMessage, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- }
- else if(ItemFound >= 9 && ItemFound <= 10)
- {
- SetPVarInt(playerid, "oldkey", GetPVarInt(playerid, "oldkey")+1);
- SaveTreasureInventory(playerid);
- format(szMessage, 128, "%s's sweeps the ground with a metal detector and finds a old key.", GetPlayerNameEx(playerid));
- ProxDetector(30.0, playerid, szMessage, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- }
- }
- else
- {
- SendClientMessageEx(playerid, COLOR_WHITE, "You did not discover anything.");
- format(szMessage, 128, "%s's metal detector has seemed to malfunctioned", GetPlayerNameEx(playerid));
- ProxDetector(30.0, playerid, szMessage, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- }
- }
- case 150..299:
- {
- new FoundAnything = Random(1, 100);
- if(FoundAnything >= 1 && FoundAnything <= 75)
- {
- new ItemFound = Random(1, 10);
- if(ItemFound >= 1 && ItemFound <= 2)
- {
- SetPVarInt(playerid, "junkmetal", GetPVarInt(playerid, "junkmetal")+1);
- SaveTreasureInventory(playerid);
- format(szMessage, 128, "%s's sweeps the ground with a metal detector and finds junk metal.", GetPlayerNameEx(playerid));
- ProxDetector(30.0, playerid, szMessage, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- }
- else if(ItemFound == 3 && ItemFound <= 4)
- {
- SetPVarInt(playerid, "newcoin", GetPVarInt(playerid, "newcoin")+1);
- SaveTreasureInventory(playerid);
- format(szMessage, 128, "%s's sweeps the ground with a metal detector and finds a new coin.", GetPlayerNameEx(playerid));
- ProxDetector(30.0, playerid, szMessage, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- }
- else if(ItemFound == 5 && ItemFound <= 6)
- {
- SetPVarInt(playerid, "oldcoin", GetPVarInt(playerid, "oldcoin")+1);
- SaveTreasureInventory(playerid);
- format(szMessage, 128, "%s's sweeps the ground with a metal detector and finds a old coin.", GetPlayerNameEx(playerid));
- ProxDetector(30.0, playerid, szMessage, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- }
- else if(ItemFound == 7)
- {
- SetPVarInt(playerid, "brokenwatch", GetPVarInt(playerid, "brokenwatch")+1);
- SaveTreasureInventory(playerid);
- format(szMessage, 128, "%s's sweeps the ground with a metal detector and finds a broken watch.", GetPlayerNameEx(playerid));
- ProxDetector(30.0, playerid, szMessage, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- }
- else if(ItemFound == 8 || ItemFound == 9)
- {
- SetPVarInt(playerid, "oldkey", GetPVarInt(playerid, "oldkey")+1);
- SaveTreasureInventory(playerid);
- format(szMessage, 128, "%s's sweeps the ground with a metal detector and finds a old key.", GetPlayerNameEx(playerid));
- ProxDetector(30.0, playerid, szMessage, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- }
- else if(ItemFound == 10)
- {
- new VeryRare = Random(1, 90);
- if(VeryRare >= 1 && VeryRare <= 30)
- {
- SetPVarInt(playerid, "goldwatch", GetPVarInt(playerid, "goldwatch")+1);
- SaveTreasureInventory(playerid);
- format(szMessage, 128, "%s's sweeps the ground with a metal detector and finds a gold watch!", GetPlayerNameEx(playerid));
- ProxDetector(30.0, playerid, szMessage, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- }
- else if(VeryRare >= 31 && VeryRare <= 60)
- {
- SetPVarInt(playerid, "silvernugget", GetPVarInt(playerid, "silvernugget")+1);
- SaveTreasureInventory(playerid);
- format(szMessage, 128, "%s's sweeps the ground with a metal detector and finds a silver nugget!", GetPlayerNameEx(playerid));
- ProxDetector(30.0, playerid, szMessage, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- }
- else if(VeryRare >= 61 && VeryRare <= 90)
- {
- SetPVarInt(playerid, "goldnugget", GetPVarInt(playerid, "goldnugget")+1);
- SaveTreasureInventory(playerid);
- format(szMessage, 128, "%s's sweeps the ground with a metal detector and finds a gold nugget!", GetPlayerNameEx(playerid));
- ProxDetector(30.0, playerid, szMessage, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- }
- }
- }
- else
- {
- SendClientMessageEx(playerid, COLOR_WHITE, "You did not discover anything.");
- format(szMessage, 128, "%s's metal detector has seemed to malfunctioned", GetPlayerNameEx(playerid));
- ProxDetector(30.0, playerid, szMessage, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- }
- }
- case 300..499:
- {
- new FoundAnything = Random(1, 125);
- if(FoundAnything >= 1 && FoundAnything <= 75)
- {
- new ItemFound = Random(1, 10);
- if(ItemFound >= 1 && ItemFound <= 2)
- {
- SetPVarInt(playerid, "junkmetal", GetPVarInt(playerid, "junkmetal")+1);
- SaveTreasureInventory(playerid);
- format(szMessage, 128, "%s's sweeps the ground with a metal detector and finds junk metal.", GetPlayerNameEx(playerid));
- ProxDetector(30.0, playerid, szMessage, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- }
- else if(ItemFound == 3 && ItemFound <= 4)
- {
- SetPVarInt(playerid, "newcoin", GetPVarInt(playerid, "newcoin")+1);
- SaveTreasureInventory(playerid);
- format(szMessage, 128, "%s's sweeps the ground with a metal detector and finds a new coin.", GetPlayerNameEx(playerid));
- ProxDetector(30.0, playerid, szMessage, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- }
- else if(ItemFound == 5 && ItemFound <= 6)
- {
- SetPVarInt(playerid, "oldcoin", GetPVarInt(playerid, "oldcoin")+1);
- SaveTreasureInventory(playerid);
- format(szMessage, 128, "%s's sweeps the ground with a metal detector and finds a old coin.", GetPlayerNameEx(playerid));
- ProxDetector(30.0, playerid, szMessage, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- }
- else if(ItemFound == 7)
- {
- SetPVarInt(playerid, "brokenwatch", GetPVarInt(playerid, "brokenwatch")+1);
- SaveTreasureInventory(playerid);
- format(szMessage, 128, "%s's sweeps the ground with a metal detector and finds a broken watch.", GetPlayerNameEx(playerid));
- ProxDetector(30.0, playerid, szMessage, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- }
- else if(ItemFound == 8 || ItemFound == 9)
- {
- SetPVarInt(playerid, "oldkey", GetPVarInt(playerid, "oldkey")+1);
- SaveTreasureInventory(playerid);
- format(szMessage, 128, "%s's sweeps the ground with a metal detector and finds a old key.", GetPlayerNameEx(playerid));
- ProxDetector(30.0, playerid, szMessage, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- }
- else if(ItemFound == 10)
- {
- new VeryRare = Random(1, 90);
- if(VeryRare >= 1 && VeryRare <= 30)
- {
- SetPVarInt(playerid, "goldwatch", GetPVarInt(playerid, "goldwatch")+1);
- SaveTreasureInventory(playerid);
- format(szMessage, 128, "%s's sweeps the ground with a metal detector and finds a gold watch!", GetPlayerNameEx(playerid));
- ProxDetector(30.0, playerid, szMessage, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- }
- else if(VeryRare >= 31 && VeryRare <= 60)
- {
- SetPVarInt(playerid, "silvernugget", GetPVarInt(playerid, "silvernugget")+1);
- SaveTreasureInventory(playerid);
- format(szMessage, 128, "%s's sweeps the ground with a metal detector and finds a silver nugget!", GetPlayerNameEx(playerid));
- ProxDetector(30.0, playerid, szMessage, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- }
- else if(VeryRare >= 61 && VeryRare <= 90)
- {
- SetPVarInt(playerid, "goldnugget", GetPVarInt(playerid, "goldnugget")+1);
- SaveTreasureInventory(playerid);
- format(szMessage, 128, "%s's sweeps the ground with a metal detector and finds a gold nugget!", GetPlayerNameEx(playerid));
- ProxDetector(30.0, playerid, szMessage, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- }
- }
- }
- else
- {
- SendClientMessageEx(playerid, COLOR_WHITE, "You did not discover anything.");
- format(szMessage, 128, "%s's metal detector has seemed to malfunctioned", GetPlayerNameEx(playerid));
- ProxDetector(30.0, playerid, szMessage, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- }
- }
- case 500..9999:
- {
- new FoundAnything = Random(1, 125);
- if(FoundAnything >= 1 && FoundAnything <= 75)
- {
- new ItemFound = Random(1, 10);
- if(ItemFound >= 1 && ItemFound <= 2)
- {
- SetPVarInt(playerid, "junkmetal", GetPVarInt(playerid, "junkmetal")+1);
- SaveTreasureInventory(playerid);
- format(szMessage, 128, "%s's sweeps the ground with a metal detector and finds junk metal.", GetPlayerNameEx(playerid));
- ProxDetector(30.0, playerid, szMessage, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- }
- else if(ItemFound == 3 && ItemFound <= 4)
- {
- SetPVarInt(playerid, "newcoin", GetPVarInt(playerid, "newcoin")+1);
- SaveTreasureInventory(playerid);
- format(szMessage, 128, "%s's sweeps the ground with a metal detector and finds a new coin.", GetPlayerNameEx(playerid));
- ProxDetector(30.0, playerid, szMessage, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- }
- else if(ItemFound == 5 && ItemFound <= 6)
- {
- SetPVarInt(playerid, "oldcoin", GetPVarInt(playerid, "oldcoin")+1);
- SaveTreasureInventory(playerid);
- format(szMessage, 128, "%s's sweeps the ground with a metal detector and finds a old coin.", GetPlayerNameEx(playerid));
- ProxDetector(30.0, playerid, szMessage, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- }
- else if(ItemFound == 7)
- {
- SetPVarInt(playerid, "brokenwatch", GetPVarInt(playerid, "brokenwatch")+1);
- SaveTreasureInventory(playerid);
- format(szMessage, 128, "%s's sweeps the ground with a metal detector and finds a broken watch.", GetPlayerNameEx(playerid));
- ProxDetector(30.0, playerid, szMessage, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- }
- else if(ItemFound == 8)
- {
- SetPVarInt(playerid, "oldkey", GetPVarInt(playerid, "oldkey")+1);
- SaveTreasureInventory(playerid);
- format(szMessage, 128, "%s's sweeps the ground with a metal detector and finds a old key.", GetPlayerNameEx(playerid));
- ProxDetector(30.0, playerid, szMessage, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- }
- else if(ItemFound == 9 || ItemFound == 10)
- {
- new VeryRare = Random(1, 100);
- if(VeryRare >= 1 && VeryRare <= 35)
- {
- SetPVarInt(playerid, "goldwatch", GetPVarInt(playerid, "goldwatch")+1);
- SaveTreasureInventory(playerid);
- format(szMessage, 128, "%s's sweeps the ground with a metal detector and finds a gold watch!", GetPlayerNameEx(playerid));
- ProxDetector(30.0, playerid, szMessage, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- }
- else if(VeryRare >= 36 && VeryRare <= 65)
- {
- SetPVarInt(playerid, "silvernugget", GetPVarInt(playerid, "silvernugget")+1);
- SaveTreasureInventory(playerid);
- format(szMessage, 128, "%s's sweeps the ground with a metal detector and finds a silver nugget!", GetPlayerNameEx(playerid));
- ProxDetector(30.0, playerid, szMessage, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- }
- else if(VeryRare >= 66 && VeryRare <= 99)
- {
- SetPVarInt(playerid, "goldnugget", GetPVarInt(playerid, "goldnugget")+1);
- SaveTreasureInventory(playerid);
- format(szMessage, 128, "%s's sweeps the ground with a metal detector and finds a gold nugget!", GetPlayerNameEx(playerid));
- ProxDetector(30.0, playerid, szMessage, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- }
- else if(VeryRare == 100)
- {
- SetPVarInt(playerid, "treasure", GetPVarInt(playerid, "treasure")+1);
- SaveTreasureInventory(playerid);
- format(szMessage, 128, "%s's sweeps the ground with a metal detector and finds a hidden treasure!", GetPlayerNameEx(playerid));
- ProxDetector(30.0, playerid, szMessage, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- format(szMessage, 128, "{AA3333}AdmWarning{FFFF00}: %s has just found hidden treasure ($1,000,000)", GetPlayerNameEx(playerid));
- ABroadCast(COLOR_YELLOW, szMessage, 2);
- }
- }
- }
- else
- {
- SendClientMessageEx(playerid, COLOR_WHITE, "You did not discover anything.");
- format(szMessage, 128, "%s's metal detector has seemed to malfunctioned", GetPlayerNameEx(playerid));
- ProxDetector(30.0, playerid, szMessage, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- }
- }
- }
- return 1;
- }
- CMD:search(playerid, params[])
- {
- if(PlayerInfo[playerid][pJob] != 22 && PlayerInfo[playerid][pJob2] != 22 && PlayerInfo[playerid][pJob3] != 22) {
- return SendClientMessageEx(playerid, COLOR_GREY, "You are not a treasure hunter.");
- }
- else if(PlayerInfo[playerid][pMetalDetector] == 0) {
- return SendClientMessageEx(playerid, COLOR_GREY, "You don't have a metal detector. You can recieve one from a craftsman.");
- }
- else if(IsPlayerInAnyVehicle(playerid)) {
- return SendClientMessageEx(playerid, COLOR_GREY, "You are not allowed to metal detect while in a vehicle. " );
- }
- else if(gettime()-GetPVarInt(playerid, "LastScan") < GetPVarInt(playerid, "ScanReload")) {
- return SendClientMessageEx(playerid, COLOR_GRAD2, "Your metal detector is still charging.");
- }
- else if(!GetPVarType(playerid, "HiddenTreasure")) { // New Treasure
- SetPVarInt(playerid, "HiddenTreasure", random(sizeof(HiddenTreasure)));
- }
- new
- szMessage[128],
- Float:distance = GetPlayerDistanceFromPoint(playerid, HiddenTreasure[GetPVarInt(playerid, "HiddenTreasure")][0], HiddenTreasure[GetPVarInt(playerid, "HiddenTreasure")][1], HiddenTreasure[GetPVarInt(playerid, "HiddenTreasure")][2]);
- if(IsPlayerInArea(playerid, 402.2964, 737.5547, -1923.9410, -1752.8732) && distance > 3)
- {
- PlayerInfo[playerid][pMetalDetector]--;
- if(PlayerInfo[playerid][pMetalDetector] == 1) {
- SendClientMessageEx(playerid, COLOR_WHITE, "INFO: You only have 1 metal detector charge left.");
- }
- SetPlayerCheckpoint(playerid,HiddenTreasure[GetPVarInt(playerid, "HiddenTreasure")][0], HiddenTreasure[GetPVarInt(playerid, "HiddenTreasure")][1], HiddenTreasure[GetPVarInt(playerid, "HiddenTreasure")][2], 3);
- SetTimerEx("DisableCheckPoint", 2000, 0, "i", playerid);
- format(szMessage, 128, "You are %f meters away from the treasure. ", distance);
- SendClientMessageEx(playerid, COLOR_WHITE, szMessage);
- format(szMessage, 128, "%s sweeps the ground with a metal detector.", GetPlayerNameEx(playerid));
- ProxDetector(30.0, playerid, szMessage, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- if(PlayerInfo[playerid][pTreasureSkill] >=0 && PlayerInfo[playerid][pTreasureSkill] <= 24) SetPVarInt(playerid, "ScanReload", 20);
- else if(PlayerInfo[playerid][pTreasureSkill] >=25 && PlayerInfo[playerid][pTreasureSkill] <= 299) SetPVarInt(playerid, "ScanReload", 15);
- else if(PlayerInfo[playerid][pTreasureSkill] >=300 && PlayerInfo[playerid][pTreasureSkill] <= 599) SetPVarInt(playerid, "ScanReload", 10);
- else if(PlayerInfo[playerid][pTreasureSkill] >=600) SetPVarInt(playerid, "ScanReload", 5);
- SetPVarInt(playerid, "LastScan", gettime());
- }
- else if(distance <= 3) // Finds Treasure
- {
- FoundTreasure(playerid);
- PlayerInfo[playerid][pMetalDetector]--;
- /*if(PlayerInfo[playerid][pDoubleEXP] > 0)
- {
- format(szMessage, 128, "You have gained 2 treasure hunting skill points instead of 1. You have %d hours left on the Double EXP token.", PlayerInfo[playerid][pDoubleEXP]);
- SendClientMessageEx(playerid, COLOR_YELLOW, szMessage);
- PlayerInfo[playerid][pTreasureSkill] += 2;
- }
- else ++PlayerInfo[playerid][pTreasureSkill];*/
- ++PlayerInfo[playerid][pTreasureSkill];
- DeletePVar(playerid, "HiddenTreasure");
- if(PlayerInfo[playerid][pMetalDetector] == 1) {
- SendClientMessageEx(playerid, COLOR_WHITE, "INFO: You only have 1 metal detector charge left.");
- }
- if(PlayerInfo[playerid][pTreasureSkill] == 25) {
- SendClientMessageEx(playerid, COLOR_WHITE, "* Your Treasure Hunting Skill is now Level 2, the time it takes for your metal detector to charge is now 15 seconds!");
- }
- if(PlayerInfo[playerid][pTreasureSkill] == 150) {
- SendClientMessageEx(playerid, COLOR_WHITE, "* Your Treasure Hunting Skill is now Level 3, your chance to find a rare is now 10%!");
- }
- if(PlayerInfo[playerid][pTreasureSkill] == 300) {
- SendClientMessageEx(playerid, COLOR_WHITE, "* Your Treasure Hunting Skill is now Level 4, the time it takes for your metal detector to charge is now 10 seconds!");
- }
- if(PlayerInfo[playerid][pTreasureSkill] == 600) {
- SendClientMessageEx(playerid, COLOR_WHITE, "* Your Treasure Hunting Skill is now Level 5, your chance to find a rare is now 20%!");
- }
- }
- else {
- SendClientMessageEx(playerid, COLOR_GREY, "You are not at a beach.");
- }
- return 1;
- }
- CMD:selltreasure(playerid, params[])
- {
- new choice[32], amount;
- if(sscanf(params, "s[32]d", choice, amount))
- {
- SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /selltreasure [name] [amount]");
- SendClientMessageEx(playerid, COLOR_GREY, "Available names: junkmetal ($150), newcoin ($50), oldcoin ($100), brokenwatch ($5), oldkey ($20), goldwatch ($50000)");
- SendClientMessageEx(playerid, COLOR_GREY, "Available names: goldnugget ($100000), silvernugget ($25000), treasurechest ($1000000)");
- return 1;
- }
- else if(!IsPlayerInRangeOfPoint(playerid, 3 , 164.9517, -1779.5931, 4.3000)) {
- return SendClientMessageEx(playerid, COLOR_GREY, "You are not at a treasure sell point.");
- }
- else if(amount < 0) {
- return SendClientMessageEx(playerid, COLOR_GREY, "You can't sell negative of an item.");
- }
- new szMessage[128];
- if(strcmp(choice, "junkmetal", true) == 0) {
- if(amount <= GetPVarInt(playerid, "junkmetal") && amount > 0) {
- format(szMessage, 128, "You have sold %d junk metals for $%d.", amount, amount*150);
- SendClientMessageEx(playerid, COLOR_WHITE, szMessage);
- GivePlayerCash(playerid, amount*150);
- SetPVarInt(playerid, "junkmetal", GetPVarInt(playerid, "junkmetal")-amount);
- SaveTreasureInventory(playerid);
- }
- else {
- SendClientMessageEx(playerid, COLOR_GREY, "You don't have enough of that item to sell.");
- }
- }
- else if(strcmp(choice, "newcoin", true) == 0) {
- if(amount <= GetPVarInt(playerid, "newcoin") && amount > 0) {
- format(szMessage, 128, "You have sold %d new coins for $%d.", amount, amount*50);
- SendClientMessageEx(playerid, COLOR_WHITE, szMessage);
- GivePlayerCash(playerid, amount*50);
- SetPVarInt(playerid, "newcoin", GetPVarInt(playerid, "newcoin")-amount);
- SaveTreasureInventory(playerid);
- }
- else {
- SendClientMessageEx(playerid, COLOR_GREY, "You don't have enough of that item to sell.");
- }
- }
- else if(strcmp(choice, "oldcoin", true) == 0) {
- if(amount <= GetPVarInt(playerid, "oldcoin") && amount > 0) {
- format(szMessage, 128, "You have sold %d old coins for $%d.", amount, amount*100);
- SendClientMessageEx(playerid, COLOR_WHITE, szMessage);
- GivePlayerCash(playerid, amount*100);
- SetPVarInt(playerid, "oldcoin", GetPVarInt(playerid, "oldcoin")-amount);
- SaveTreasureInventory(playerid);
- }
- else {
- SendClientMessageEx(playerid, COLOR_GREY, "You don't have enough of that item to sell.");
- }
- }
- else if(strcmp(choice, "brokenwatch", true) == 0) {
- if(amount <= GetPVarInt(playerid, "brokenwatch") && amount > 0) {
- format(szMessage, 128, "You have sold %d broken watchs for $%d.", amount, amount*5);
- SendClientMessageEx(playerid, COLOR_WHITE, szMessage);
- GivePlayerCash(playerid, amount*5);
- SetPVarInt(playerid, "brokenwatch", GetPVarInt(playerid, "brokenwatch")-amount);
- SaveTreasureInventory(playerid);
- }
- else {
- SendClientMessageEx(playerid, COLOR_GREY, "You don't have enough of that item to sell.");
- }
- }
- else if(strcmp(choice, "oldkey", true) == 0) {
- if(amount <= GetPVarInt(playerid, "oldkey") && amount > 0) {
- format(szMessage, 128, "You have sold %d old keys for $%d.", amount, amount*20);
- SendClientMessageEx(playerid, COLOR_WHITE, szMessage);
- GivePlayerCash(playerid, amount*20);
- SetPVarInt(playerid, "oldkey", GetPVarInt(playerid, "oldkey")-amount);
- SaveTreasureInventory(playerid);
- }
- else {
- SendClientMessageEx(playerid, COLOR_GREY, "You don't have enough of that item to sell.");
- }
- }
- else if(strcmp(choice, "goldwatch", true) == 0) {
- if(amount <= GetPVarInt(playerid, "goldwatch") && amount > 0) {
- format(szMessage, 128, "You have sold %d gold watchs for $%d.", amount, amount*50000);
- SendClientMessageEx(playerid, COLOR_WHITE, szMessage);
- GivePlayerCash(playerid, amount*50000);
- SetPVarInt(playerid, "goldwatch", GetPVarInt(playerid, "goldwatch")-amount);
- SaveTreasureInventory(playerid);
- }
- else {
- SendClientMessageEx(playerid, COLOR_GREY, "You don't have enough of that item to sell.");
- }
- }
- else if(strcmp(choice, "goldnugget", true) == 0) {
- if(amount <= GetPVarInt(playerid, "goldnugget") && amount > 0) {
- format(szMessage, 128, "You have sold %d gold nuggets for $%d.", amount, amount*100000);
- SendClientMessageEx(playerid, COLOR_WHITE, szMessage);
- GivePlayerCash(playerid, amount*100000);
- SetPVarInt(playerid, "goldnugget", GetPVarInt(playerid, "goldnugget")-amount);
- SaveTreasureInventory(playerid);
- }
- else {
- SendClientMessageEx(playerid, COLOR_GREY, "You don't have enough of that item to sell.");
- }
- }
- else if(strcmp(choice, "silvernugget", true) == 0) {
- if(amount <= GetPVarInt(playerid, "silvernugget") && amount > 0) {
- format(szMessage, 128, "You have sold %d silver nuggets for $%d.", amount, amount*25000);
- SendClientMessageEx(playerid, COLOR_WHITE, szMessage);
- GivePlayerCash(playerid, amount*25000);
- SetPVarInt(playerid, "silvernugget", GetPVarInt(playerid, "silvernugget")-amount);
- SaveTreasureInventory(playerid);
- }
- else {
- SendClientMessageEx(playerid, COLOR_GREY, "You don't have enough of that item to sell.");
- }
- }
- else if(strcmp(choice, "treasurechest", true) == 0) {
- if(amount <= GetPVarInt(playerid, "treasurechest") && amount > 0) {
- format(szMessage, 128, "You have sold %d treasure chests for $%d.", amount, amount*1000000);
- SendClientMessageEx(playerid, COLOR_WHITE, szMessage);
- GivePlayerCash(playerid, amount*1000000);
- SetPVarInt(playerid, "treasure", GetPVarInt(playerid, "treasure")-amount);
- SaveTreasureInventory(playerid);
- }
- else {
- SendClientMessageEx(playerid, COLOR_GREY, "You don't have enough of that item to sell.");
- }
- }
- return 1;
- }
|