Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- DINAMICAN SISTEM STANOVA
- _________________________________________________________________________________________________________________
- | [FILTERSCRIPT LOG] |
- | BY : VANILLA |
- |------ [23.12.2011] --- [Basic v1.0]-----------------------------------------------------------------------------|
- | - Skripta je prevedena na Hrvatski |
- | - Komande su prebacene iz DCMD-a u ZCMD, lakse citanje,ljepse izgleda i brze je |
- | - Neke komande postavljene su u dijalog |
- | - Ubacene su boje u neke komande da bi bile ljepse vizualno |
- | - Prikazivanje informacija stanova je promjenjeno iz GameTexta u 3DTextLabel |
- |------ [26.12.2011] --- [Update v1.1]----------------------------------------------------------------------------|
- | - Spremanje u skripti prebaceno iz dinija u y_Ini |
- | - Skripta je optimizirana |
- |------ [11.02.2012] --- [Update v1.2]----------------------------------------------------------------------------|
- | - Od sada, kada stan nema vlasnika pise : Nitko |
- | - Od sada, level je stalno prikazivao crveno - crveno, sada prikazuje crveno-zuto |
- | - Komanda /staninfo je vizualno uljepsana bojama |
- | - Komande /zakljucajstan i /otkljucaj stan , sada su jedna komanda /lock (ljepse je,lakse za zapamtit i brze) |
- | - Komande /ulaz,/izlaz (za ulazak i izlazak iz stana) su uklonite,od sada se u stanove ulazi sa tipkom enter |
- | - Popravljen bug sa prikazivanjem pri kupnji stana ( od sada kada kupite stan pisati ce vase informacije ) |
- |_________________________________________________________________________________________________________________|
- -> -> ***************** [GAGI HELP] ******************* - POMOZI MI ZA ULAZ/IZLAZ I ZAKLJUCAVANJE/OTKLJUCAVANJE STANA
- - HVALA -> ZEEX - ZCMD
- -> Y_LESS - SSCANF, YSI
- -> STEFAN - NAPRAVIO HOUSE SYSTEM
- -> GAGI - POMOGAO MI OKO SVEGA [CJELOKUPNO FS] + (POMOC U UPDATE V1.2)
- -> VANILLA - PREVEO FS, PREBACIO KOMANDE IZ DCMD U ZCMD(BASIC V1.0 , UPDATE V1.2)
- -> PARADOX - PREBACIO SKRIPTU IZ DINI-A U Y_INI , OPTIMIZIRAO(UPDATE V1.1)
- -> N0NE - BUG FIX(ULAZ/IZLAZ)
- - OSTAVITE OVE CREDITSE AKO ZELITE DA VAM I DALJE POMAZEMO -
- - HVALA -
- */
- #include <a_samp>
- #include <YSI\y_ini>
- #include <YSI\y_va>
- #include <zcmd>
- #include <sscanf2>
- /*---- [DEFINICIJE BOJA] ----*/
- #define COLOR_NEKA 0xFFFFFF
- #define BIJELA "{FFFFFF}"
- #define CRNA "{0E0101}"
- #define SIVA "{C3C3C3}"
- #define ZELENA "{6EF83C}"
- #define CRVENA "{F81414}"
- #define ZUTA "{F3FF02}"
- #define NARANDZASTA "{FFAF00}"
- #define LIME "{B7FF00}"
- #define CYAN "{00FFEE}"
- #define SVJETLO_PLAVA "{00C0FF}"
- #define PLAVA "{0049FF}"
- #define COL_MAGENTA "{F300FF}"
- #define COL_VIOLET "{B700FF}"
- #define ROZA "{FF00EA}"
- #define COL_MARONE "{A90202}"
- #define COL_PARAM "{3FCD02}"
- #define COL_VALUE "{A3E4FF}"
- #define COL_RULE "{F9E8B7}"
- #define COL_RULE2 "{FBDF89}"
- #define COL_RWHITE "{FFFFFF}"
- #define SVJETLO_ZELENA "{C9FFAB}"
- #define SVJETLO_CRVENA "{FFA1A1}"
- #define SVJETLO_CRVENA2 "{C77D87}"
- #define MAX_STANOVA 100 // Max Stans allowed to be created
- #define PTP_RADIUS 2.0 // Radius of PlayerToPoint Function
- #define SCM SendClientMessage
- enum stInfo
- {
- stName[24],
- stSellable,
- stSell,
- stRent,
- stLevel,
- stPickup,
- Float:stExitX,
- Float:stExitY,
- Float:stExitZ,
- stVirtualWorld,
- stLocked
- }
- new
- StanInfo[MAX_STANOVA][stInfo];
- new
- Float:StansCoords[13][3] = {
- {222.9534, 1287.7649, 1082.1406}, // Sml - 1 bedroom
- {261.0827, 1284.6899, 1080.2578}, // Sml - 1 bedroom
- {260.6734, 1237.7909, 1084.2578}, // Sml - 1 bedroom
- {376.7426, 1417.3226, 1081.3281}, // Sml - 1 bedroom
- {295.2874, 1473.2769, 1080.2578}, // Med - 2 bedroom
- {327.9431, 1478.3801, 1084.4375}, // Med - 2 bedroom
- {2270.1050, -1210.3917, 1047.5625}, // Med - 2 bedroom
- {447.1211, 1397.8444, 1084.3047}, // Med - 2 bedroom
- {2196.0063, -1204.6326, 1049.0234}, // Lrg - 3 bedroom
- {235.3416, 1187.2882, 1080.2578}, // Lrg - 3 bedroom
- {490.9987, 1399.4164, 1080.2578}, // Lrg - 3 bedroom
- {227.1212, 1114.1840, 1080.9972}, // Lrg - 4 bedroom
- {225.6624, 1022.5345, 1084.0145} // Xlrg - 4 bedrooms
- };
- new
- StansLevels[13][2] = {
- {1, 2000}, // Sml - 1 bedroom
- {4, 4500}, // Sml - 1 bedroom
- {9, 7000}, // Sml - 1 bedroom
- {15, 10000}, // Sml - 1 bedroom
- {15, 17000}, // Med - 2 bedroom
- {15, 23000}, // Med - 2 bedroom
- {10, 34000}, // Med - 2 bedroom
- {2, 62000}, // Med - 2 bedroom
- {6, 102000}, // Lrg - 3 bedroom
- {3, 156000}, // Lrg - 3 bedroom
- {2, 188000}, // Lrg - 3 bedroom
- {5, 235000}, // Lrg - 4 bedroom
- {7, 295000} // Xlrg - 4 bedrooms
- };
- new
- gChatMsg[128];
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" DINAMICAN SISTEM STANOVA - UCITAN!!!");
- print("--------------------------------------\n");
- for(new st = 0; st <= MAX_STANOVA; st++) // Player Homes
- {
- LoadPlayerStan(st);
- }
- return true;
- }
- public OnFilterScriptExit()
- {
- return true;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- if( newkeys == KEY_SECONDARY_ATTACK )
- {
- for(new st = 0; st <= MAX_STANOVA; st++)
- {
- if(IsPlayerInRangeOfPoint(playerid, PTP_RADIUS, StanInfo[st][stExitX], StanInfo[st][stExitY], StanInfo[st][stExitZ]))
- {
- new Level = StanInfo[st][stLevel];
- if(StanInfo[st][stLocked] == 1 && strcmp(StanInfo[st][stName], GetName(playerid), false) != 0) return SendClientMessage(playerid, -1, ""CRVENA"[STAN]:"ZELENA" Ovaj stan je zakljucan.");
- SetPlayerPos(playerid, StansCoords[Level][0], StansCoords[Level][1], StansCoords[Level][2]);
- SetPlayerInterior(playerid, StansLevels[Level][0]);
- SetPlayerVirtualWorld(playerid, StanInfo[st][stVirtualWorld]);
- break;
- }
- }
- }
- if( newkeys == KEY_SECONDARY_ATTACK )
- {
- for(new stan = 0; stan<= MAX_STANOVA; stan++)
- {
- new st = GetPlayerVirtualWorld(playerid);
- if(IsPlayerInRangeOfPoint(playerid, PTP_RADIUS, StansCoords[StanInfo[st][stLevel]][0], StansCoords[StanInfo[st][stLevel]][1], StansCoords[StanInfo[st][stLevel]][2]))
- {
- SetPlayerPos(playerid, StanInfo[st][stExitX], StanInfo[st][stExitY], StanInfo[st][stExitZ]);
- SetPlayerInterior(playerid, 0);
- SetPlayerVirtualWorld(playerid, 0);
- }
- }
- }
- return true;
- }
- // -------------- [ZCMD KOMANDE] ---------------
- CMD:stanhelp(playerid,params[])
- {
- ShowPlayerDialog(playerid, 6382, DIALOG_STYLE_MSGBOX, "Stan - Pomoc", ""ZELENA"Vlasnik\n"SIVA"/(un)sellStan, /(un)lockStan, /rentprice, /tenants, /evict, /Stan (upgrade/downgrade\n"ZELENA"Ostali\n"SIVA"/Staninfo, /buyStan, /(un)rentStan, /enter, /exit", "Uredu", "");
- return true;
- }
- CMD:staninfo(playerid,params[])
- {
- for(new st = 0; st <= MAX_STANOVA; st++)
- {
- if(IsPlayerInRangeOfPoint(playerid, PTP_RADIUS, StanInfo[st][stExitX], StanInfo[st][stExitY], StanInfo[st][stExitZ]))
- {
- new IsLocked[24];
- if(StanInfo[st][stLocked] == 1) IsLocked = "Zakljucana";
- else IsLocked = "Otkljucana";
- new text1[256];
- format(text1, sizeof(text1), ""SVJETLO_PLAVA"Vlasnik: "BIJELA"%s"SVJETLO_PLAVA" - Level:"BIJELA" [%d]"SVJETLO_PLAVA" - Cijena Renta:"BIJELA" [%d$]"SVJETLO_PLAVA"\nProdajna Cijena:"BIJELA" [%d$]"SVJETLO_PLAVA" - Vrata:"BIJELA" [%d]"SVJETLO_PLAVA" - ID Stana:"BIJELA" [%d]", StanInfo[st][stName], StanInfo[st][stLevel], StanInfo[st][stRent], StanInfo[st][stSell], IsLocked, st);
- ShowPlayerDialog(playerid, 6389, DIALOG_STYLE_MSGBOX, ""SVJETLO_PLAVA"Stan - Informacije", text1, "Uredu", "");
- }
- }
- return true;
- }
- /*
- CMD:ulaz(playerid, params[])
- {
- for(new st = 0; st <= MAX_STANOVA; st++)
- {
- if(IsPlayerInRangeOfPoint(playerid, PTP_RADIUS, StanInfo[st][stExitX], StanInfo[st][stExitY], StanInfo[st][stExitZ]))
- {
- new
- Level = StanInfo[st][stLevel];
- if(StanInfo[st][stLocked] == 1 && strcmp(StanInfo[st][stName], GetName(playerid), false) != 0) return SendClientMessage(playerid, -1, ""CRVENA"[STAN]:"ZELENA" Ovaj stan je zakljucan.");
- SetPlayerPos(playerid, StansCoords[Level][0], StansCoords[Level][1], StansCoords[Level][2]);
- SetPlayerInterior(playerid, StansLevels[Level][0]);
- SetPlayerVirtualWorld(playerid, StanInfo[st][stVirtualWorld]);
- break;
- }
- }
- return true;
- }
- CMD:izlaz(playerid,params[])
- {
- new st = GetPlayerVirtualWorld(playerid);
- for(new stan = 0; stan<= MAX_STANOVA; stan++)
- {
- if(IsPlayerInRangeOfPoint(playerid, PTP_RADIUS, StansCoords[StanInfo[st][stLevel]][0], StansCoords[StanInfo[st][stLevel]][1], StansCoords[StanInfo[st][stLevel]][2]))
- {
- SetPlayerPos(playerid, StanInfo[st][stExitX], StanInfo[st][stExitY], StanInfo[st][stExitZ]);
- SetPlayerInterior(playerid, 0);
- SetPlayerVirtualWorld(playerid, 0);
- }
- }
- return true;
- }
- */
- CMD:kupistan(playerid,params[])
- {
- for(new st = 0; st <= MAX_STANOVA; st++)
- {
- if(IsPlayerInRangeOfPoint(playerid, PTP_RADIUS, StanInfo[st][stExitX], StanInfo[st][stExitY], StanInfo[st][stExitZ]))
- {
- if(strcmp(StanInfo[st][stName],GetName(playerid), false) != 0)
- {
- if(StanInfo[st][stSellable] == 1)
- {
- if(GetPlayerMoney(playerid) < StanInfo[st][stSell]) return SendClientMessage(playerid, -1, ""CRVENA"[STAN]:"ZELENA" Nemate dovoljno novca za kupovinu ovog stana.");
- DestroyPickup(StanInfo[st][stPickup]);
- StanInfo[st][stPickup] = CreatePickup(1272,23, StanInfo[st][stExitX], StanInfo[st][stExitY], StanInfo[st][stExitZ]); // bought
- StanInfo[st][stSellable] = 0; GivePlayerMoney(playerid, -StanInfo[st][stSell]);
- format(StanInfo[st][stName], 24, "%s", GetName(playerid)); SpremiStanove(st);
- StanInfo[st][stPickup] = CreatePickup(1272,23, StanInfo[st][stExitX], StanInfo[st][stExitY], StanInfo[st][stExitZ]); // bought
- new stanLabel[170];
- format(stanLabel, sizeof(stanLabel), ""CRVENA"Vlasnik: "ZUTA"%s\n"CRVENA"Level: "ZUTA"%d\n"CRVENA"Cijena Renta: "ZUTA"%d", StanInfo[st][stName], StanInfo[st][stLevel], StanInfo[st][stRent]);
- // Update3DTextLabelText(stanLabel, -1, StanInfo[st][stExitX], StanInfo[st][stExitY], StanInfo[st][stExitZ], 13.0, 0);
- }
- else return SendClientMessage(playerid, -1, ""CRVENA"[STAN]:"ZELENA" Ovaj stan nije za prodaju.");
- }
- else return SendClientMessage(playerid, -1, ""CRVENA"[STAN]:"ZELENA" Nemozete kupiti vlastiti stan.");
- }
- }
- return false;
- }
- CMD:cijenarenta(playerid,params[])
- {
- new
- Price;
- if(sscanf(params, "i", Price)) return SendClientMessage(playerid, -1, ""CRVENA"[KORISTI]: /cijenarenta [cijena renta]");
- else if(Price < 0 || Price > 2500) return SendClientMessage(playerid, -1, ""CRVENA"Cijena renta nemoze biti ispod 0 ili iznad 2500$");
- else
- {
- for(new st = 0; st <= MAX_STANOVA; st++)
- {
- if(IsPlayerInRangeOfPoint(playerid, PTP_RADIUS, StanInfo[st][stExitX], StanInfo[st][stExitY], StanInfo[st][stExitZ]))
- {
- if(strcmp(StanInfo[st][stName],GetName(playerid), false ) == 0)
- {
- StanInfo[st][stRent] = Price; SpremiStanove(st);
- }
- else return SendClientMessage(playerid, -1, ""CRVENA"[STAN]:"ZELENA" Niste vlasnik ovog stana.");
- }
- }
- }
- return true;
- }
- CMD:stan(playerid,params[])
- {
- new
- tmp[64];
- if(sscanf(params, "s", tmp))
- {
- SendClientMessage(playerid, -1, ""CRVENA"[KORISTI]: /stan (upgrade/downgrade)");
- SendFormattedMessage(playerid, -1, "Stan: 0[%d], 1[%d], 2[%d], 3[%d], 4[%d], 5[%d], 6[%d]", StansLevels[0][1], StansLevels[1][1], StansLevels[2][1], StansLevels[3][1], StansLevels[4][1], StansLevels[5][1], StansLevels[6][1]);
- SendFormattedMessage(playerid, -1, "7[%d], 8[%d], 9[%d], 10[%d], 11[%d], 12[%d]", StansLevels[7][1], StansLevels[8][1], StansLevels[9][1], StansLevels[10][1], StansLevels[11][1], StansLevels[12][1]);
- return 1;
- }
- else if(strcmp(tmp, "upgrade", true) == 0)
- {
- for(new st = 0; st <= MAX_STANOVA; st++)
- {
- if(IsPlayerInRangeOfPoint(playerid, PTP_RADIUS, StanInfo[st][stExitX], StanInfo[st][stExitY], StanInfo[st][stExitZ]))
- {
- if(strcmp(StanInfo[st][stName], GetName(playerid), false) == 0)
- {
- if(StanInfo[st][stLevel]+1 > 12) return SendClientMessage(playerid, -1, "Ne mozete staviti level vaseg stana na vise od 12");
- new
- Level = StansLevels[StanInfo[st][stLevel] + 1][1];
- SendFormattedMessage(playerid, -1, "Unaprijedili ste svoj stan,i to vas je kostalo %d$", Level);
- StanInfo[st][stLevel] = (StanInfo[st][stLevel]+1);
- GivePlayerMoney(playerid, -Level);
- SpremiStanove(st);
- }
- else return SendClientMessage(playerid, -1, ""CRVENA"[STAN]:"ZELENA" Niste vlasnik ovog stana.");
- }
- }
- }
- else if(strcmp(tmp, "downgrade", true) == 0)
- {
- for(new st = 0; st <= MAX_STANOVA; st++)
- {
- if(IsPlayerInRangeOfPoint(playerid, PTP_RADIUS, StanInfo[st][stExitX], StanInfo[st][stExitY], StanInfo[st][stExitZ]))
- {
- if(strcmp(StanInfo[st][stName], GetName(playerid), false) == 0)
- {
- if(StanInfo[st][stLevel]-1 < 0) return SendClientMessage(playerid, -1, "Ne mozete staviti level vaseg stana na manje od 0");
- new
- Level = StansLevels[StanInfo[st][stLevel] - 1][1];
- SendFormattedMessage(playerid, -1, "Maknili ste neka unaprijedenja svog stana,i od toga ste dobili $%d", Level);
- StanInfo[st][stLevel] = (StanInfo[st][stLevel]-1);
- GivePlayerMoney(playerid, Level);
- SpremiStanove(st);
- }
- else return SendClientMessage(playerid, -1, ""CRVENA"[STAN]:"ZELENA" Niste vlasnik ovog stana.");
- }
- }
- }
- return true;
- }
- // KOMANDA LOCK
- CMD:lock(playerid,params[])
- {
- for(new st = 0; st <= MAX_STANOVA; st++)
- {
- if(IsPlayerInRangeOfPoint(playerid, PTP_RADIUS, StanInfo[st][stExitX], StanInfo[st][stExitY], StanInfo[st][stExitZ]))// return SCM(playerid,-1,""CRVENA"[STAN]:"ZELENA"Niste vlasnik ovog stana!");
- {
- if(strcmp(StanInfo[st][stName], GetName(playerid), false) == 0)
- {
- if(StanInfo[st][stLocked] == 1)
- {
- StanInfo[st][stLocked] = 0;
- SpremiStanove(st);
- SendClientMessage(playerid, -1, ""CRVENA"[STAN]:"ZELENA"Otkljucali ste svoj stan.");
- }
- else
- {
- StanInfo[st][stLocked] = 1;
- SpremiStanove(st);
- SendClientMessage(playerid, -1, ""CRVENA"[STAN]:"ZELENA"Zakljucali ste svoj stan.");
- }
- }
- }
- }
- return 1;
- }
- /*
- CMD:otkljucajstan(playerid,params[])
- {
- for(new st = 0; st <= MAX_STANOVA; st++)
- {
- if(IsPlayerInRangeOfPoint(playerid, PTP_RADIUS, StanInfo[st][stExitX], StanInfo[st][stExitY], StanInfo[st][stExitZ]))
- {
- if(strcmp(StanInfo[st][stName], GetName(playerid), false) == 0)
- {
- if(StanInfo[st][stLocked] == 1) return SendClientMessage(playerid, -1, ""CRVENA"ERROR: "ZELENA"This Stan is allready locked.");
- StanInfo[st][stLocked] = 1;
- SpremiStanove(st);
- SendClientMessage(playerid, -1, ""CRVENA"[STAN]:"ZELENA" Zakljucali ste svoj stna.");
- }
- else return SendClientMessage(playerid, -1, ""CRVENA"[STAN]:"ZELENA" Niste vlasnik ovog stana.");
- }
- }
- return true;
- }
- CMD:zakljucajstan(playerid,params[])
- {
- for(new st = 0; st <= MAX_STANOVA; st++)
- {
- if(IsPlayerInRangeOfPoint(playerid, PTP_RADIUS, StanInfo[st][stExitX], StanInfo[st][stExitY], StanInfo[st][stExitZ]))
- {
- if(strcmp(StanInfo[st][stName], GetName(playerid), false) == 0)
- {
- if(StanInfo[st][stLocked] == 0) return SendClientMessage(playerid, -1, ""CRVENA"ERROR: "ZELENA"Ovaj stan je vec otkljucan.");
- StanInfo[st][stLocked] = 0;
- SpremiStanove(st);
- SendClientMessage(playerid, -1, ""CRVENA"[STAN]:"ZELENA" Otkljucali ste svoj stan.");
- }
- else return SendClientMessage(playerid, -1, ""CRVENA"[STAN]:"ZELENA" Niste vlasnik ovog stana.");
- }
- }
- return true;
- }*/
- CMD:prodajstan(playerid,params[])
- {
- new Sell;
- if(sscanf(params, "i", Sell)) return SendClientMessage(playerid, -1, ""CRVENA"[KORISTI]: /prodajstan [cijena]");
- else if(Sell < 0 || Sell > 250000) return SendClientMessage(playerid, -1, ""CRVENA"[STAN]:"ZELENA" Cijena nemoze biti ispod 0 ili iznad 250 tisuca");
- else
- {
- for(new st = 0; st <= MAX_STANOVA; st++)
- {
- if(IsPlayerInRangeOfPoint(playerid, PTP_RADIUS, StanInfo[st][stExitX], StanInfo[st][stExitY], StanInfo[st][stExitZ]))
- {
- if(strcmp(StanInfo[st][stName], GetName(playerid), false) == 0)
- {
- DestroyPickup(StanInfo[st][stPickup]);
- StanInfo[st][stPickup] = CreatePickup(1273, 23, StanInfo[st][stExitX], StanInfo[st][stExitY], StanInfo[st][stExitZ]); // not bought
- StanInfo[st][stSellable] = 1; StanInfo[st][stSell] = Sell; SpremiStanove(st);
- }
- else return SendClientMessage(playerid, -1, ""CRVENA"[STAN]:"ZELENA" Niste vlasnik ovog stana.");
- }
- }
- }
- return true;
- }
- CMD:unsellstan(playerid,params[])
- {
- for(new st = 0; st<= MAX_STANOVA; st++)
- {
- if(IsPlayerInRangeOfPoint(playerid, PTP_RADIUS, StanInfo[st][stExitX], StanInfo[st][stExitY], StanInfo[st][stExitZ]))
- {
- if(strcmp(StanInfo[st][stName], GetName(playerid), false) == 0)
- {
- DestroyPickup(StanInfo[st][stPickup]);
- StanInfo[st][stPickup] = CreatePickup(1272,23, StanInfo[st][stExitX], StanInfo[st][stExitY], StanInfo[st][stExitZ]); // bought
- StanInfo[st][stSellable] = 0; SpremiStanove(st);
- }
- else return SendClientMessage(playerid, -1, ""CRVENA"[STAN]:"ZELENA" Niste vlasnik ovog stana.");
- }
- }
- return true;
- }
- CMD:napravistan(playerid,params[])
- {
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, ""CRVENA"ERROR:"ZELENA" Samo administratori mogu koristiti ovu komandu!");
- else
- {
- new Sell,lvl;
- if(sscanf(params, "ii", Sell, lvl)) return SendClientMessage(playerid, -1, ""CRVENA"[KORISTI]: /napravistan [cijena] [level]");
- else if(Sell < 0 || Sell > 250000) return SendClientMessage(playerid, -1, ""CRVENA"Cijena nemoze biti ispod 0 ili iznad 250 tisuca");
- else if(lvl < 0 || lvl > 12) return SendClientMessage(playerid, -1, ""CRVENA"Level nemoze biti ispod 0 ili iznad 12");
- else CreatePlayerStan(playerid, Sell, lvl);
- }
- return true;
- }
- CMD:unististan(playerid,params[])
- {
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, ""CRVENA"ERROR:"ZELENA" Samo administratori mogu koristiti ovu komandu!");
- else
- {
- new Stanid;
- if(sscanf(params, "i", Stanid)) return SendClientMessage(playerid, -1, ""CRVENA"[KORISTI]: /unististan [ID stana]");
- else UnistiStan(playerid, Stanid);
- }
- return true;
- }
- ////////////////////////////////////////////
- // STOCKOVI , CALLBACKOVI I OSTALO //
- //////////////////////////////////////////
- forward LoadStan_Data(stanid, name[], value[]);
- public LoadStan_Data(stanid, name[], value[])
- {
- INI_String("Name", StanInfo[stanid][stName], MAX_PLAYER_NAME);
- INI_Int("For_Sell", StanInfo[stanid][stSellable]);
- INI_Int("Sell_Price", StanInfo[stanid][stSell]);
- INI_Int("Rent_Price", StanInfo[stanid][stRent]);
- INI_Int("Stan_Level", StanInfo[stanid][stLevel]);
- INI_Float("Exit_Coord:X", StanInfo[stanid][stExitX]);
- INI_Float("Exit_Coord:Y", StanInfo[stanid][stExitY]);
- INI_Float("Exit_Coord:Z", StanInfo[stanid][stExitZ]);
- INI_Int("VirtualWorld", StanInfo[stanid][stVirtualWorld]);
- INI_Int("Status", StanInfo[stanid][stLocked]);
- return 1;
- }
- stock CreatePlayerStan(playerid, sellprice, StanLvl)
- {
- if((ReturnNextUnusedStanID()-1) >= MAX_STANOVA) return SendClientMessage(playerid, -1, ""CRVENA"[STAN]:"ZELENA" Napravljen je maksimalan broj stanova.");
- new Stan[64], Float:X, Float:Y, Float:Z; GetPlayerPos(playerid, X, Y, Z);
- new NextStanID = ReturnNextUnusedStanID();
- new World = ReturnNextUnusedStanID();
- format(Stan, sizeof(Stan), "/Stanovi/stan%d.ini", NextStanID);
- if(!fexist(Stan))
- {
- new
- INI:stanFile = INI_Open(Stan);
- INI_WriteString(stanFile, "Name", "Nema");
- INI_WriteInt(stanFile, "For_Sell", 1);
- INI_WriteInt(stanFile, "Sell_Price", sellprice);
- INI_WriteInt(stanFile, "Rent_Price", 1000);
- INI_WriteInt(stanFile, "Stan_Level", StanLvl);
- INI_WriteFloat(stanFile, "Exit_Coord:X", X);
- INI_WriteFloat(stanFile, "Exit_Coord:Y", Y);
- INI_WriteFloat(stanFile, "Exit_Coord:Z", Z);
- INI_WriteInt(stanFile, "VirtualWorld", NextStanID);
- INI_WriteInt(stanFile, "Status", 0);
- INI_Close(stanFile);
- LoadPlayerStan(NextStanID);
- SendClientMessage(playerid, -1, ""CRVENA"[STAN]:"ZELENA" Stan je uspjesno napravljen.");
- }
- return true;
- }
- stock LoadPlayerStan(stanid)
- {
- new Stan[64];
- format(Stan, sizeof(Stan), "/Stanovi/stan%d.ini", stanid);
- if(fexist(Stan))
- {
- INI_ParseFile(Stan, "LoadStan_%s", .bExtra = true, .extra = stanid);
- /*format(StanInfo[Stanid][stName], MAX_PLAYER_NAME, "%s", dini_Get(Stan, "Name"));
- StanInfo[Stanid][stSellable] = dini_Int(Stan, "For_Sell");
- StanInfo[Stanid][stSell] = dini_Int(Stan, "Sell_Price");
- StanInfo[Stanid][stRent] = dini_Int(Stan, "Rent_Price");
- StanInfo[Stanid][stLevel] = dini_Int(Stan, "Stan_Level");
- StanInfo[Stanid][stExitX] = dini_Float(Stan, "Exit_Coord:X");
- StanInfo[Stanid][stExitY] = dini_Float(Stan, "Exit_Coord:Y");
- StanInfo[Stanid][stExitZ] = dini_Float(Stan, "Exit_Coord:Z");
- StanInfo[Stanid][stVirtualWorld] = dini_Int(Stan, "VirtualWorld");
- StanInfo[Stanid][stLocked] = dini_Int(Stan, "Status");*/
- new
- stanLabel[170];
- if(StanInfo[stanid][stSellable] == 1)
- {
- StanInfo[stanid][stPickup] = CreatePickup(1273, 23, StanInfo[stanid][stExitX], StanInfo[stanid][stExitY], StanInfo[stanid][stExitZ]); // not bought
- format(stanLabel, sizeof(stanLabel), ""ZELENA"[STAN NA PRODAJU]\n"CRVENA"Vlasnik:"ZUTA" %s\n"CRVENA"Level: "ZUTA"%d\n"CRVENA"Cijena: "ZUTA"%d\n"CRVENA"Cijena Renta: "ZUTA"%d", StanInfo[stanid][stName], StanInfo[stanid][stLevel], StanInfo[stanid][stSell], StanInfo[stanid][stRent]);
- Create3DTextLabel(stanLabel, -1, StanInfo[stanid][stExitX], StanInfo[stanid][stExitY], StanInfo[stanid][stExitZ], 13.0, 0);
- }
- else
- {
- StanInfo[stanid][stPickup] = CreatePickup(1272,23, StanInfo[stanid][stExitX], StanInfo[stanid][stExitY], StanInfo[stanid][stExitZ]); // bought
- format(stanLabel, sizeof(stanLabel), ""CRVENA"Vlasnik: "ZUTA"%s\n"CRVENA"Level: "ZUTA"%d\n"CRVENA"Cijena Renta: "ZUTA"%d", StanInfo[stanid][stName], StanInfo[stanid][stLevel], StanInfo[stanid][stRent]);
- Create3DTextLabel(stanLabel, -1, StanInfo[stanid][stExitX], StanInfo[stanid][stExitY], StanInfo[stanid][stExitZ], 13.0, 0);
- }
- }
- return true;
- }
- stock SpremiStanove(Stanid)
- {
- new
- Stan[64];
- format(Stan, sizeof(Stan), "/Stanovi/stan%d.ini", Stanid);
- if(fexist(Stan))
- {
- new INI:stanFile = INI_Open(Stan);
- INI_WriteString(stanFile, "Name", StanInfo[Stanid][stName]);
- INI_WriteInt(stanFile, "For_Sell", StanInfo[Stanid][stSellable]);
- INI_WriteInt(stanFile, "Sell_Price", StanInfo[Stanid][stSell]);
- INI_WriteInt(stanFile, "Rent_Price", StanInfo[Stanid][stRent]);
- INI_WriteInt(stanFile, "Stan_Level", StanInfo[Stanid][stLevel]);
- INI_WriteFloat(stanFile, "Exit_Coord:X", StanInfo[Stanid][stExitX]);
- INI_WriteFloat(stanFile, "Exit_Coord:Y", StanInfo[Stanid][stExitY]);
- INI_WriteFloat(stanFile, "Exit_Coord:Z", StanInfo[Stanid][stExitZ]);
- INI_WriteInt(stanFile, "VirtualWorld", StanInfo[Stanid][stVirtualWorld]);
- INI_WriteInt(stanFile, "Status", StanInfo[Stanid][stLocked]);
- INI_Close(stanFile);
- }
- return true;
- }
- stock ReturnNextUnusedStanID()
- {
- new Stan[64];
- for(new st = 0; st<= MAX_STANOVA; st++)
- {
- format(Stan, sizeof(Stan), "/Stanovi/stan%d.ini", st);
- if(!fexist(Stan)) return st;
- }
- return true;
- }
- stock UnistiStan(playerid, Stanid)
- {
- new Stan[64];
- format(Stan, sizeof(Stan), "/Stanovi/stan%d.ini", Stanid);
- if(fexist(Stan))
- {
- fremove(Stan);
- DestroyPickup(StanInfo[Stanid][stPickup]);
- SendClientMessage(playerid, -1, ""CRVENA"[STAN]:"ZELENA" Taj stan je unisten.");
- }
- else return SendClientMessage(playerid, -1, ""CRVENA"ERROR: "ZELENA"ID Stana kojeg zelite unistiti ne postoji!");
- return false;
- }
- stock GetName(playerid)
- {
- static
- pName[MAX_PLAYER_NAME];
- pName = "Invalid PlayerID";
- if(playerid != INVALID_PLAYER_ID)
- {
- GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
- }
- return pName;
- }
- stock SendFormattedMessage(playerid, colour, text[], va_args<>)
- {
- va_format(gChatMsg, 128, text, va_start<3>);
- SendClientMessage(playerid, colour, gChatMsg);
- return 1;
- }
Add Comment
Please, Sign In to add comment