new Float:cashbox_startx,Float:cashbox_starty,Float:cashbox_startz; new Float:cashbox_finishx,Float:cashbox_finishy,Float:cashbox_finishz; new finname[MAX_STRING]; new cashboxobject; new creward = 0; new cashbox_inprogress = 0; new Float:LSCashBoxFinish[][CoordInfo] = { {2217.2,-1179.7,29.7}, {1098.1,-1428.0,22.7}, {2484.2,-1961.8,16.7}, {733.2,-1357.9,23.5}, {1411.6,-1455.1,20.4}, {1080.6,-1605.0,20.4}, {382.0,-2058.7,10.7}, {656.1,-1646.6,15.4}, {816.2,-1380.5,23.5}, {853.3,-1388.2,-0.5}, {915.4,-1235.1,17.2}, {1153.7,-1180.4,32.8}, {1183.9,-1257.3,18.8}, {1441.3,-926.8,39.6}, {1527.5,-893.5,57.6}, {1342.1,-1624.3,17.7}, {1292.1,-770.7,95.9}, {1907.9,-1318.6,14.1}, {1971.7,-1284.5,28.4}, {2687.1,-1144.6,71.3}, {2654.1,-1317.5,58.9}, {2771.0,-1388.5,27.1}, {2793.3,-1945.0,17.3}, {197.9,-1206.0,78.3}, {2447.5,-2209.8,26.6}, {2512.4,-2072.9,26.5}, {2171.6,-1732.1,17.2}, {2175.4,-1836.1,16.1}, {2399.5,-1550.7,28.0}, {2109.2,-1010.2,63.8}, {1409.9,-1274.5,33.4}, {1279.8,-1439.0,20.4}, {2234.0,-2269.3,17.8}, {2025.8,-2133.1,19.8}, {811.2,-1098.2,25.9}, {818.2,-944.2,55.2}, {1976.8,-1779.4,17.3} }; new Float:LVCashBoxFinish[][CoordInfo] = { {2498.9,1152.0,25.3}, {2360.0,1681.2,14.2}, {2000.6,1521.9,17.0}, {2270.9,1388.7,42.8}, {2308.6,1303.6,68.4}, {2155.6,1285.7,7.5}, {1953.2,1343.0,15.3}, {2265.7,2034.4,14.2}, {2225.9,2354.5,14.9}, {2058.3,2183.5,13.5}, {1722.6,1816.0,10.8}, {1679.9,1760.7,10.8}, {1961.6,2324.1,16.3}, {1595.6,2312.4,18.8}, {1969.5,1343.0,20.6}, {2323.7,1283.3,97.5}, {2534.8,1386.1,10.8}, {2550.8,1045.4,13.8}, {2518.0,918.4,20.8}, {2220.4,1048.5,10.8}, {2007.8,1079.8,15.5} }; new Float:SFCashBoxFinish[][CoordInfo] = { {-1531.62,687.50,133.05}, {-2116.69,925.64,86.08}, {-2178.19,714.87,53.89}, {-2079.53,1066.02,65.57}, {-2708.04,378.05,11.98}, {-1474.37,152.15,18.77}, {-1320.62,485.88,11.19}, {-2659.46,1530.08,54.94}, {-2657.78,1414.17,27.97}, {-2807.55,1162.87,20.31}, {-2387.21,2215.94,4.98}, {-2119.53,224.59,35.10}, {-2027.70,-42.67,38.80}, {-1948.38,111.97,27.69}, {-1808.22,560.85,35.16}, {-1940.65,486.94,31.97}, {-1571.32,703.71,26.46}, {-1599.16,683.78,17.16}, {-1610.15,-493.28,22.09}, {-1429.51,-964.76,200.91}, {-1685.92,1034.85,56.91}, {-1643.64,1206.49,32.91}, {-1505.59,1374.12,3.83}, {-2187.07,607.10,35.16}, {-2222.01,615.84,44.24}, {-2435.86,544.59,28.36}, {-2525.08,310.48,35.12}, {-1812.34,1226.70,23.98}, {-1864.90,1281.93,62.48}, {-2483.35,164.50,32.06}, {-1650.97,1422.88,9.22}, {-2582.19,893.12,74.48}, {-2661.18,874.05,84.38}, {-1465.60,408.74,7.19}, {-2734.98,769.54,65.91}, {-2402.25,-597.65,132.65}, {-2432.76,-1620.05,526.86} }; enum GetCashBoxPointInfo { Name[MAX_STRING], Float:Point_X, Float:Point_Y, Float:Point_Z } new LSCashBoxStart[][GetCashBoxPointInfo] = { {"North Side Gas Station (LS)",997.7,-921.1,42.1}, {"Pig Pen (LS)",2421.5,-1221.7,25.3}, {"East Side Tattoo (LS)",2069.7,-1780.1,13.5}, {"Roboi's Food Mart (LS)",1352.4,-1756.7,13.5}, {"69 Cent Store (LS)",1831.1,-1842.8,13.5} }; new LVCashBoxStart[][GetCashBoxPointInfo] = { {"Gay Gordo's Boutique (LV)",2080.4,2120.6,10.8}, {"Well Stacked Pizza Co. (LV)",2083.5,2222.4,10.8}, {"Big Banana's (LV)",1517.3,1066.9,10.8}, {"SouthSide Ammunation (LV)",2156.4,943.2,10.8}, {"Northside Cluckin' Bell (LV)",2470.9,2034.9,11.0}, {"Airport (LV)",1674.7,1448.0,10.7}, {"Caligula's Palace (LV)",2193.4,1676.4,12.3}, {"Eastside Gas Station (LV)",2637.4,1127.2,11.1}, {"City Planning Departement (LV)",2415.5,1124.0,10.8}, {"Golf Club (LV)",1458.2,2773.5,10.8} }; new SFCashBoxStart[][GetCashBoxPointInfo] = { {"Gas Station in Juniper Hil (SF)",-2418.83,969.51,45.30}, {"San Andreas Bank in Downtown (SF)",-1498.02,925.16,7.19}, {"Supa Save in Juniper Hill (SF)",-2444.78,753.17,35.17}, {"San Andreas Federal Mint (SF)",-2453.94,504.07,30.08}, {"Sub Urban in Hashbury (SF)",-2494.48,-29.11,25.77}, {"Ammu-Nation in Ocean Flats (SF)",-2625.85,209.14,4.62}, {"Eastern Basin Gas Staion (SF)",-1689.99,432.77,7.19}, {"Eastern Bay Airport (SF)",-1422.02,-288.76,14.15}, {"Eastern Bay Chemicals (SF)",-1055.1661,-696.3055,32.3516} }; forward cashboxconfig(); forward CashBoxTimer(); forward StartCashBox(); forward CashBox_OnPlayerEnterCheckpoint(playerid); forward CashBox_PlayerDeath(playerid); forward CashBox_OnPlayerDisconnect(playerid); forward CashBox_OnPlayerConnect(playerid); new Players_To_CashBox = 6; public cashboxconfig() { Debug("cashbox.inc > cashboxconfig - Start"); if (!dini_Exists(ConfigDB)) dini_Create(ConfigDB); new temp[MAX_STRING]; set(temp,dini_Get(ConfigDB,"CashBox_Enabled")); if (strlen(temp) > 0) CashBox_Enabled = strval(temp); else { valstr(temp,CashBox_Enabled); dini_Set(ConfigDB,"CashBox_Enabled",temp); } set(temp,nullstr); set(temp,dini_Get(ConfigDB,"Players_To_CashBox")); if (strlen(temp) > 0) Players_To_CashBox = strval(temp); else { valstr(temp,Players_To_CashBox); dini_Set(ConfigDB,"Players_To_CashBox",temp); } set(temp,nullstr); Debug("cashbox.inc > cashboxconfig - Stop"); } public CashBoxTimer() // must be ran by timer every.... as you wish :) { Debug("cashbox.inc > CashBoxTimer - Start"); if (event_now == 0){ if (PlayerCount() >= Players_To_CashBox){ //StartCashBox(); } } Debug("cashbox.inc > CashBoxTimer - Start"); } public StartCashBox(){ Debug("cashbox.inc > StartCashBox - Start"); if (GameCity != -1){ if (GameCity == 0){ new rnd=random(sizeof(LSCashBoxStart)); cashbox_startx=LSCashBoxStart[rnd][Point_X]; cashbox_starty=LSCashBoxStart[rnd][Point_Y]; cashbox_startz=LSCashBoxStart[rnd][Point_Z]; rnd=random(sizeof(LSCashBoxFinish)); cashbox_finishx=LSCashBoxFinish[rnd][Coord_X]; cashbox_finishy=LSCashBoxFinish[rnd][Coord_Y]; cashbox_finishz=LSCashBoxFinish[rnd][Coord_Z]; set(finname,LSCashBoxStart[rnd][Name]); } else if (GameCity == 1){ new rnd=random(sizeof(SFCashBoxStart)); cashbox_startx=SFCashBoxStart[rnd][Point_X]; cashbox_starty=SFCashBoxStart[rnd][Point_Y]; cashbox_startz=SFCashBoxStart[rnd][Point_Z]; rnd=random(sizeof(SFCashBoxFinish)); cashbox_finishx=SFCashBoxFinish[rnd][Coord_X]; cashbox_finishy=SFCashBoxFinish[rnd][Coord_Y]; cashbox_finishz=SFCashBoxFinish[rnd][Coord_Z]; set(finname,SFCashBoxStart[rnd][Name]); } else { new rnd=random(sizeof(LVCashBoxStart)); cashbox_startx=LVCashBoxStart[rnd][Point_X]; cashbox_starty=LVCashBoxStart[rnd][Point_Y]; cashbox_startz=LVCashBoxStart[rnd][Point_Z]; rnd=random(sizeof(LVCashBoxFinish)); cashbox_finishx=LVCashBoxFinish[rnd][Coord_X]; cashbox_finishy=LVCashBoxFinish[rnd][Coord_Y]; cashbox_finishz=LVCashBoxFinish[rnd][Coord_Z]; set(finname,LVCashBoxStart[rnd][Name]); } } else { new rnd=random(2); if (rnd == 0){ rnd=random(sizeof(LVCashBoxStart)); cashbox_startx=LVCashBoxStart[rnd][Point_X]; cashbox_starty=LVCashBoxStart[rnd][Point_Y]; cashbox_startz=LVCashBoxStart[rnd][Point_Z]; set(finname,LVCashBoxStart[rnd][Name]); rnd=random(2); if (rnd == 0){ rnd=random(sizeof(LVCashBoxFinish)); cashbox_finishx=LVCashBoxFinish[rnd][Coord_X]; cashbox_finishy=LVCashBoxFinish[rnd][Coord_Y]; cashbox_finishz=LVCashBoxFinish[rnd][Coord_Z]; } else if (rnd == 1){ rnd=random(sizeof(LSCashBoxFinish)); cashbox_finishx=LSCashBoxFinish[rnd][Coord_X]; cashbox_finishy=LSCashBoxFinish[rnd][Coord_Y]; cashbox_finishz=LSCashBoxFinish[rnd][Coord_Z]; } else { rnd=random(sizeof(SFCashBoxFinish)); cashbox_finishx=SFCashBoxFinish[rnd][Coord_X]; cashbox_finishy=SFCashBoxFinish[rnd][Coord_Y]; cashbox_finishz=SFCashBoxFinish[rnd][Coord_Z]; } } else if (rnd == 1){ rnd=random(sizeof(LSCashBoxStart)); cashbox_startx=LSCashBoxStart[rnd][Point_X]; cashbox_starty=LSCashBoxStart[rnd][Point_Y]; cashbox_startz=LSCashBoxStart[rnd][Point_Z]; set(finname,LSCashBoxStart[rnd][Name]); rnd=random(2); if (rnd == 0){ rnd=random(sizeof(SFCashBoxFinish)); cashbox_finishx=SFCashBoxFinish[rnd][Coord_X]; cashbox_finishy=SFCashBoxFinish[rnd][Coord_Y]; cashbox_finishz=SFCashBoxFinish[rnd][Coord_Z]; } else if (rnd == 1){ rnd=random(sizeof(LVCashBoxFinish)); cashbox_finishx=LVCashBoxFinish[rnd][Coord_X]; cashbox_finishy=LVCashBoxFinish[rnd][Coord_Y]; cashbox_finishz=LVCashBoxFinish[rnd][Coord_Z]; } else { rnd=random(sizeof(LSCashBoxFinish)); cashbox_finishx=LSCashBoxFinish[rnd][Coord_X]; cashbox_finishy=LSCashBoxFinish[rnd][Coord_Y]; cashbox_finishz=LSCashBoxFinish[rnd][Coord_Z]; } } else { rnd=random(sizeof(SFCashBoxStart)); cashbox_startx=SFCashBoxStart[rnd][Point_X]; cashbox_starty=SFCashBoxStart[rnd][Point_Y]; cashbox_startz=SFCashBoxStart[rnd][Point_Z]; set(finname,SFCashBoxStart[rnd][Name]); rnd=random(2); if (rnd == 0){ rnd=random(sizeof(LSCashBoxFinish)); cashbox_finishx=LSCashBoxFinish[rnd][Coord_X]; cashbox_finishy=LSCashBoxFinish[rnd][Coord_Y]; cashbox_finishz=LSCashBoxFinish[rnd][Coord_Z]; } else if (rnd == 1){ rnd=random(sizeof(SFCashBoxFinish)); cashbox_finishx=SFCashBoxFinish[rnd][Coord_X]; cashbox_finishy=SFCashBoxFinish[rnd][Coord_Y]; cashbox_finishz=SFCashBoxFinish[rnd][Coord_Z]; } else { rnd=random(sizeof(LVCashBoxFinish)); cashbox_finishx=LVCashBoxFinish[rnd][Coord_X]; cashbox_finishy=LVCashBoxFinish[rnd][Coord_Y]; cashbox_finishz=LVCashBoxFinish[rnd][Coord_Z]; } } } // event_now = 1; cashbox_inprogress = 1; Totalstat[CashBoxGames]++; for(new i = 0; i <= MAX_PLAYERS; i++) { if(IsPlayerConnected(i)) { if (Player[i][Cop] == 1){ ShowTextForPlayer(i, "~w~CashBox:~n~~y~Started", 5000, 1); new string[256]; format(string,sizeof(string),"(CashBox) Go to the red marker in %s, grab CashBox and get them to police station!",finname); SystemMsg(i,string); PlayerQuest[i] = QUEST_CASHBOX; oSetPlayerCheckpoint(i,cashbox_startx,cashbox_starty,cashbox_startz,2); } else if (Player[i][Medic] == 1){ // do nothing... } else { ShowTextForPlayer(i, "~w~CashBox:~n~~y~Started", 5000, 1); new string[256]; format(string,sizeof(string),"(CashBox) Go to the red marker in %s and steal the CashBox!",finname); SystemMsg(i,string); PlayerQuest[i] = QUEST_CASHBOX; oSetPlayerCheckpoint(i,cashbox_startx,cashbox_starty,cashbox_startz,2); } } } cashboxobject = CreateObject(3013,cashbox_startx,cashbox_starty,cashbox_startz,0,0,0); new ircstring[MAX_STRING]; format(ircstring,sizeof(ircstring),"(CashBox) Event started! Cashbox location: %s.",GetXYZZoneName(cashbox_startx,cashbox_starty,cashbox_startz)); SayIrc(ircstring); Debug("cashbox.inc > StartCashBox - Stop"); } public CashBox_OnPlayerEnterCheckpoint(playerid) { Debug("cashbox.inc > CashBox_OnPlayerEnterCheckpoint - Start"); if (oIsPlayerInCheckpoint(playerid,cashbox_startx,cashbox_starty,cashbox_startz,10)){ if (creward == 0){ creward = random(50000); while (creward < 20000){ creward = random(50000); } if (GetPlayerDistanceToPointEx(playerid,cashbox_finishx,cashbox_finishy,cashbox_finishz) > 4000){ creward = creward * 5; } else if (GetPlayerDistanceToPointEx(playerid,cashbox_finishx,cashbox_finishy,cashbox_finishz) > 3000){ creward = creward * 4; } else if (GetPlayerDistanceToPointEx(playerid,cashbox_finishx,cashbox_finishy,cashbox_finishz) > 2000){ creward = creward * 3; } else if (GetPlayerDistanceToPointEx(playerid,cashbox_finishx,cashbox_finishy,cashbox_finishz) > 1000){ creward = creward * 2; } } if (IsValidObject(cashboxobject)) DestroyObject(cashboxobject); new string[MAX_STRING]; if (Player[playerid][Cop] == 1){ if (GameCity == 0){ cashbox_finishx=1540.5975; cashbox_finishy=-1667.5183; cashbox_finishz=13.5509; } else if (GameCity == 1){ cashbox_finishx=-1628.6217; cashbox_finishy=651.3723; cashbox_finishz=7.1875; } else if (GameCity == 2){ cashbox_finishx=2277.8303; cashbox_finishy=2426.3796; cashbox_finishz=10.8203; } else { new rand2 = random(2); if (rand2 == 0){ cashbox_finishx=2277.8303; cashbox_finishy=2426.3796; cashbox_finishz=10.8203; } else if (rand2 == 1){ cashbox_finishx=1540.5975; cashbox_finishy=-1667.5183; cashbox_finishz=13.5509; } else { cashbox_finishx=-1628.6217; cashbox_finishy=651.3723; cashbox_finishz=7.1875; } } format(string,sizeof(string),"(CashBox) Cop %s has picked up the CashBox containing $%d",oGetPlayerName(playerid),creward); ShowTextForPlayer(playerid, "~w~Get the CashBox~n~~w~to the ~r~Police Station!", 5000, 1); SetSpecialColorForPlayer(playerid); PlayerGotCashBox[playerid] = 1; } else { if (GameCity != -1){ if (GameCity == 0){ new rnd=random(sizeof(LSCashBoxFinish)); cashbox_finishx=LSCashBoxFinish[rnd][Coord_X]; cashbox_finishy=LSCashBoxFinish[rnd][Coord_Y]; cashbox_finishz=LSCashBoxFinish[rnd][Coord_Z]; } else if (GameCity == 1){ new rnd=random(sizeof(SFCashBoxFinish)); cashbox_finishx=SFCashBoxFinish[rnd][Coord_X]; cashbox_finishy=SFCashBoxFinish[rnd][Coord_Y]; cashbox_finishz=SFCashBoxFinish[rnd][Coord_Z]; } else { new rnd=random(sizeof(LVCashBoxFinish)); cashbox_finishx=LVCashBoxFinish[rnd][Coord_X]; cashbox_finishy=LVCashBoxFinish[rnd][Coord_Y]; cashbox_finishz=LVCashBoxFinish[rnd][Coord_Z]; } } else { new rnd=random(9); if (rnd == 0 || rnd == 2 || rnd == 5){ cashbox_finishx=LVCashBoxFinish[rnd][Coord_X]; cashbox_finishy=LVCashBoxFinish[rnd][Coord_Y]; cashbox_finishz=LVCashBoxFinish[rnd][Coord_Z]; } else if (rnd == 1 || rnd == 4 || rnd == 7){ cashbox_finishx=SFCashBoxFinish[rnd][Coord_X]; cashbox_finishy=SFCashBoxFinish[rnd][Coord_Y]; cashbox_finishz=SFCashBoxFinish[rnd][Coord_Z]; } else { cashbox_finishx=LSCashBoxFinish[rnd][Coord_X]; cashbox_finishy=LSCashBoxFinish[rnd][Coord_Y]; cashbox_finishz=LSCashBoxFinish[rnd][Coord_Z]; } format(string,sizeof(string),"(CashBox) %s steal the cashbox $%d",oGetPlayerName(playerid),creward); ShowTextForPlayer(playerid, "~w~Get the CashBox~n~~w~to the ~r~Safe place!", 5000, 1); SetSpecialColorForPlayer(playerid); PlayerGotCashBox[playerid] = 1; Player[playerid][Crimes] = Player[playerid][Crimes] + 3; CheckCurrentCrimes(playerid); } } for(new i = 0; i <= MAX_PLAYERS; i++) { if (IsPlayerConnected(i)){ if (Player[i][Medic] == 0){ SystemMsg(i,string); oSetPlayerCheckpoint(i,cashbox_finishx,cashbox_finishy,cashbox_finishz,2); } } } } else if (oIsPlayerInCheckpoint(playerid,cashbox_finishx,cashbox_finishy,cashbox_finishz,10) && PlayerGotCashBox[playerid] == 1){ new string[256]; if (Player[playerid][Cop] == 1){ format(string,sizeof(string),"(CashBox) Cop %s just returned The CashBox for $%d",oGetPlayerName(playerid),creward); Player[playerid][CopSkill]=Player[playerid][CopSkill]+10; Player[playerid][CashBoxCop]++; } else { format(string,sizeof(string),"(CashBox) %s just cracked the CashBox For $%d!",oGetPlayerName(playerid),creward); Player[playerid][Crimes] = Player[playerid][Crimes]+13; CheckCurrentCrimes(playerid); Player[playerid][CashBox]++; new copstring[MAX_STRING]; format(copstring,sizeof(copstring),"(ALL UNITS!) %s cracked the CashBox!",oGetPlayerName(playerid)); SendMsgToCops(copstring); } oGivePlayerMoney(playerid,creward,1); SayIrc(string); cashbox_startx=0.0,cashbox_starty=0.0,cashbox_startz=0.0,cashbox_finishx=0.0,cashbox_finishy=0.0,cashbox_finishz=0.0; set(finname,nullstr); creward = 0; PlayerGotCashBox[playerid] = 0; SetSpecialColorForPlayer(playerid); event_now = 0; cashbox_inprogress = 0; if (IsValidObject(cashboxobject)) DestroyObject(cashboxobject); for(new i = 0; i <= MAX_PLAYERS; i++) { if (IsPlayerConnected(i)){ if (Player[i][Medic] == 0){ SystemMsg(i,string); ResetQuest(i); } } } } Debug("cashbox.inc > CashBox_OnPlayerEnterCheckpoint - Stop"); } public CashBox_PlayerDeath(playerid){ Debug("cashbox.inc > CashBox_PlayerDeath - Start"); PlayerGotCashBox[playerid] = 0; new Float:x,Float:y,Float:z; GetPlayerPos(playerid,x,y,z); new string[MAX_STRING]; format(string,sizeof(string),"(CashBox) %s died and dropped the cashbox!",oGetPlayerName(playerid)); cashbox_startx=x; cashbox_starty=y; cashbox_startz=z; cashboxobject = CreateObject(3013,cashbox_startx,cashbox_starty,cashbox_startz,0,0,0); for(new i = 0; i <= MAX_PLAYERS; i++) { if (IsPlayerConnected(i)){ if (Player[i][Medic] == 0){ SystemMsg(i,string); oSetPlayerCheckpoint(i,cashbox_startx,cashbox_starty,cashbox_startz,2); } } } Debug("cashbox.inc > CashBox_PlayerDeath - Stop"); } public CashBox_OnPlayerDisconnect(playerid){ Debug("cashbox.inc > CashBox_OnPlayerDisconnect - Start"); PlayerGotCashBox[playerid] = 0; new Float:x,Float:y,Float:z; GetPlayerPos(playerid,x,y,z); new string[MAX_STRING]; format(string,sizeof(string),"(CashBox) %s disconnected and dropped the cashbox!",oGetPlayerName(playerid)); cashbox_startx=x; cashbox_starty=y; cashbox_startz=z; cashboxobject = CreateObject(3013,cashbox_startx,cashbox_starty,cashbox_startz,0,0,0); for(new i = 0; i <= MAX_PLAYERS; i++) { if (IsPlayerConnected(i)){ if (Player[i][Medic] == 0){ SystemMsg(i,string); oSetPlayerCheckpoint(i,cashbox_startx,cashbox_starty,cashbox_startz,2); } } } Debug("cashbox.inc > CashBox_OnPlayerDisconnect - Stop"); } public CashBox_OnPlayerConnect(playerid){ Debug("cashbox.inc > CashBox_OnPlayerConnect - Start"); new noboxplayers = 0; if (cashbox_inprogress == 1){ for (new i=0;i= PlayerCount()){ oSetPlayerCheckpoint(playerid,cashbox_startx,cashbox_starty,cashbox_startz,2); } } Debug("cashbox.inc > CashBox_OnPlayerConnect - Stop"); }