Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- This is Camp Trailer System.
- Credits: Pachino ( www.facebook.com/ErvinSnoopy )
- Dont delete credits. Enjoy :-)
- Maded 25.1.2016
- */
- #include <a_samp>
- #include < YSI\y_ini >
- #include < YSI\y_amx >
- #include < YSI\y_commands >
- #include < sscanf2 >
- #include < streamer >
- #include < foreach >
- //BOJE
- #define RED "{F81414}"
- #define WHITE "{FFFFFF}"
- #define YELLOW "{F3FF02}"
- #define GREEN "{6EF83C}"
- enum
- {
- DIALOG_CAMPBUY,
- DIALOG_CAMP,
- DIALOG_CAMPSELL,
- DIALOG_CAMPINFO,
- INFOBUY_DIALOG
- }
- new LocateCamp[MAX_PLAYERS];
- new TowedCamp[MAX_PLAYERS];
- new freeze[MAX_PLAYERS];
- new EnteredInCamp[MAX_PLAYERS];
- new objekt;
- ////////////////////////////////////////////////////////////////////////////////
- #define MAX_KAMP 900
- #define CAMP_FILE "Trailers/%d.ini"
- enum kInfo
- {
- Float:cPosition[4],
- cOwner[MAX_PLAYER_NAME],
- cID,
- cLocked,
- cVW
- }
- new CampInfo[MAX_KAMP][kInfo];
- ////////////////////////////////////////////////////////////////////////////////
- new Float:RandomKampSpawn[4][4] =
- {
- {257.0985,-1397.4440,13.7161,209.1387},
- {266.8461,-1392.3018,13.8020,194.2435},
- {276.3607,-1384.3616,13.8890,206.1503},
- {285.1536,-1378.3163,13.9568,201.7636}
- };
- ////////////////////////////////////////////////////////////////////////////////
- #define CAMPUSERS "Campusers/%s.ini"
- enum pInfo
- {
- pCampTrailer
- }
- new PlayerInfo[MAX_PLAYERS][pInfo];
- public OnFilterScriptInit()
- {
- CreateObject(14385, 2511.64355, -1725.43652, 779.20868, 0.00000, 0.00000, 0.00000);
- CreateObject(14386, 2511.68457, -1726.33496, 779.07117, 0.00000, 0.00000, 0.00000);
- CreateObject(6959, 2509.99023, -1725.06543, 777.64142, 0.00000, 0.00000, 0.00000);
- CreateObject(5856, 2509.32813, -1728.60352, 779.61633, 0.00000, 0.00000, 0.00000);
- CreateObject(5856, 2508.47363, -1723.26367, 780.11633, 0.00000, 0.00000, 90.00000);
- CreateObject(5856, 2511.74902, -1732.35547, 780.64136, 0.00000, 0.00000, 90.00000);
- CreateObject(5856, 2512.50391, -1718.44824, 780.11633, 0.00000, 0.00000, 90.00000);
- CreateObject(5856, 2508.47168, -1720.57617, 780.11633, 0.00000, 0.00000, 90.00000);
- CreateObject(5856, 2513.87891, -1726.26563, 777.88574, 0.00000, 0.00000, 0.00000);
- CreateObject(1535, 2513.88281, -1729.93542, 777.63409, 0.00000, 0.00000, 90.51917);
- CreateObject(1506, 2513.99487, -1728.44849, 779.47076, 0.00000, 0.00000, 270.26917);
- CreateObject(970, 2511.74805, -1732.07617, 778.16162, 90.00000, 179.99451, 0.00000);
- CreateObject(970, 2509.78320, -1732.34277, 778.18854, 90.00000, 168.45886, 281.53564);
- CreateObject(970, 2513.58301, -1732.32410, 778.08844, 90.00000, 165.52246, 104.47751);
- CreateObject(970, 2513.65479, -1725.87256, 778.06342, 90.00000, 191.09619, 78.89282);
- CreateObject(970, 2513.97803, -1726.01221, 778.08276, 90.00000, 179.99451, 359.00000);
- CreateObject(970, 2513.85938, -1725.26660, 778.63898, 90.00000, 179.99451, 0.00000);
- CreateObject(970, 2513.40234, -1723.74805, 778.63898, 90.00000, 179.99451, 90.00000);
- CreateObject(970, 2513.82715, -1725.81848, 778.18854, 0.00000, 0.00000, 0.00000);
- CreateObject(1271, 2509.66895, -1727.24316, 779.76306, 0.00000, 0.00000, 0.00000);
- CreateObject(2238, 2509.91040, -1729.96411, 779.80548, 0.00000, 0.00000, 0.00000);
- CreateObject(970, 2510.55396, -1720.80042, 778.18854, 0.00000, 90.00000, 269.98901);
- CreateObject(970, 2510.74414, -1719.35400, 778.06342, 90.00000, 180.00549, 178.74170);
- CreateObject(2238, 2513.51245, -1724.43384, 779.59894, 0.00000, 0.00000, 0.00000);
- CreateObject(2238, 2513.54004, -1723.88220, 779.57098, 0.00000, 0.00000, 0.00000);
- CreateObject(2238, 2513.49609, -1722.42236, 779.68225, 0.00000, 0.00000, 0.00000);
- CreateObject(2238, 2513.49609, -1721.91296, 779.62988, 0.00000, 0.00000, 0.00000);
- CreateObject(2238, 2513.51782, -1723.09290, 779.81281, 0.00000, 90.00000, 89.99994);
- CreateObject(2238, 2509.82715, -1726.54150, 780.41589, 0.00000, 1.24695, 0.00000);
- CreateObject(2238, 2510.29443, -1726.65588, 778.85077, 0.00000, 0.00000, 18.00000);
- CreateObject(14811, 2503.91211, -1725.65723, 780.97998, 0.00000, 0.00000, 179.99451);
- CreateObject(14792, 2524.25366, -1730.83765, 770.23480, 0.00000, 270.00000, 84.74207);
- CreateObject(3882, 2507.34399, -1730.58899, 778.89697, 0.00000, 0.00000, 270.00000);
- CreateObject(3882, 2515.62158, -1727.21484, 778.73315, 0.00000, 0.00000, 173.50000);
- CreateObject(14792, 2499.67480, -1731.37695, 777.90527, 0.00000, 179.99451, 0.24719);
- CreateObject(3882, 2507.34375, -1730.58594, 779.45837, 0.00000, 0.00000, 270.00000);
- CreateObject(3882, 2507.34180, -1729.19165, 780.48315, 0.00000, 270.00000, 272.00000);
- CreateObject(3882, 2507.34302, -1728.20898, 776.28320, 0.00330, 89.74979, 266.49097);
- CreateObject(3119, 2511.17334, -1731.36597, 778.46405, 0.00000, 0.00000, 279.99756);
- CreateObject(14633, 2498.01660, -1727.52539, 780.12848, 0.00000, 0.00000, 229.49890);
- CreateObject(2801, 2512.41235, -1725.27368, 778.33301, 0.00000, 0.00000, 160.00000);
- CreateObject(18059, 2503.31372, -1726.64905, 779.76477, 270.79053, 341.55078, 341.55261);
- CreateObject(14399, 2502.31055, -1729.33398, 782.71124, 0.00000, 179.99451, 0.00000);
- CreateObject(14399, 2507.34692, -1723.35071, 777.56036, 359.97723, 90.24921, 359.99988);
- CreateObject(14827, 2506.91602, -1715.21484, 778.83691, 0.00000, 0.00000, 270.00000);
- CreateObject(951, 2514.33398, -1729.16504, 778.62836, 0.00000, 0.00000, 90.00000);
- CreateObject(14515, 2480.00684, -1686.86035, 778.87195, 0.00000, 0.00000, 91.99402);
- CreateObject(14515, 2510.33594, -1711.49023, 778.10120, 0.00000, 0.00000, 0.48889);
- CreateObject(14515, 2542.93457, -1703.63281, 777.85095, 0.00000, 179.49463, 269.98901);
- CreateObject(14515, 2542.21289, -1768.89941, 779.00488, 0.00000, 0.00000, 270.24719);
- CreateObject(18105, 2513.10962, -1738.30774, 781.04999, 0.00000, 0.00000, 89.75000);
- CreateObject(18109, 2518.55176, -1718.56738, 779.46002, 0.00000, 0.00000, 359.74731);
- CreateObject(2074, 2512.24878, -1727.47363, 779.84137, 0.00000, 0.00000, 338.25000);
- CreateObject(2342, 2512.08130, -1730.60217, 778.27698, 0.00000, 0.00000, 90.50000);
- CreateObject(2213, 2512.46143, -1727.53589, 778.55298, 334.64355, 23.07678, 342.83923);
- CreateObject(2212, 2514.13452, -1724.98169, 778.72101, 334.41833, 23.12863, 77.69974);
- CreateObject(14651, 2514.03516, -1729.05273, 782.37476, 0.00000, 179.99451, 89.99451);
- CreateObject(2486, 2513.62598, -1728.41602, 780.11041, 0.00000, 0.00000, 354.99573);
- CreateObject(2542, 2509.67285, -1727.23926, 780.11279, 7.24548, 0.00000, 90.48889);
- CreateObject(14863, 2514.41626, -1721.61475, 777.73029, 358.25043, 1.25058, 100.03818);
- CreateObject(14521, 2516.21582, -1719.97852, 777.89374, 359.00024, 355.74829, 56.92566);
- CreateObject(14521, 2512.98560, -1717.36743, 777.76862, 0.00000, 0.00000, 356.99609);
- CreateObject(2846, 2509.38184, -1725.77344, 779.51123, 0.98877, 72.27356, 274.89990);
- CreateObject(15027, 2515.75171, -1721.22876, 778.91803, 358.75031, 1.25030, 316.02731);
- CreateObject(15028, 2508.43262, -1728.42773, 778.88507, 5.49316, 1.50513, 137.85095);
- CreateObject(8251, 2501.36523, -1720.72363, 779.16528, 0.00000, 179.99451, 0.24719);
- CreateObject(3069, 2509.57324, -1716.11426, 778.48383, 0.00000, 269.74182, 173.73779);
- CreateObject(2768, 2512.41431, -1727.64221, 778.57001, 0.00000, 0.00000, 90.00000);
- CreateObject(2215, 2513.61768, -1725.02319, 778.71051, 334.46390, 23.40106, 10.56726);
- CreateObject(1510, 2511.97144, -1727.27576, 778.53699, 0.00000, 0.00000, 0.00000);
- CreateObject(1485, 2511.78125, -1727.24219, 778.56299, 0.00000, 4.25000, 0.00000);
- CreateObject(3503, 2512.20288, -1727.49988, 777.14349, 0.00000, 0.00000, 179.99719);
- CreateObject(1897, 2510.34766, -1723.40527, 777.56226, 0.00000, 179.99451, 270.00000);
- CreateObject(14482, 2517.00391, -1733.34473, 778.15485, 0.00000, 0.00000, 270.00000);
- CreateObject(2006, 2510.07617, -1726.57227, 779.75000, 90.00000, 0.00000, 5.50000);
- CreateObject(1933, 2512.23779, -1727.38184, 778.43787, 0.00000, 0.00000, 0.00000);
- CreateObject(1916, 2512.12622, -1727.17908, 778.51294, 0.00000, 0.00000, 0.00000);
- CreateObject(2141, 2513.40967, -1721.14746, 777.66742, 0.00000, 0.00000, 269.74731);
- CreateObject(14802, 2516.44873, -1716.70764, 778.92389, 0.00000, 0.00000, 182.50000);
- CreateObject(2372, 2510.67285, -1725.29980, 777.46191, 0.00000, 0.00000, 0.24719);
- CreateObject(11353, 2509.90430, -1706.01855, 781.41321, 0.00000, 270.00000, 0.00000);
- CreateObject(3002, 2510.08984, -1726.57910, 779.82001, 0.00000, 0.00000, 249.99939);
- CreateObject(11292, 2507.32617, -1722.26172, 779.37451, 0.00000, 0.00000, 269.74731);
- CreateObject(11292, 2505.13867, -1730.87988, 780.05017, 0.00000, 0.00000, 179.99451);
- CreateObject(5856, 2510.47266, -1718.52710, 780.11633, 0.00000, 0.00000, 180.00000);
- CreateObject(2225, 2511.54834, -1730.32129, 778.16162, 0.00000, 180.00000, 0.25000);
- CreateObject(2812, 2509.82324, -1723.68848, 778.48224, 0.00000, 0.00000, 340.75000);
- CreateObject(2816, 2510.21362, -1731.61340, 778.29999, 357.50092, 1.50143, 332.81543);
- CreateObject(2813, 2509.28662, -1729.17590, 779.66187, 275.53827, 263.26288, 82.82956);
- CreateObject(2813, 2509.34277, -1729.13794, 779.52472, 70.22913, 87.48904, 356.76605);
- CreateObject(2831, 2510.16040, -1724.59290, 778.70001, 0.00000, 0.00000, 156.00000);
- CreateObject(2827, 2509.64233, -1727.96570, 778.78723, 0.00000, 359.50000, 25.75000);
- CreateObject(2827, 2509.54468, -1727.57922, 778.67438, 43.50488, 90.23724, 266.40210);
- CreateObject(2824, 2513.54150, -1726.11646, 778.28772, 359.08655, 1.00000, 89.42963);
- CreateObject(2853, 2509.61719, -1727.18042, 778.94037, 0.74985, 180.25049, 70.24658);
- CreateObject(14830, 2498.98999, -1721.88245, 779.26385, 0.00000, 0.00000, 270.25000);
- CreateObject(2247, 2510.05200, -1723.52014, 780.00183, 334.13693, 349.43109, 160.84692);
- CreateObject(2684, 2511.98950, -1727.61658, 778.54401, 271.03418, 299.16052, 219.31554);
- CreateObject(1324, 2511.34741, -1720.61023, 779.22156, 0.00000, 0.50000, 269.50000);
- CreateObject(7313, 2509.38794, -1728.04419, 776.30499, 359.75122, 269.97278, 90.50012);
- CreateObject(7313, 2509.39185, -1728.04468, 776.06177, 359.74731, 269.97253, 90.24695);
- CreateObject(12954, 2509.72559, -1735.59570, 772.49335, 338.10974, 269.99451, 179.93958);
- CreateObject(1897, 2510.03979, -1729.11389, 778.63708, 89.73633, 72.40540, 287.50391);
- CreateObject(2860, 2513.73828, -1721.21521, 780.16400, 0.00000, 0.00000, 164.00000);
- CreateObject(1209, 2513.19287, -1721.95972, 778.08490, 0.00000, 270.00000, 90.00000);
- CreateObject(2558, 2514.14819, -1727.60510, 778.66211, 0.00000, 0.00000, 90.00000);
- CreateObject(2872, 2509.50293, -1727.84033, 777.83728, 344.75000, 0.00000, 106.50000);
- CreateObject(18866, 2511.70630, -1730.56201, 778.14502, 0.00000, 0.00000, 40.00000);
- CreateObject(18644, 2513.01465, -1724.63196, 778.70099, 90.00000, 0.00000, 250.00000);
- CreateObject(18635, 2513.01611, -1725.57214, 778.66998, 90.00000, 111.00000, 0.00000);
- CreateObject(2673, 2509.37109, -1728.60034, 779.81000, 0.00000, 0.00000, 239.00000);
- //==========================================================================
- for(new i = 0; i < sizeof(CampInfo); i++)
- {
- new kFile[50];
- format(kFile, sizeof(kFile), CAMP_FILE, i);
- if(fexist(kFile))
- {
- INI_ParseFile(kFile, "UcitajKamp", .bExtra = true, .extra = i);
- CampInfo[i][cID] = CreateVehicle(607, CampInfo[i][cPosition][0], CampInfo[i][cPosition][1], CampInfo[i][cPosition][2], CampInfo[i][cPosition][3], 0, 0, -1);
- objekt = CreateObject(3171, 0,0,0,0,0,0);
- AttachObjectToVehicle(objekt, CampInfo[i][cID], 0.084999, -2.125115, -1.144999, -3.014999, 0.000000, 178.890090);
- }
- }
- CreateDynamicPickup(19132, 1, 257.0985,-1397.4440,13.7161);
- CreateDynamic3DTextLabel(""WHITE"[ "GREEN"/buycamp "WHITE"]",-1,257.0985,-1397.4440,13.7161, 30, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, 20.0);
- return 1;
- }
- public OnFilterScriptExit()
- {
- foreach(Player, i)
- {
- KillTimer(freeze[i]);
- }
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- PlayerInfo[playerid][pCampTrailer] = -1; TowedCamp[playerid] = 0;
- EnteredInCamp[playerid] = 0;
- if(fexist(Campusers(playerid)))
- {
- INI_ParseFile(Campusers(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
- }
- return 1;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- if(newkeys & KEY_NO)
- {
- for(new i; i < MAX_KAMP; i++)
- {
- if(IsPlayerInRangeOfPoint(playerid, 4.0, CampInfo[i][cPosition][0], CampInfo[i][cPosition][1], CampInfo[i][cPosition][2]))
- {
- if(EnteredInCamp[playerid] == 0)
- {
- GameTextForPlayer(playerid, "~y~Objects loading...", 5000, 4);
- freeze[playerid] = SetTimerEx("Freeze",3000, false, "i", playerid);
- TogglePlayerControllable(playerid, 0);
- SetPlayerPos(playerid, 2513.19897, -1729.12073, 778.67657);
- SetPlayerVirtualWorld(playerid, CampInfo[i][cVW]);
- EnteredInCamp[playerid] = 1;
- }
- }
- else if(IsPlayerInRangeOfPoint(playerid, 2.0, 2513.19897, -1729.12073, 778.67657))
- {
- if(EnteredInCamp[playerid] == 1)
- {
- SetPlayerPos(playerid, CampInfo[i][cPosition][0], CampInfo[i][cPosition][1], CampInfo[i][cPosition][2]);
- SetPlayerVirtualWorld(playerid, 0); SetPlayerInterior(playerid, 0);
- EnteredInCamp[playerid] = 0;
- }
- }
- }
- }
- if(newkeys & KEY_YES)
- {
- if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
- {
- new i = PlayerInfo[playerid][pCampTrailer];
- new Float:Poz[3];
- GetVehiclePos(CampInfo[i][cID], Poz[0], Poz[1], Poz[2]);
- if(IsPlayerInRangeOfPoint(playerid, 6.0, Poz[0], Poz[1], Poz[2]))
- {
- if(TowedCamp[playerid] == 0)
- {
- objekt = CreateObject(3171, 0,0,0,0,0,0);
- new vehicleid = GetPlayerVehicleID(playerid);
- AttachObjectToVehicle(objekt, CampInfo[i][cID], 0.084999, -2.125115, -1.144999, -3.014999, 0.000000, 178.890090);
- AttachTrailerToVehicle(CampInfo[i][cID], vehicleid); TowedCamp[playerid] = 1;
- SendClientMessage(playerid,-1,""GREEN"You are sucessfuly towed Camp Trailer!");
- }
- else if(TowedCamp[playerid] == 1)
- {
- new newcartr = GetPlayerVehicleID(playerid);
- if(IsTrailerAttachedToVehicle(newcartr))
- {
- new vehicleid = GetPlayerVehicleID(playerid);
- DetachTrailerFromVehicle(vehicleid);
- TowedCamp[playerid] = 0;
- SendClientMessage(playerid,-1,""GREEN"You are sucessfuly untowed Camp Trailer!");
- }
- }
- }
- }
- }
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- if(EnteredInCamp[playerid] == 1)
- {
- EnteredInCamp[playerid] = 0; SetPlayerVirtualWorld(playerid, 0);
- }
- if(TowedCamp[playerid] == 1)
- {
- TowedCamp[playerid] = 0;
- }
- return 1;
- }
- public OnVehicleDeath(vehicleid, killerid)
- {
- for(new i; i < MAX_KAMP; i++)
- {
- if(vehicleid == CampInfo[i][cID])
- {
- DestroyObject(objekt);
- }
- }
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if(dialogid == DIALOG_CAMPBUY)
- {
- if(!response) return SendClientMessage(playerid,-1,""WHITE"You are exit from Camp Trailer Buy Menu!");
- if(response)
- {
- if(GetPlayerMoney(playerid) < 10000) return SendClientMessage(playerid,-1,""RED"[!] "WHITE"You dont have money!");
- for(new i = 0; i < sizeof(CampInfo); i++)
- {
- new Fajl[64];
- format(Fajl, sizeof(Fajl), CAMP_FILE, i);
- if(!fexist(Fajl))
- {
- new poz = random(sizeof(RandomKampSpawn));
- CampInfo[i][cPosition][0] = RandomKampSpawn[poz][0];
- CampInfo[i][cPosition][1] = RandomKampSpawn[poz][1];
- CampInfo[i][cPosition][2] = RandomKampSpawn[poz][2];
- CampInfo[i][cPosition][3] = RandomKampSpawn[poz][3];
- CampInfo[i][cLocked] = 1; CampInfo[i][cVW] = i;
- strmid(CampInfo[i][cOwner], GetName(playerid), 0, strlen(GetName(playerid)), 999);
- CampInfo[i][cID] = CreateVehicle(607, CampInfo[i][cPosition][0], CampInfo[i][cPosition][1], CampInfo[i][cPosition][2], CampInfo[i][cPosition][3], 0, 0, 100);
- objekt = CreateObject(3171, 0,0,0,0,0,0);
- AttachObjectToVehicle(objekt, CampInfo[i][cID], 0.084999, -2.125115, -1.144999, -3.014999, 0.000000, 178.890090);
- GivePlayerMoney(playerid,-10000); PlayerInfo[playerid][pCampTrailer] = i;
- SaveCamp(i); SavePlayer(playerid);
- ShowPlayerDialog(playerid,INFOBUY_DIALOG,DIALOG_STYLE_MSGBOX,""GREEN"Camp Trailer",""WHITE"You are sucessfuly buy Camp Trailer, use "GREEN"/camptrailer\n"WHITE"If you want to tow trailer use key "GREEN"'Y'"WHITE", for enter in trailer use key "GREEN"'N'","Okey","");
- break;
- }
- }
- }
- }
- if(dialogid == DIALOG_CAMP)
- {
- if(!response) return 1;
- if(PlayerInfo[playerid][pCampTrailer] == -1) return SendClientMessage(playerid,-1,""RED"[!] "WHITE"Vi ne posjedujete kamp prikolicu!");
- new i = PlayerInfo[playerid][pCampTrailer];
- switch(listitem)
- {
- case 0:
- {
- new kPrikolica[250];
- new z[5]; if(CampInfo[i][cLocked] == 1) z = "Da"; else z = "Ne";
- format(kPrikolica, sizeof(kPrikolica), ""GREEN"_______________________________\n\n\
- "WHITE"Locked: "WHITE"%s | "WHITE"Owner: "WHITE"%s\n\n\
- "GREEN"_______________________________", z, CampInfo[i][cOwner]);
- ShowPlayerDialog(playerid, DIALOG_CAMPINFO, DIALOG_STYLE_MSGBOX, ""GREEN"Camp Trailer Info", kPrikolica, "Okey", "");
- }
- case 1:
- {
- new Float:Poz[3];
- GetVehiclePos(CampInfo[i][cID], Poz[0], Poz[1], Poz[2]);
- if(!IsPlayerInRangeOfPoint(playerid, 6.0, Poz[0], Poz[1], Poz[2])) return SendClientMessage(playerid,-1,""RED"[!] "WHITE"You need to be near your Camp Trailer!");
- if(CampInfo[i][cLocked] == 0)
- {
- CampInfo[i][cLocked] = 1; SaveCamp(i);
- GameTextForPlayer(playerid, "~w~Camp trailer ~r~locked", 5000, 3);
- }
- else
- {
- CampInfo[i][cLocked] = 0; SaveCamp(i);
- GameTextForPlayer(playerid, "~w~Camp Trailer ~g~unlocked", 5000, 3);
- }
- }
- case 2:
- {
- new Float:Poz[4];
- GetVehiclePos(CampInfo[i][cID], Poz[0], Poz[1], Poz[2]);
- GetVehicleZAngle(CampInfo[i][cID], Poz[3]);
- new vehicleid = GetPlayerVehicleID(playerid);
- if(!IsPlayerInVehicle(playerid,vehicleid)) return SendClientMessage(playerid,-1,""RED"[!] "WHITE"You need to be in vehicle!");
- if(!IsPlayerInRangeOfPoint(playerid, 6.0, Poz[0], Poz[1], Poz[2])) return SendClientMessage(playerid,-1,""RED"[!] "WHITE"You need to be near your Camp Trailer!");
- if(TowedCamp[playerid] == 1)
- {
- CampInfo[i][cPosition][0] = Poz[0]; CampInfo[i][cPosition][1] = Poz[1];
- CampInfo[i][cPosition][2] = Poz[2]; CampInfo[i][cPosition][3] = Poz[3];
- DestroyVehicle(CampInfo[i][cID]);
- CampInfo[i][cID] = CreateVehicle(607, CampInfo[i][cPosition][0], CampInfo[i][cPosition][1], CampInfo[i][cPosition][2], CampInfo[i][cPosition][3], 0, 0, -1);
- SendClientMessage(playerid,-1,""RED"[!] "WHITE"Camp Trailer sucessfuly parked!");
- SaveCamp(i); SetVehicleToRespawn(CampInfo[i][cID]);
- }
- else return SendClientMessage(playerid,-1,""RED"[!] "WHITE"You need to tow Camp Trailer on vehicle (Key: Y)!");
- }
- case 3:
- {
- new Float:Poz[3]; LocateCamp[playerid] = 1;
- GetVehiclePos(CampInfo[i][cID], Poz[0], Poz[1], Poz[2]);
- SetPlayerCheckpoint(playerid, Poz[0], Poz[1], Poz[2], 4.0);
- SendClientMessage(playerid,-1,""GREEN"Your Camp Trailer are marked on radar!");
- }
- case 4:
- {
- new Float:Poz[3];
- GetVehiclePos(CampInfo[i][cID], Poz[0], Poz[1], Poz[2]);
- if(!IsPlayerInRangeOfPoint(playerid, 6.0, Poz[0], Poz[1], Poz[2])) return SendClientMessage(playerid,-1,""RED"[!] "WHITE"You need to be near your Camp trailer!");
- ShowPlayerDialog(playerid,DIALOG_CAMPSELL,DIALOG_STYLE_MSGBOX,""GREEN"Sell Camp Trailer",""WHITE"Do you want sell your Camp Trailer for $5000?","Sell","Cancel");
- }
- }
- }
- if(dialogid == DIALOG_CAMPSELL)
- {
- if(!response) return SendClientMessage(playerid,-1,""GREEN"You have been withdrawn from the sale of Camp trailer!");
- if(response)
- {
- new i = PlayerInfo[playerid][pCampTrailer];
- DestroyVehicle(CampInfo[i][cID]); DestroyObject(objekt);
- IzbrisiKampPrikolicu(PlayerInfo[playerid][pCampTrailer]);
- PlayerInfo[playerid][pCampTrailer] = -1;
- GivePlayerMoney(playerid,5000); SavePlayer(playerid);
- SendClientMessage(playerid,-1,""GREEN"You are succesfuly sold your Camp Trailer!");
- }
- }
- return 1;
- }
- YCMD:camptrailer(playerid, params[], help)
- {
- #pragma unused help
- #pragma unused params
- if(PlayerInfo[playerid][pCampTrailer] == -1) return SendClientMessage(playerid,-1,""RED"[!] "WHITE"You are not own Camp Trailer!");
- ShowPlayerDialog(playerid,DIALOG_CAMP,DIALOG_STYLE_LIST,""GREEN"Manage Your Camp trailer",""WHITE"Information\n"RED"Lock"WHITE"/"GREEN"Unlock\n"WHITE"Park\nLocate\nSell","Continue","Cancel");
- return 1;
- }
- YCMD:buycamp(playerid, params[], help)
- {
- #pragma unused help
- #pragma unused params
- if(!IsPlayerInRangeOfPoint(playerid, 5.0, 257.0985, -1397.4440, 13.7161)) return SendClientMessage(playerid,-1,""RED"[!] "WHITE"You have to be in place for the purchase of camp trailers!");
- if(PlayerInfo[playerid][pCampTrailer] != -1) return SendClientMessage(playerid,-1,""RED"[!] "WHITE"You already have Camp Trailer!");
- ShowPlayerDialog(playerid,DIALOG_CAMPBUY,DIALOG_STYLE_MSGBOX,""GREEN"Buy Camp Trailer",""WHITE"Do you want buy Camp Trailer for $10000?","Buy","Cancel");
- return 1;
- }
- stock IzbrisiKampPrikolicu(id)
- {
- new kampFile[32];
- format(kampFile, sizeof(kampFile), CAMP_FILE, id);
- if(fexist(kampFile))
- {
- fremove(kampFile);
- }
- return 1;
- }
- stock GetName(playerid)
- {
- new pName[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
- for(new i = 0; i < MAX_PLAYER_NAME; i++)
- {
- if(pName[i] == '_') pName[i] = ' ';
- }
- return pName;
- }
- forward LoadUser_data(playerid,name[],value[]);
- public LoadUser_data(playerid,name[],value[])
- {
- INI_Int("CampTrailer",PlayerInfo[playerid][pCampTrailer]);
- return 1;
- }
- forward UcitajKamp(id, name[], value[]);
- public UcitajKamp(id, name[], value[])
- {
- INI_Int("ID", CampInfo[id][cID]);
- INI_Float("X", CampInfo[id][cPosition][0]);
- INI_Float("Y", CampInfo[id][cPosition][1]);
- INI_Float("Z", CampInfo[id][cPosition][2]);
- INI_Float("A", CampInfo[id][cPosition][3]);
- INI_String("Owner", CampInfo[id][cOwner],MAX_PLAYER_NAME);
- INI_Int("Locked", CampInfo[id][cLocked]);
- INI_Int("VirtualWorld", CampInfo[id][cVW]);
- return 1;
- }
- forward Freeze(playerid);
- public Freeze(playerid)
- {
- TogglePlayerControllable(playerid, 1);
- GameTextForPlayer(playerid, "~b~Objects succesfuly loaded!", 5000, 4);
- return 1;
- }
- /////////////////////////////////////////////////////
- stock SaveCamp(id)
- {
- new kFile[80];
- format(kFile, sizeof(kFile), CAMP_FILE, id);
- new INI:File = INI_Open(kFile);
- INI_WriteInt(File,"ID", CampInfo[id][cID]);
- INI_WriteFloat(File,"X", CampInfo[id][cPosition][0]);
- INI_WriteFloat(File,"Y", CampInfo[id][cPosition][1]);
- INI_WriteFloat(File,"Z", CampInfo[id][cPosition][2]);
- INI_WriteFloat(File,"A", CampInfo[id][cPosition][3]);
- INI_WriteString(File,"Owner", CampInfo[id][cOwner]);
- INI_WriteInt(File,"Locked", CampInfo[id][cLocked]);
- INI_WriteInt(File,"VirtualWorld", CampInfo[id][cVW]);
- INI_Close(File);
- return 1;
- }
- ////////////////////////////////////////////////
- stock SavePlayer(playerid)
- {
- new INI:File = INI_Open(Campusers(playerid));
- INI_SetTag(File,"data");
- INI_WriteInt(File,"CampTrailer",PlayerInfo[playerid][pCampTrailer]);
- INI_Close(File);
- return 1;
- }
- stock Campusers(playerid)
- {
- new string[128];
- format(string,sizeof(string),CAMPUSERS,GetName(playerid));
- return string;
- }
- public OnPlayerEnterCheckpoint(playerid)
- {
- if(LocateCamp[playerid] == 1) return DisablePlayerCheckpoint(playerid), LocateCamp[playerid] = 0, GameTextForPlayer(playerid, "~y~CAMP TRAILER LOCATED", 5000, 3);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment