Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define FILTERSCRIPT
- #include <a_samp>
- #include <float>
- #include <foreach>
- #include < YSI\y_ini >
- #include < YSI\y_amx >
- #include < YSI\y_commands >
- #include <Streamer>
- #include <sscanf2>
- #define COLOR_WHITE 0xFFFFFFAA
- #define GRAY 0xCECECEFF
- #define COLOR_LIGHTGREEN 0x9ACD32AA
- #define DIALOG_PMONEY 7000
- #define DIALOG_TMONEY 7001
- #define PRESSED(%0) \
- (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
- #define randomEx(%0,%1) (random((%1) - (%0)) + (%0))
- #define MAX_HOUSE 500
- enum Houses
- {
- hOwner[MAX_PLAYER_NAME],
- hOwned,
- hLocked,
- hAppointed,
- hMoney,
- hGun,
- hGunAmmo,
- hPrice,
- hInt,
- hLevel,
- Float:hEnterX,
- Float:hEnterY,
- Float:hEnterZ,
- Float:hExitX,
- Float:hExitZ,
- Float:hExitY
- };
- new HouseInfo[MAX_HOUSE][Houses];
- new HEID[MAX_PLAYERS];
- new HousePick[sizeof(HouseInfo)];
- new Text3D:HouseText[sizeof(HouseInfo)];
- public OnFilterScriptInit()
- {
- print(" Dinamican sistem kuca by Kevin(Bilsen Jahjagic)");
- new string[828];
- for(new h = 0; h < sizeof(HouseInfo); h++)
- {
- new gFile[35];
- format(gFile, 35, "Houses/%d.ini" ,h);
- INI_ParseFile(gFile, "LoadHouses", .bExtra = true, .extra = h);
- if(HouseInfo[h][hAppointed] == 1)
- {
- if(HouseInfo[h][hOwned] == 0)
- {
- format(string,sizeof(string),"{458B00}[Na prodaju] \n {458B00}[Adresa] - {FFFFFF}[%d] \n {458B00}[Cijena] - {FFFFFF}[$%d]\n {458B00}[Level] - {FFFFFF}[%d]", h, HouseInfo[h][hPrice], HouseInfo[h][hLevel]);
- HouseText[h] = CreateDynamic3DTextLabel(string ,0x00FF00AA, HouseInfo[h][hEnterX], HouseInfo[h][hEnterY], HouseInfo[h][hEnterZ], 10);
- HousePick[h] = CreateDynamicPickup(1273, 1, HouseInfo[h][hEnterX], HouseInfo[h][hEnterY], HouseInfo[h][hEnterZ]);
- }
- if(HouseInfo[h][hOwned] == 1)
- {
- format(string,sizeof(string),"{0033FF}[Vlasnik] - {FFFFFF}[%s] \n {0033FF}[Adresa] - {FFFFFF}[%d] \n {0033FF}[Level] - {FFFFFF}[%d]", HouseInfo[h][hOwner], h, HouseInfo[h][hLevel]);
- HouseText[h] = CreateDynamic3DTextLabel(string ,0x00FFFFAA, HouseInfo[h][hEnterX], HouseInfo[h][hEnterY], HouseInfo[h][hEnterZ], 10);
- HousePick[h] = CreateDynamicPickup(1273, 1, HouseInfo[h][hEnterX], HouseInfo[h][hEnterY], HouseInfo[h][hEnterZ]);
- }
- }
- }
- return 1;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- new name[24];
- if(PRESSED(KEY_SECONDARY_ATTACK))
- {
- for(new i = 0; i < sizeof(HouseInfo); i++)
- {
- if (IsPlayerInRangeOfPoint(playerid, 3, HouseInfo[i][hEnterX], HouseInfo[i][hEnterY], HouseInfo[i][hEnterZ]))
- {
- GetPlayerName(playerid, name, sizeof(name));
- if(HouseInfo[i][hLocked] == 0 || !strcmp(HouseInfo[i][hOwner], name, true ))
- {
- SetPlayerInterior(playerid, HouseInfo[i][hInt]); SetPlayerVirtualWorld(playerid, i);
- SetPlayerPos(playerid, HouseInfo[i][hExitX], HouseInfo[i][hExitY], HouseInfo[i][hExitZ]);
- HEID[playerid] = i;
- }
- else
- {
- GameTextForPlayer(playerid, "~r~Zakljucano", 5000, 1);
- return 1;
- }
- }
- }
- if(HEID[playerid] != -1)
- {
- for(new i = 0; i < sizeof(HouseInfo); i++)
- {
- if(IsPlayerInRangeOfPoint(playerid, 3, HouseInfo[i][hExitX], HouseInfo[i][hExitY], HouseInfo[i][hExitZ]))
- {
- SetPlayerInterior(playerid,0); SetPlayerVirtualWorld(playerid,0);
- SetPlayerPos(playerid, HouseInfo[HEID[playerid]][hEnterX], HouseInfo[HEID[playerid]][hEnterY], HouseInfo[HEID[playerid]][hEnterZ]);
- HEID[playerid] = -1;
- return 1;
- }
- }
- }
- }
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if(dialogid == DIALOG_PMONEY && response)
- {
- new novac, string[128];
- if(sscanf(inputtext, "i", novac))
- {
- ShowPlayerDialog(playerid, DIALOG_PMONEY, DIALOG_STYLE_INPUT, "Kuca", "Unesite kolicinu novca koju zelite da ostavite.", "Unesi", "Izadji");
- return 1;
- }
- if(novac > GetPlayerMoney(playerid))
- {
- SendClientMessage(playerid, GRAY, "Nemate toliko novca.");
- return 1;
- }
- if(novac < 1)
- {
- SendClientMessage(playerid, GRAY, "Suma ne moze biti manja od 1.");
- return 1;
- }
- HouseInfo[HEID[playerid]][hMoney] += novac;
- GivePlayerMoney(playerid,-novac);
- format(string, sizeof(string), "Stavili ste $%d u sef.", novac);
- SendClientMessage(playerid, COLOR_WHITE, string);
- SaveHouse(HEID[playerid]);
- return 1;
- }
- if(dialogid == DIALOG_TMONEY && response)
- {
- new novac, string[128];
- if(sscanf(inputtext, "i", novac))
- {
- ShowPlayerDialog(playerid, DIALOG_TMONEY, DIALOG_STYLE_INPUT, "Kuca", "Unesite kolicinu novca koju zelite da uzmete.", "Unesi", "Izadji");
- return 1;
- }
- if(novac > HouseInfo[HEID[playerid]][hMoney])
- {
- SendClientMessage(playerid, GRAY, "Nemate toliko novca u kuci.");
- return 1;
- }
- if(novac < 1)
- {
- SendClientMessage(playerid, GRAY, "Suma ne moze biti manja od 1.");
- return 1;
- }
- HouseInfo[HEID[playerid]][hMoney] -= novac;
- GivePlayerMoney(playerid, novac);
- format(string, sizeof(string), "Uzeli ste $%d iz sefa.", novac);
- SendClientMessage(playerid, COLOR_WHITE, string);
- SaveHouse(HEID[playerid]);
- return 1;
- }
- return 0;
- }
- stock SaveHouse(h)
- {
- new dFile[128];
- format(dFile, sizeof(dFile),"Houses/%d.ini",h);
- new
- INI:File = INI_Open(dFile);
- INI_WriteString(File, "Vlasnik", HouseInfo[h][hOwner]);
- INI_WriteInt(File, "Posjedovana", HouseInfo[h][hOwned]);
- INI_WriteInt(File, "Zakljucana", HouseInfo[h][hLocked]);
- INI_WriteInt(File, "Postavljena", HouseInfo[h][hAppointed]);
- INI_WriteInt(File, "Level", HouseInfo[h][hLevel]);
- INI_WriteInt(File, "Cijena", HouseInfo[h][hPrice]);
- INI_WriteInt(File, "Novac", HouseInfo[h][hMoney]);
- INI_WriteInt(File, "Oruzije", HouseInfo[h][hGun]);
- INI_WriteInt(File, "Metkovi", HouseInfo[h][hGunAmmo]);
- INI_WriteFloat(File, "UlazX", HouseInfo[h][hEnterX]);
- INI_WriteFloat(File, "UlazY", HouseInfo[h][hEnterY]);
- INI_WriteFloat(File, "UlazZ", HouseInfo[h][hEnterZ]);
- INI_WriteInt(File, "Enterijer", HouseInfo[h][hInt]);
- INI_WriteFloat(File, "IzlazX", HouseInfo[h][hExitX]);
- INI_WriteFloat(File, "IzlazY", HouseInfo[h][hExitY]);
- INI_WriteFloat(File, "IzlazZ", HouseInfo[h][hExitZ]);
- INI_Close(File);
- }
- forward LoadHouses(h, name[], value[]);
- public LoadHouses(h, name[], value[])
- {
- INI_String("Vlasnik", HouseInfo[h][hOwner], 24);
- INI_Int("Posjedovana", HouseInfo[h][hOwned]);
- INI_Int("Zakljucana", HouseInfo[h][hLocked]);
- INI_Int("Postavljena", HouseInfo[h][hAppointed]);
- INI_Int("Level", HouseInfo[h][hLevel]);
- INI_Int("Cijena", HouseInfo[h][hPrice]);
- INI_Int("Novac", HouseInfo[h][hMoney]);
- INI_Int("Oruzije", HouseInfo[h][hGun]);
- INI_Int("Metkovi", HouseInfo[h][hGunAmmo]);
- INI_Float("UlazX", HouseInfo[h][hEnterX]);
- INI_Float("UlazY", HouseInfo[h][hEnterY]);
- INI_Float("UlazZ", HouseInfo[h][hEnterZ]);
- INI_Int("Enterijer", HouseInfo[h][hInt]);
- INI_Float("IzlazX", HouseInfo[h][hExitX]);
- INI_Float("IzlazY", HouseInfo[h][hExitY]);
- INI_Float("IzlazZ", HouseInfo[h][hExitZ]);
- return 1;
- }
- stock TPUpdate(h)
- {
- new string[828];
- DestroyDynamicPickup(HousePick[h]);
- DestroyDynamic3DTextLabel(HouseText[h]);
- if(HouseInfo[h][hOwned] == 0)
- {
- format(string,sizeof(string),"{458B00}[Na prodaju] \n {458B00}[Adresa] - {FFFFFF}[%d] \n {458B00}[Cijena] - {FFFFFF}[$%d]\n {458B00}[Level] - {FFFFFF}[%d]", h, HouseInfo[h][hPrice], HouseInfo[h][hLevel]);
- HouseText[h] = CreateDynamic3DTextLabel(string ,0x00FF00AA, HouseInfo[h][hEnterX], HouseInfo[h][hEnterY], HouseInfo[h][hEnterZ], 10);
- HousePick[h] = CreateDynamicPickup(1273, 1, HouseInfo[h][hEnterX], HouseInfo[h][hEnterY], HouseInfo[h][hEnterZ]);
- }
- if(HouseInfo[h][hOwned] == 1)
- {
- format(string,sizeof(string),"{0033FF}[Vlasnik] - {FFFFFF}[%s] \n {0033FF}[Adresa] - {FFFFFF}[%d] \n {0033FF}[Level] - {FFFFFF}[%d]", HouseInfo[h][hOwner], h, HouseInfo[h][hLevel]);
- HouseText[h] = CreateDynamic3DTextLabel(string ,0x00FFFFAA, HouseInfo[h][hEnterX], HouseInfo[h][hEnterY], HouseInfo[h][hEnterZ], 10);
- HousePick[h] = CreateDynamicPickup(1272, 1, HouseInfo[h][hEnterX], HouseInfo[h][hEnterY], HouseInfo[h][hEnterZ]);
- }
- }
- stock RemovePlayerWeapon(playerid, weaponid)
- {
- new plyWeapons[12];
- new plyAmmo[12];
- for(new slot = 0; slot != 12; slot++)
- {
- new wep, ammo;
- GetPlayerWeaponData(playerid, slot, wep, ammo);
- if(wep != weaponid)
- {
- GetPlayerWeaponData(playerid, slot, plyWeapons[slot], plyAmmo[slot]);
- }
- }
- ResetPlayerWeapons(playerid);
- for(new slot = 0; slot != 12; slot++)
- {
- GivePlayerWeapon(playerid, plyWeapons[slot], plyAmmo[slot]);
- }
- }
- YCMD:h(playerid, params[], help)
- {
- new string[128];
- new text[24];
- new name[24];
- if(sscanf(params, "s[24]",text))
- {
- SendClientMessage(playerid, COLOR_LIGHTGREEN, "________________Kuca________________");
- SendClientMessage(playerid, GRAY, "** Kuca ** Koristenje:(/house [ime])");
- SendClientMessage(playerid, GRAY, "** Kuca ** Dostupna imena: buy, sell, info, lock, locate");
- SendClientMessage(playerid, GRAY, "** Kuca ** Dostupna imena: putmoney, takemoney, putgun, takegun");
- SendClientMessage(playerid, COLOR_LIGHTGREEN, "______________________________________");
- return 1;
- }
- if(strcmp(text,"buy", true) == 0)
- {
- for(new i = 0; i < sizeof(HouseInfo); i++)
- {
- GetPlayerName(playerid, name, sizeof(name));
- if(strcmp(HouseInfo[i][hOwner], name, true))
- {
- SendClientMessage(playerid, GRAY, "Vec posjedujete kucu!");
- return 1;
- }
- if(IsPlayerInRangeOfPoint(playerid, 3, HouseInfo[i][hEnterX], HouseInfo[i][hEnterY], HouseInfo[i][hEnterZ]) && HouseInfo[i][hOwned] == 0)
- {
- if(GetPlayerMoney(playerid) < HouseInfo[i][hPrice])
- {
- SendClientMessage(playerid, GRAY, "Nemate dovoljno novca za kupovinu ove kuce!");
- return 1;
- }
- if(GetPlayerScore(playerid) < HouseInfo[i][hLevel])
- {
- SendClientMessage(playerid, GRAY, "Nemate dovoljan level za kupovinu ove kuce!");
- return 1;
- }
- format(HouseInfo[i][hOwner], 24, "%s", name);
- HouseInfo[i][hOwned] = 1;
- GivePlayerMoney(playerid, -HouseInfo[i][hPrice]);
- SendClientMessage(playerid, COLOR_WHITE, "Cestitamo na kupovini nove kuce!");
- TPUpdate(i);
- SaveHouse(i);
- return 1;
- }
- }
- return 1;
- }
- if(strcmp(text,"sell", true) == 0)
- {
- for(new i = 0; i < sizeof(HouseInfo); i++)
- {
- GetPlayerName(playerid, name, sizeof(name));
- if(IsPlayerInRangeOfPoint(playerid, 3, HouseInfo[i][hEnterX], HouseInfo[i][hEnterY], HouseInfo[i][hEnterZ]) && !strcmp(HouseInfo[i][hOwner], name, true))
- {
- format(HouseInfo[i][hOwner], 24, "Drzava");
- HouseInfo[i][hOwned] = 0;
- HouseInfo[i][hLocked] = 1;
- TPUpdate(i);
- SaveHouse(i);
- return 1;
- }
- }
- return 1;
- }
- if(strcmp(text,"info", true) == 0)
- {
- for(new i = 0; i < sizeof(HouseInfo); i++)
- {
- GetPlayerName(playerid, name, sizeof(name));
- if(IsPlayerInRangeOfPoint(playerid, 10, HouseInfo[i][hExitX], HouseInfo[i][hExitY], HouseInfo[i][hExitZ]) && !strcmp(HouseInfo[i][hOwner], name, true))
- {
- format(string, sizeof(string), "Novac: %d\nOruzije: %d(%d)", HouseInfo[i][hMoney], HouseInfo[i][hGun], HouseInfo[i][hGunAmmo]);
- ShowPlayerDialog( playerid, 6677, DIALOG_STYLE_MSGBOX, "Kucni Sef", string, "Ok", "" );
- }
- }
- return 1;
- }
- if(strcmp(text,"lock", true) == 0)
- {
- for(new i = 0; i < sizeof(HouseInfo); i++)
- {
- GetPlayerName(playerid, name, sizeof(name));
- if(IsPlayerInRangeOfPoint(playerid, 3, HouseInfo[i][hEnterX], HouseInfo[i][hEnterY], HouseInfo[i][hEnterZ]) && !strcmp(HouseInfo[i][hOwner], name, true) && GetPlayerVirtualWorld(playerid) == i || IsPlayerInRangeOfPoint(playerid, 3, HouseInfo[i][hExitX], HouseInfo[i][hExitY], HouseInfo[i][hExitZ]) && !strcmp(HouseInfo[i][hOwner], name, true) && GetPlayerVirtualWorld(playerid) == i)
- {
- if(HouseInfo[i][hLocked] == 0)
- {
- HouseInfo[i][hLocked] = 1;
- SendClientMessage(playerid, COLOR_WHITE, "Zakljucali ste kucu!");
- return 1;
- }
- else
- {
- HouseInfo[i][hLocked] = 0;
- SendClientMessage(playerid, COLOR_WHITE, "Otkljucali ste kucu!");
- return 1;
- }
- }
- }
- return 1;
- }
- if(strcmp(text,"locate", true) == 0)
- {
- for(new i = 0; i < sizeof(HouseInfo); i++)
- {
- GetPlayerName(playerid, name, sizeof(name));
- if(!strcmp(HouseInfo[i][hOwner], name, true))
- {
- SetPlayerCheckpoint(playerid, HouseInfo[i][hEnterX], HouseInfo[i][hEnterY], HouseInfo[i][hEnterZ], 5.0);
- SendClientMessage(playerid, COLOR_WHITE, "Vasa kuca je oznacena na mapi crvenim markerom!");
- return 1;
- }
- else
- {
- SendClientMessage(playerid, GRAY, "Vi ne posjedujete kucu!");
- return 1;
- }
- }
- return 1;
- }
- if(strcmp(text,"putmoney", true) == 0)
- {
- for(new i = 0; i < sizeof(HouseInfo); i++)
- {
- GetPlayerName(playerid, name, sizeof(name));
- if(IsPlayerInRangeOfPoint(playerid, 10, HouseInfo[i][hExitX], HouseInfo[i][hExitY], HouseInfo[i][hExitZ]) && !strcmp(HouseInfo[i][hOwner], name, true))
- {
- ShowPlayerDialog(playerid, DIALOG_PMONEY, DIALOG_STYLE_INPUT, "Kuca", "Unesite kolicinu novca koju zelite da ostavite.", "Unesi", "Izadji");
- return 1;
- }
- }
- return 1;
- }
- if(strcmp(text,"takemoney", true) == 0)
- {
- for(new i = 0; i < sizeof(HouseInfo); i++)
- {
- GetPlayerName(playerid, name, sizeof(name));
- if(IsPlayerInRangeOfPoint(playerid, 10, HouseInfo[i][hExitX], HouseInfo[i][hExitY], HouseInfo[i][hExitZ]) && !strcmp(HouseInfo[i][hOwner], name, true))
- {
- ShowPlayerDialog(playerid, DIALOG_TMONEY, DIALOG_STYLE_INPUT, "Kuca", "Unesite kolicinu novca koju zelite da uzmete.", "Unesi", "Izadji");
- return 1;
- }
- }
- return 1;
- }
- if(strcmp(text,"putgun", true) == 0)
- {
- new gname[24];
- for(new i = 0; i < sizeof(HouseInfo); i++)
- {
- GetPlayerName(playerid, name, sizeof(name));
- if(IsPlayerInRangeOfPoint(playerid, 10, HouseInfo[i][hExitX], HouseInfo[i][hExitY], HouseInfo[i][hExitZ]) && !strcmp(HouseInfo[i][hOwner], name, true))
- {
- if(HouseInfo[i][hGun] != 0) return SendClientMessage(playerid, GRAY, "U sefu vec ima oruzije!");
- if(GetPlayerWeapon(playerid) != 0 && GetPlayerAmmo(playerid) != 0)
- {
- GetWeaponName(GetPlayerWeapon(playerid), gname, sizeof(gname));
- RemovePlayerWeapon(playerid, GetPlayerWeapon(playerid));
- HouseInfo[i][hGun] = GetPlayerWeapon(playerid);
- HouseInfo[i][hGunAmmo] = GetPlayerAmmo(playerid);
- format(string, sizeof(string), "Stavili ste %s u sef.", gname);
- SendClientMessage(playerid, COLOR_WHITE, string);
- SaveHouse(i);
- }
- else
- {
- SendClientMessage(playerid, GRAY, "Nemate oruzije ili u njemu nema metaka!");
- }
- return 1;
- }
- }
- return 1;
- }
- if(strcmp(text,"takegun", true) == 0)
- {
- new gname[24];
- for(new i = 0; i < sizeof(HouseInfo); i++)
- {
- GetPlayerName(playerid, name, sizeof(name));
- if(IsPlayerInRangeOfPoint(playerid, 10, HouseInfo[i][hExitX], HouseInfo[i][hExitY], HouseInfo[i][hExitZ]) && !strcmp(HouseInfo[i][hOwner], name, true))
- {
- if(HouseInfo[i][hGun] != 0)
- {
- GivePlayerWeapon(playerid, HouseInfo[i][hGun], HouseInfo[i][hGunAmmo]);
- GetWeaponName(HouseInfo[i][hGun], gname, sizeof(gname));
- format(string, sizeof(string), "Uzeli ste %s iz sefa.", gname);
- SendClientMessage(playerid, COLOR_WHITE, string);
- HouseInfo[i][hGun] = 0;
- HouseInfo[i][hGunAmmo] = 0;
- SaveHouse(i);
- }
- else
- {
- SendClientMessage(playerid, GRAY, "U sefu nema oruzije!");
- }
- return 1;
- }
- }
- return 1;
- }
- return 1;
- }
- YCMD:createhouse(playerid, params[], help)
- {
- new Float:X, Float:Y, Float:Z; new hid = 0;
- new cijena, level, entr;
- if(IsPlayerAdmin(playerid))
- {
- if(sscanf(params, "iii",cijena, level, entr))
- {
- SendClientMessage(playerid, GRAY, "/createhouse [cijena] [level] [enterijer]");
- return 1;
- }
- GetPlayerPos(playerid, X,Y,Z);
- for(new h = 1; h < sizeof(HouseInfo); h++)
- {
- if(HouseInfo[h][hAppointed] == 1)
- {
- hid = h + 1;
- }
- if(hid == 0)
- {
- hid = 1;
- }
- }
- if(entr < 1 || entr > 5)
- {
- SendClientMessage(playerid, GRAY, "Enterijer ne moze biti manji od 1 ni veci od 5.");
- return 1;
- }
- format(HouseInfo[hid][hOwner], 24, "%s", "Drzava");
- HouseInfo[hid][hEnterX] = X;
- HouseInfo[hid][hEnterY] = Y;
- HouseInfo[hid][hEnterZ] = Z;
- HouseInfo[hid][hOwned] = 0;
- HouseInfo[hid][hAppointed] = 1;
- HouseInfo[hid][hLocked] = 0;
- HouseInfo[hid][hMoney] = 0;
- HouseInfo[hid][hGun] = 0;
- HouseInfo[hid][hGunAmmo] = 0;
- HouseInfo[hid][hPrice] = cijena;
- HouseInfo[hid][hLevel] = level;
- TPUpdate(hid);
- SendClientMessage(playerid, COLOR_WHITE, "Napravili ste novu kucu!");
- if(entr == 1)
- {
- HouseInfo[hid][hExitX] = 2308.7400;
- HouseInfo[hid][hExitY] = -1212.4301;
- HouseInfo[hid][hExitZ] = 1049.0234;
- HouseInfo[hid][hInt] = 6;
- SaveHouse(hid);
- return 1;
- }
- else if(entr == 2)
- {
- HouseInfo[hid][hExitX] = 244.4120;
- HouseInfo[hid][hExitY] = 305.0330;
- HouseInfo[hid][hExitZ] = 999.1484;
- HouseInfo[hid][hInt] = 1;
- SaveHouse(hid);
- return 1;
- }
- else if(entr == 3)
- {
- HouseInfo[hid][hExitX] = 267.1469;
- HouseInfo[hid][hExitY] = 304.9806;
- HouseInfo[hid][hExitZ] = 999.1484;
- HouseInfo[hid][hInt] = 2;
- SaveHouse(hid);
- return 1;
- }
- else if(entr == 4)
- {
- HouseInfo[hid][hExitX] = 2259.9094;
- HouseInfo[hid][hExitY] = -1135.8812;
- HouseInfo[hid][hExitZ] = 1050.6328;
- HouseInfo[hid][hInt] = 10;
- SaveHouse(hid);
- return 1;
- }
- else if(entr == 5)
- {
- HouseInfo[hid][hExitX] = 318.5494;
- HouseInfo[hid][hExitY] = 1115.0696;
- HouseInfo[hid][hExitZ] = 1083.8828;
- HouseInfo[hid][hInt] = 5;
- SaveHouse(hid);
- return 1;
- }
- }
- return 1;
- }
- YCMD:deletehouse(playerid, params[], help)
- {
- new id, remv[24], string[64];
- if(IsPlayerAdmin(playerid))
- {
- if(sscanf(params, "i", id))
- {
- SendClientMessage(playerid, GRAY, "/deletehouse [id kuce]");
- return 1;
- }
- if(HouseInfo[id][hAppointed] == 1)
- {
- HouseInfo[id][hAppointed] = 0;
- HouseInfo[id][hEnterX] = 0;
- HouseInfo[id][hEnterY] = 0;
- HouseInfo[id][hEnterZ] = 0;
- DestroyDynamic3DTextLabel(HouseText[id]);
- DestroyDynamicPickup(HousePick[id]);
- format(string, sizeof(string),"Unistili ste kucu id %d.", id);
- SendClientMessage(playerid, COLOR_WHITE, string);
- format(remv, sizeof(remv),"Houses/%d.ini", id);
- fremove(remv);
- return 1;
- }
- }
- return 1;
- }
- YCMD:edithouse(playerid, params[], help)
- {
- if(IsPlayerAdmin(playerid))
- {
- new izbor[48]; new kolicina;
- if(sscanf(params, "s[24]i", izbor, kolicina))
- {
- SendClientMessage(playerid, GRAY, "/edithouse cijena/level/int [kolicina]");
- return 1;
- }
- if(strcmp(izbor,"cijena",true) == 0)
- {
- if(kolicina < 1)
- {
- SendClientMessage(playerid, GRAY, "Cijena ne moze biti manja od 1.");
- return 1;
- }
- for(new i = 0; i < sizeof(HouseInfo); i++)
- {
- new string[128];
- if(IsPlayerInRangeOfPoint(playerid, 3, HouseInfo[i][hEnterX], HouseInfo[i][hEnterY], HouseInfo[i][hEnterZ]))
- {
- HouseInfo[i][hPrice] = kolicina;
- format(string, sizeof(string), "Postavili ste cijenu kuce %d na $%d.", i, kolicina);
- SendClientMessage(playerid, COLOR_WHITE, string);
- TPUpdate(i);
- SaveHouse(i);
- return 1;
- }
- }
- return 1;
- }
- if(strcmp(izbor,"level",true) == 0)
- {
- if(kolicina < 1)
- {
- SendClientMessage(playerid, GRAY, "Level ne moze biti manji od 1.");
- return 1;
- }
- for(new i = 0; i < sizeof(HouseInfo); i++)
- {
- new string[128];
- if(IsPlayerInRangeOfPoint(playerid, 3, HouseInfo[i][hEnterX], HouseInfo[i][hEnterY], HouseInfo[i][hEnterZ]))
- {
- HouseInfo[i][hLevel] = kolicina;
- format(string, sizeof(string), "Postavili ste level kuce %d na %d.", i, kolicina);
- SendClientMessage(playerid, COLOR_WHITE, string);
- TPUpdate(i);
- SaveHouse(i);
- return 1;
- }
- }
- return 1;
- }
- if(strcmp(izbor,"int",true) == 0)
- {
- if(kolicina < 1 || kolicina > 5)
- {
- SendClientMessage(playerid,GRAY,"Enterijer ne moze biti manji od 1 ni veci od 5!");
- return 1;
- }
- for(new i = 0; i < sizeof(HouseInfo); i++)
- {
- new string[128];
- if(IsPlayerInRangeOfPoint(playerid, 3, HouseInfo[i][hEnterX], HouseInfo[i][hEnterY], HouseInfo[i][hEnterZ]))
- {
- if(kolicina == 1)
- {
- HouseInfo[i][hExitX] = 2308.7400;
- HouseInfo[i][hExitY] = -1212.4301;
- HouseInfo[i][hExitZ] = 1049.0234;
- HouseInfo[i][hInt] = 6;
- SaveHouse(i);
- format(string, sizeof(string), "Postavili ste enterijer kuce %d na %d.", i, kolicina);
- SendClientMessage(playerid, COLOR_WHITE, string);
- return 1;
- }
- if(kolicina == 2)
- {
- HouseInfo[i][hExitX] = 244.4120;
- HouseInfo[i][hExitY] = 305.0330;
- HouseInfo[i][hExitZ] = 999.1484;
- HouseInfo[i][hInt] = 1;
- SaveHouse(i);
- format(string, sizeof(string), "Postavili ste enterijer kuce %d na %d.", i, kolicina);
- SendClientMessage(playerid, COLOR_WHITE, string);
- return 1;
- }
- if(kolicina == 3)
- {
- HouseInfo[i][hExitX] = 267.1469;
- HouseInfo[i][hExitY] = 304.9806;
- HouseInfo[i][hExitZ] = 999.1484;
- HouseInfo[i][hInt] = 2;
- SaveHouse(i);
- format(string, sizeof(string), "Postavili ste enterijer kuce %d na %d.", i, kolicina);
- SendClientMessage(playerid, COLOR_WHITE, string);
- return 1;
- }
- if(kolicina == 4)
- {
- HouseInfo[i][hExitX] = 2259.9094;
- HouseInfo[i][hExitY] = -1135.8812;
- HouseInfo[i][hExitZ] = 1050.6328;
- HouseInfo[i][hInt] = 10;
- SaveHouse(i);
- format(string, sizeof(string), "Postavili ste enterijer kuce %d na %d.", i, kolicina);
- SendClientMessage(playerid, COLOR_WHITE, string);
- return 1;
- }
- if(kolicina == 5)
- {
- HouseInfo[i][hExitX] = 318.5494;
- HouseInfo[i][hExitY] = 1115.0696;
- HouseInfo[i][hExitZ] = 1083.8828;
- HouseInfo[i][hInt] = 5;
- SaveHouse(i);
- format(string, sizeof(string), "Postavili ste enterijer kuce %d na %d.", i, kolicina);
- SendClientMessage(playerid, COLOR_WHITE, string);
- return 1;
- }
- }
- }
- return 1;
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment