Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- // ===========================================================================================================================================================================================
- // Dynamic Biz System - Dayrion - v1
- // ===========================================================================================================================================================================================
- //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- #define FILTERSCRIPT
- #include <a_samp>
- #include <izcmd>
- #include <sscanf2>
- #include <foreach>
- #include <YSI\y_ini>
- #include <easyDialog>
- //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- #if defined FILTERSCRIPT
- //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- #define RED 0xFF0000FF
- #define WHITE 0xFFFFFFFF
- #define BLUE 0x99CCFFFF
- #define LBLUE 0x99D6FFFF
- #define GREEN 0x008000FF
- #define BROWN 0x9E3E3EFF
- #define RED_U "{FF0000}"
- #define WHITE_U "{FFFFFF}"
- #define BLUE_U "{66A3FF}"
- #define LBLUE_U "{99D6FF}"
- #define GREEN_U "{39AC39}"
- #define BROWN_U "{9E3E3E}"
- #define ORANGE_U "{ffc34d}"
- #define X11_CORNSILK_2 0xEEE8CDFF
- #define X11_PEACH_PUFF_2 0xEECBADFF
- #define X11_NAVAJO_WHITE_1 0xFFDEADFF
- #define X11_NAVAJO_WHITE_2 0xEECFA1FF
- //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- #define MAX_BIZ 100 // Number of biz
- #define MAX_BALANCE 1000000 // Max amount of money in a biz
- #define MAX_BIZ_NAME 24 // The max lengh of a biz's name
- #define INVALID_BIZ_ID (MAX_BIZ+10)*2 // Don't change this
- /*Recommanded pickup ID :
- » 19523 - 19524 - 1275 - 1247 - 1318 */
- #define ICON_BIZ_LOCKED 19522
- #define ICON_BIZ_OPEN 1273
- #define ICON_BIZ_PENDING 1272
- #define ICON_BIZ_INTERIOR 1239
- #define DIALOG(%0) Dialog:%0(playerid, response, listitem, inputtext[])
- //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- //Please, don't remove/change this.
- #if MAX_BIZ_NAME < 12
- #error "MAX_BIZ_NAME is too short. [Min 12]"
- #endif
- #if MAX_BALANCE < 1
- #error "MAX_BALANCE need to be higher than 1$"
- #endif
- #if MAX_BIZ < 1
- #error "MAX_BIZ need to be higher than 0"
- #endif
- //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- // ===========================================================================================================================================================================================
- // Variables
- // ===========================================================================================================================================================================================
- //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- enum bizInfos
- {
- bID,
- bPickupID,
- bPickupEnter,
- bType,
- bInterior,
- bLevel,
- bPrice,
- Float:bX,
- Float:bY,
- Float:bZ,
- Float:beX,
- Float:beY,
- Float:beZ,
- bool:bBuy,
- bOwner[24],
- bool:bCreated,
- bSafe,
- bool:bOpen,
- bEnterPrice,
- bName[MAX_BIZ_NAME],
- bVW,
- bool:bInvestor
- };
- enum investor
- {
- iID,
- iName[24],
- bool:iInves,
- bool:iSafe,
- bool:iLock,
- bool:iEnterPrice,
- bool:iRename,
- bool:iDeposit,
- bool:iWithdraw
- };
- enum BizType
- {
- Float:X,
- Float:Y,
- Float:Z,
- Interior,
- Name[50]
- };
- new Gym[][BizType] =
- {
- {772.111999,-3.898649,1000.728820, 5, "LS Gym"},
- {774.213989,-48.924297,1000.585937, 6, "SF Gym"},
- {773.579956,-77.096694,1000.655029, 7, "LV Gym"}
- };
- new Int247[][BizType] =
- {
- {-25.884498,-185.868988,1003.546875, 17, "24/7 1 - (Need mapping)"},
- {6.091179,-29.271898,1003.549438, 10, "24/7 2 - (Need mapping)"},
- {-30.946699,-89.609596,1003.546875, 18, "24/7 3 - (Need mapping)"},
- {-25.132598,-139.066986,1003.546875, 16, "24/7 4"},
- {-27.312299,-29.277599,1003.557250, 4, "24/7 5 - (Need a bit of mapping)"},
- {-26.691598,-55.714897,1003.546875, 6, "24/7 6"}
- };
- new Ammunation[][BizType] =
- {
- {286.148986,-40.644397,1001.515625, 1, "Ammunation 1"},
- {286.800994,-82.547599,1001.515625, 4, "Ammunation 2"},
- {296.6996,-110.8405,1001.5156, 6, "Ammunation 3"},
- {316.524993,-167.706985,999.593750, 6, "Ammunation 4"}
- };
- new Shop[][BizType] =
- {
- {-100.4078,-24.5987,1000.7188, 3, "Sex Shop"},
- {963.418762,2108.292480,1011.030273, 1, "Meat Factory"},
- {-2240.468505,137.060440,1035.414062, 6, "Zero's RC Shop"}
- };
- new Clothes[][BizType] =
- {
- {207.737991,-109.019996,1005.132812, 15, "Binco"},
- {204.332992,-166.694992,1000.523437, 14, "Didier Sachs"},
- {207.054992,-138.804992,1003.507812, 3, "Prolaps"},
- {203.777999,-48.492397,1001.804687, 1, "Suburban"},
- {226.293991,-7.431529,1002.210937, 5, "Victim"},
- {161.391006,-93.159156,1001.804687, 18, "Zip"}
- };
- new Food[][BizType] =
- {
- {501.980987,-69.150199,998.757812, 11, "Bar"},
- {-227.027999,1401.229980,27.765625, 18, "Lil' probe inn"},
- {457.304748,-88.428497,999.554687, 4, "Jay's diner"},
- {363.4929,-74.7067,1001.5078, 10, "Burger Shot"},
- {364.9168,-11.0500,1001.8516, 9, "Clukin' Bell"},
- {372.3154,-132.9696,1001.4922, 5, "Well Stacked pizza"},
- {377.3160,-192.9741,1000.6401, 17, "Rusty Browns donuts"}
- };
- new InteriorName[][] =
- {
- "Unknown",
- "24/7",
- "Ammunation",
- "Store",
- "Clothes Shop",
- "Food Chain",
- "Sport"
- };
- //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- new BizCreating[MAX_PLAYERS] = -1,
- BizInfo[MAX_BIZ][bizInfos],
- BizInv[MAX_BIZ][investor],
- CurrentMaxbizid = -1,
- Text3D:BizLabelID[MAX_BIZ],
- Text3D:BizLabelEnterID[MAX_BIZ],
- LastBizVisited[MAX_PLAYERS] = INVALID_BIZ_ID,
- BizVW = 214799999;
- //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- // ===========================================================================================================================================================================================
- // Callback
- // ===========================================================================================================================================================================================
- //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- forward LoadBiz_data(bizid,name[],value[]);
- public LoadBiz_data(bizid,name[],value[])
- {
- INI_Int("ID",BizInfo[bizid][bID]);
- INI_Int("PickupID",BizInfo[bizid][bPickupID]);
- INI_Int("PickupEnter",BizInfo[bizid][bPickupEnter]);
- INI_Int("Type",BizInfo[bizid][bType]);
- INI_Int("Interior",BizInfo[bizid][bInterior]);
- INI_Int("Level",BizInfo[bizid][bLevel]);
- INI_Int("Price",BizInfo[bizid][bPrice]);
- INI_Float("X",BizInfo[bizid][bX]);
- INI_Float("Y",BizInfo[bizid][bY]);
- INI_Float("Z",BizInfo[bizid][bZ]);
- INI_Float("eX",BizInfo[bizid][beX]);
- INI_Float("eY",BizInfo[bizid][beY]);
- INI_Float("eZ",BizInfo[bizid][beZ]);
- INI_Bool("Bought",BizInfo[bizid][bBuy]);
- INI_String("Owner",BizInfo[bizid][bOwner], MAX_PLAYER_NAME);
- INI_Bool("Existing",BizInfo[bizid][bCreated]);
- INI_Int("Safe",BizInfo[bizid][bSafe]);
- INI_Bool("Open",BizInfo[bizid][bOpen]);
- INI_Int("EnterPrice",BizInfo[bizid][bEnterPrice]);
- INI_String("Name",BizInfo[bizid][bName], MAX_BIZ_NAME);
- INI_Int("VirtualWorld",BizInfo[bizid][bVW]);
- INI_Bool("Investor",BizInfo[bizid][bInvestor]);
- return 1;
- }
- BizPath(bizid)
- {
- static str[90];
- format(str,sizeof(str), "/BizData/Biz/%i.ini", bizid);
- return str;
- }
- InvestorPath(bizid)
- {
- static str[90];
- format(str, sizeof(str), "/BizData/Investor/%i.ini", bizid);
- return str;
- }
- forward LoadBizInv_data(bizid, name[], value[]);
- public LoadBizInv_data(bizid, name[], value[])
- {
- INI_Int("ID",BizInv[bizid][iID]);
- INI_String("Name",BizInv[bizid][iName], MAX_PLAYER_NAME);
- INI_Bool("Inves",BizInv[bizid][iInves]);
- INI_Bool("Safe",BizInv[bizid][iSafe]);
- INI_Bool("Lock",BizInv[bizid][iLock]);
- INI_Bool("EnterPrice",BizInv[bizid][iEnterPrice]);
- INI_Bool("Rename",BizInv[bizid][iRename]);
- INI_Bool("Deposit",BizInv[bizid][iDeposit]);
- INI_Bool("Withdraw",BizInv[bizid][iWithdraw]);
- return 1;
- }
- //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- public OnFilterScriptInit()
- {
- print("\n---------------------------");
- print("»»» Biz FS [Version 1.1] «««");
- print("---------------------------\n");
- for (new i; i < MAX_BIZ; i++)
- {
- if(!fexist(InvestorPath(i)))
- {
- new INI:File = INI_Open(InvestorPath(i));
- INI_SetTag(File, "Stats");
- INI_WriteInt(File,"ID",i);
- INI_WriteString(File,"Name", "Nobody");
- INI_WriteBool(File,"Inves",BizInv[i][iInves]);
- INI_WriteBool(File,"Safe",BizInv[i][iLock]);
- INI_WriteBool(File,"Safe",BizInv[i][iSafe]);
- INI_WriteBool(File,"EnterPrice",BizInv[i][iEnterPrice]);
- INI_WriteBool(File,"Rename",BizInv[i][iRename]);
- INI_WriteBool(File,"Deposit",BizInv[i][iDeposit]);
- INI_WriteBool(File,"Withdraw",BizInv[i][iWithdraw]);
- INI_Close(File);
- INI_ParseFile(InvestorPath(i), "LoadBizInv_data", .bExtra = true, .extra = i);
- printf("Loading... | Investor Biz ID %i | Created", i);
- }
- else
- {
- INI_ParseFile(InvestorPath(i), "LoadBizInv_data", .bExtra = true, .extra = i);
- //printf("Loading... | Investor Biz ID %i | Loaded", i);
- }
- }
- for (new i; i<MAX_BIZ; i++)
- {
- if(!fexist(BizPath(i)))
- {
- BizInfo[i][bInterior] = -1;
- BizInfo[i][bPickupID] = -1;
- BizInfo[i][bPickupEnter] = -1;
- new INI:File = INI_Open(BizPath(i));
- INI_SetTag(File, "Stats");
- INI_WriteInt(File,"ID",i);
- INI_WriteInt(File,"PickupID",BizInfo[i][bPickupID]);
- INI_WriteInt(File,"PickupEnter",BizInfo[i][bPickupEnter]);
- INI_WriteInt(File,"Type",BizInfo[i][bType]);
- INI_WriteInt(File,"Interior",BizInfo[i][bInterior]);
- INI_WriteInt(File,"Level",BizInfo[i][bLevel]);
- INI_WriteInt(File,"Price",BizInfo[i][bPrice]);
- INI_WriteFloat(File,"X",BizInfo[i][bX]);
- INI_WriteFloat(File,"Y",BizInfo[i][bY]);
- INI_WriteFloat(File,"Z",BizInfo[i][bZ]);
- INI_WriteFloat(File,"eX",BizInfo[i][beX]);
- INI_WriteFloat(File,"eY",BizInfo[i][beY]);
- INI_WriteFloat(File,"eZ",BizInfo[i][beZ]);
- INI_WriteBool(File,"Bought",false);
- INI_WriteString(File,"Owner","None");
- INI_WriteBool(File,"Existing",false);
- INI_WriteInt(File,"Safe",BizInfo[i][bSafe]);
- INI_WriteBool(File,"Open",true);
- INI_WriteInt(File,"EnterPrice",BizInfo[i][bEnterPrice]);
- INI_WriteString(File,"Name","None");
- INI_WriteInt(File,"VirtualWorld",BizInfo[i][bVW]);
- INI_WriteBool(File,"Investor",false);
- INI_Close(File);
- INI_ParseFile(BizPath(i), "LoadBiz_data", .bExtra = true, .extra = i);
- printf("Loading... | Biz %i | Created", i);
- }
- else
- {
- INI_ParseFile(BizPath(i), "LoadBiz_data", .bExtra = true, .extra = i);
- if(!BizInfo[i][bCreated]) continue;
- SetBizInfos(i);
- printf("Loading... | Biz %i | Loaded", i);
- if(BizInfo[i][bEnterPrice] != 0 && !BizInfo[i][bBuy]) BizInfo[i][bEnterPrice] = 0, printf("Loading... | Biz %i | Price enter resetted");
- }
- }
- print("Filterscript sucessfuly loaded");
- return 1;
- }
- //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- public OnFilterScriptExit()
- {
- for (new i; i<MAX_BIZ; i++)
- {
- if(BizInfo[i][bCreated]) printf("Unloading | Biz ID: '%i'", i);
- DestroyPickup(BizInfo[i][bPickupID]);
- DestroyPickup(BizInfo[i][bPickupEnter]);
- Delete3DTextLabel(BizLabelID[i]);
- Delete3DTextLabel(BizLabelEnterID[i]);
- BizInfo[i][bPickupID] = -1;
- BizInfo[i][bPickupEnter] = -1;
- SaveBizData(i);
- SaveInvestorData(i);
- }
- foreach(new i : Player)
- {
- if(LastBizVisited[i] != INVALID_BIZ_ID)
- {
- SetPlayerPos(i, BizInfo[LastBizVisited[i]][bX], BizInfo[LastBizVisited[i]][bY], BizInfo[LastBizVisited[i]][bZ]);
- SetPlayerInterior(i, 0);
- SetPlayerVirtualWorld(i, 0);
- SCM(i, RED, "Error: An administrator has unloaded the filterscript, you have been teleported out of the biz.");
- printf("Unloading ... | Player ID: %i | Teleported out of a biz (ID:%i)", i, LastBizVisited[i]);
- }
- }
- print("Filterscript sucessfuly unloaded");
- return 1;
- }
- #endif
- public OnObjectMoved(objectid)
- {
- return 1;
- }
- public OnPlayerObjectMoved(playerid, objectid)
- {
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- return 0;
- }
- //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
- {
- if(LastBizVisited[playerid] != INVALID_BIZ_ID && newinteriorid == 0)
- {
- SetTimerEx("TeleChecking", 1000, false, "i", playerid);
- }
- return 1;
- }
- //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- new bizid = GetNearestBiz(playerid);
- if((newkeys == KEY_SECONDARY_ATTACK) && (oldkeys == 0) && IsNearABiz(playerid))
- {
- if(!BizInfo[bizid][bOpen] && strcmp(GetName(playerid), BizInfo[bizid][bOwner]) && BizInfo[bizid][bBuy]) return SCM(playerid, RED, "This biz is closed.");
- if(BizInfo[bizid][bEnterPrice] > GetPlayerMoney(playerid)) return SCM(playerid, RED, "You don't have enough money to enter in this biz.");
- EnterInABiz(playerid, bizid);
- if(!BizInfo[bizid][bBuy] || GetPlayerBiz(playerid) == bizid || BizInfo[bizid][bEnterPrice] == 0) return 1;
- SetMoneyGameText(playerid, true, BizInfo[bizid][bEnterPrice]);
- GivePlayerMoney(playerid, -BizInfo[bizid][bEnterPrice]);
- BizInfo[bizid][bSafe] += BizInfo[bizid][bEnterPrice];
- }
- if((newkeys == KEY_SECONDARY_ATTACK) && (oldkeys == 0) && LastBizVisited[playerid] != INVALID_BIZ_ID && GetPlayerInterior(playerid) >= 1)
- {
- if(!IsPlayerInRangeOfPoint(playerid, 3, BizInfo[LastBizVisited[playerid]][beX], BizInfo[LastBizVisited[playerid]][beY], BizInfo[LastBizVisited[playerid]][beZ])) return 1;
- ExitABiz(playerid, LastBizVisited[playerid]);
- }
- return 1;
- }
- //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- // ===========================================================================================================================================================================================
- // Commands
- // ===========================================================================================================================================================================================
- //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- CMD:createbiz(playerid, params[])
- {
- if(!IsPlayerAdmin(playerid)) return 0;
- new price,
- level,
- interior,
- Float:x,
- Float:y,
- Float:z,
- str[120],
- pickid;
- if(sscanf(params,"iii", interior, level, price))
- {
- new str1[500];
- SCM(playerid, LBLUE, "[USE] /createbiz [type] [level] [price]");
- format(str1, sizeof(str1), RED_U"[USE] "LBLUE_U"/createbiz [type] [level] [price]\n\
- "RED_U"type: "LBLUE_U"Which type of buisness it will be\n\
- "RED_U"level: "LBLUE_U"Level (score) required to buy this biz\n\
- "RED_U"price: "LBLUE_U"Money required to buy this biz.\n\n"WHITE_U"Sort of type (biz):");
- for(new i=1; i<sizeof(InteriorName); i++)
- {
- format(str, sizeof(str), RED_U"\nType %i : "WHITE_U"%s", i, InteriorName[i][0]);
- strcat(str1, str);
- }
- Dialog_Show(playerid, createbizhelp, DIALOG_STYLE_MSGBOX, "Help for /createbiz", str1, "Ok", "");
- return 1;
- }
- if(GetNearestBiz(playerid) != INVALID_BIZ_ID) return SCMF(playerid, RED, "Error: The biz is too close to another. (Nearest Biz -> ID:%i)", GetNearestBiz(playerid));
- if(6 < interior || interior < 1) return SCMF(playerid, RED, "Error: Wrong interior ID (%i). [only 1-6]", interior);
- if(price < 10) return SCMF(playerid, RED, "Error: The price need to be at least 10$.");
- if(level < 1) return SCMF(playerid, RED, "Error: The level need to be at least 1.");
- GetPlayerPos(playerid, x, y, z);
- CurrentMaxbizid = GetFreeBizID();
- pickid = CreatePickup(ICON_BIZ_PENDING, 1, x, y, z, 0);
- BizVW++;
- BizInfo[CurrentMaxbizid][bX] = x;
- BizInfo[CurrentMaxbizid][bY] = y;
- BizInfo[CurrentMaxbizid][bZ] = z;
- BizInfo[CurrentMaxbizid][bCreated] = true;
- BizInfo[CurrentMaxbizid][bPrice] = price;
- BizInfo[CurrentMaxbizid][bID] = CurrentMaxbizid;
- BizInfo[CurrentMaxbizid][bPickupID] = pickid;
- BizInfo[CurrentMaxbizid][bType] = interior;
- BizInfo[CurrentMaxbizid][bLevel] = level;
- BizInfo[CurrentMaxbizid][bVW] = BizVW;
- format(BizInfo[CurrentMaxbizid][bName], MAX_BIZ_NAME, "%s", InteriorName[bType]);
- BizCreating[playerid] = CurrentMaxbizid;
- SaveBizData(CurrentMaxbizid);
- SCMF(playerid, -1, "You have creeated a biz ! Biz ID: "RED_U"%i "WHITE_U"- Price : "RED_U"%i$ "WHITE_U"- Level required"RED_U" %i", CurrentMaxbizid, price, level);
- switch(interior)
- {
- case 1:
- {
- new str1[400];
- for(new i; i<sizeof(Int247); i++)
- {
- format(str, sizeof(str), "\n%i - %s", i+1, Int247[i][Name]);
- strcat(str1, str);
- }
- format(str, sizeof(str), "Choose an interior for %s", InteriorName[interior]);
- Dialog_Show(playerid, DIALOG_CREATEBIZ, DIALOG_STYLE_LIST, str, str1, "Choose", "Cancel");
- }
- case 2:
- {
- new str1[400];
- for(new i; i<sizeof(Ammunation); i++)
- {
- format(str, sizeof(str), "\n%i - %s", i+1, Ammunation[i][Name]);
- strcat(str1, str);
- }
- format(str, sizeof(str), "Choose an interior for %s", InteriorName[interior]);
- Dialog_Show(playerid, DIALOG_CREATEBIZ, DIALOG_STYLE_LIST, str, str1, "Choose", "Cancel");
- }
- case 3:
- {
- new str1[400];
- for(new i; i<sizeof(Shop); i++)
- {
- format(str, sizeof(str), "\n%i - %s", i+1, Shop[i][Name]);
- strcat(str1, str);
- }
- format(str, sizeof(str), "Choose an interior for %s", InteriorName[interior]);
- Dialog_Show(playerid, DIALOG_CREATEBIZ, DIALOG_STYLE_LIST, str, str1, "Choose", "Cancel");
- }
- case 4:
- {
- new str1[400];
- for(new i; i<sizeof(Clothes); i++)
- {
- format(str, sizeof(str), "\n%i - %s", i+1, Clothes[i][Name]);
- strcat(str1, str);
- }
- format(str, sizeof(str), "Choose an interior for %s", InteriorName[interior]);
- Dialog_Show(playerid, DIALOG_CREATEBIZ, DIALOG_STYLE_LIST, str, str1, "Choose", "Cancel");
- }
- case 5:
- {
- new str1[400];
- for(new i; i<sizeof(Food); i++)
- {
- format(str, sizeof(str), "\n%i - %s", i+1, Food[i][Name]);
- strcat(str1, str);
- }
- format(str, sizeof(str), "Choose an interior for %s", InteriorName[interior]);
- Dialog_Show(playerid, DIALOG_CREATEBIZ, DIALOG_STYLE_LIST, str, str1, "Choose", "Cancel");
- }
- case 6:
- {
- new str1[400];
- for(new i; i<sizeof(Gym); i++)
- {
- format(str, sizeof(str), "\n%i - %s", i+1, Gym[i][Name]);
- strcat(str1, str);
- }
- format(str, sizeof(str), "Choose an interior for %s", InteriorName[interior]);
- Dialog_Show(playerid, DIALOG_CREATEBIZ, DIALOG_STYLE_LIST, str, str1, "Choose", "Cancel");
- }
- default:
- {
- Dialog_Show(playerid, ERROR, DIALOG_STYLE_MSGBOX, "Unknown", WHITE_U"An error occured. Take a screenshoot [F8] and inform Dayrion.\nError ID: 01", "Ok", "");
- DestroyPickup(BizInfo[BizCreating[playerid]][bPickupID]);
- DestroyPickup(BizInfo[BizCreating[playerid]][bPickupEnter]);
- Delete3DTextLabel(BizLabelID[BizCreating[playerid]]);
- Delete3DTextLabel(BizLabelEnterID[BizCreating[playerid]]);
- ResetBizData(BizCreating[playerid]);
- }
- }
- return 1;
- }
- //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- CMD:destroybiz(playerid, params[])
- {
- if(!IsPlayerAdmin(playerid)) return 0;
- new bizid;
- if(sscanf(params, "i", bizid)) return SCM(playerid, LBLUE, "[USE] /destroybiz [bizid] [-1: ALL]");
- if(bizid > MAX_BIZ || bizid < -1) return SCM(playerid, RED, "Error: Wrong biz ID.");
- if(bizid != -1)
- {
- if(!BizInfo[bizid][bCreated]) return SCM(playerid, RED, "Error: This biz is not created.");
- DestroyPickup(BizInfo[bizid][bPickupID]);
- DestroyPickup(BizInfo[bizid][bPickupEnter]);
- Delete3DTextLabel(BizLabelID[bizid]);
- Delete3DTextLabel(BizLabelEnterID[bizid]);
- foreach(new i : Player)
- {
- if(LastBizVisited[i] == bizid)
- {
- SetPlayerPos(i, BizInfo[LastBizVisited[i]][bX], BizInfo[LastBizVisited[i]][bY], BizInfo[LastBizVisited[i]][bZ]);
- SetPlayerInterior(i, 0);
- SetPlayerVirtualWorld(i, 0);
- SCM(i, RED, "Error: An administrator has destroyed the biz, you have been teleported out of the biz.");
- printf("[FS] Admin | Player: %s | Teleported out of a biz (ID:%i)", GetNameEx(i), LastBizVisited[i]);
- }
- }
- ResetBizData(bizid);
- SCMF(playerid, RED, "[Admin] "WHITE_U"You have destroyed the biz ID "RED_U"%i", bizid);
- }
- else
- {
- for(new i; i<MAX_BIZ; i++)
- {
- if(!BizInfo[i][bCreated]) continue;
- DestroyPickup(BizInfo[i][bPickupID]);
- DestroyPickup(BizInfo[i][bPickupEnter]);
- Delete3DTextLabel(BizLabelID[i]);
- Delete3DTextLabel(BizLabelEnterID[i]);
- foreach(new j : Player)
- {
- if(LastBizVisited[j] == i)
- {
- SetPlayerPos(j, BizInfo[LastBizVisited[j]][bX], BizInfo[LastBizVisited[j]][bY], BizInfo[LastBizVisited[j]][bZ]);
- SetPlayerInterior(j, 0);
- SetPlayerVirtualWorld(j, 0);
- SCM(j, RED, "Error: An administrator has destroyed the biz, you have been teleported out of the biz.");
- printf("[FS] Admin | Player: %s | Teleported out of a biz (ID:%i)", GetNameEx(j), LastBizVisited[j]);
- }
- }
- ResetBizData(i);
- SCMF(playerid, RED, "[Admin] "WHITE_U"You have destroyed the biz ID "RED_U"%i", i);
- }
- }
- return 1;
- }
- //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- CMD:buybiz(playerid, params[])
- {
- if(PlayerHasABiz(playerid)) return SCM(playerid, RED, "You have already a biz.");
- new bizid = GetNearestBiz(playerid);
- if(bizid == INVALID_BIZ_ID) return SCM(playerid, RED, "You need to be near the biz to buy it.");
- if(BizInfo[bizid][bBuy]) return SCM(playerid, RED, "This biz have a owner.");
- if(GetPlayerMoney(playerid) < BizInfo[bizid][bPrice]) return SCMF(playerid, RED, "Error: "WHITE_U"You need "RED_U"%i"WHITE_U"$ for buy this biz (Missing money: %i$)", BizInfo[bizid][bPrice], BizInfo[bizid][bPrice]-GetPlayerMoney(playerid));
- if(GetPlayerScore(playerid) < BizInfo[bizid][bLevel]) return SCMF(playerid, RED, "Error: "WHITE_U"You need to be at least level "RED_U"%i", BizInfo[bizid][bLevel]);
- format(BizInfo[bizid][bOwner], 24, "%s", GetName(playerid));
- format(BizInfo[bizid][bName], MAX_BIZ_NAME, "%s", InteriorName[bType]);
- BizInfo[bizid][bBuy] = true;
- DestroyPickup(BizInfo[bizid][bPickupID]);
- DestroyPickup(BizInfo[bizid][bPickupEnter]);
- Delete3DTextLabel(BizLabelID[bizid]);
- Delete3DTextLabel(BizLabelEnterID[bizid]);
- SetBizInfos(bizid);
- GivePlayerMoney(playerid, -BizInfo[bizid][bPrice]);
- SCMF(playerid, WHITE, "You have bought this biz! Price : "RED_U"%i$ - "WHITE_U"Type : "RED_U"%s", BizInfo[bizid][bPrice], InteriorName[BizInfo[bizid][bType]]);
- return 1;
- }
- //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- CMD:biz(playerid, params[])
- {
- if(!PlayerHasABiz(playerid)) return SCM(playerid, RED, "Error: You have not a biz.");
- new bizid = GetPlayerBiz(playerid);
- Dialog_Show(playerid, DIALOG_INFO_BIZ, DIALOG_STYLE_TABLIST, "Info", "View informations of your biz\nChange the enter price \t\t%i$\nOpen/Lock your biz\t\t%s\nDeposit money\nWithdraw money\nRename your biz", "Choose", "Cancel", BizInfo[bizid][bEnterPrice], OpenFormatBiz(bizid));
- return 1;
- }
- //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- CMD:closestbiz(playerid)
- {
- if(!IsPlayerAdmin(playerid)) return 0;
- new a = GetNearestBiz(playerid);
- return a == INVALID_BIZ_ID ? SCM(playerid, RED, "Error: You are not near a biz!") : SCMF(playerid, RED, "[Admin] "WHITE_U"The closest biz is ID %i - Name : '%s'", a, BizInfo[a][bName]);
- }
- //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- CMD:sellbiz(playerid)
- {
- if(!PlayerHasABiz(playerid)) return SCM(playerid, RED, "Error: You have not a biz.");
- if(GetNearestBiz(playerid) != GetPlayerBiz(playerid)) return SCM(playerid, RED, "You need to be near your biz to do that.");
- new i = GetNearestBiz(playerid);
- BizInfo[i][bBuy] = false;
- format(BizInfo[i][bOwner], 24, "None");
- format(BizInfo[i][bName], MAX_BIZ_NAME, "%s", InteriorName[BizInfo[i][bType]]);
- BizInfo[i][bSafe] = 0;
- BizInfo[i][bOpen] = false;
- BizInfo[i][bEnterPrice] = 0;
- GivePlayerMoney(playerid, BizInfo[i][bPrice]/2);
- DestroyPickup(BizInfo[i][bPickupID]);
- Delete3DTextLabel(BizLabelID[i]);
- Delete3DTextLabel(BizLabelEnterID[i]);
- SaveBizData(i);
- SetBizInfos(i);
- return 1;
- }
- //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- CMD:modifybiz(playerid, params[])
- {
- if(!IsPlayerAdmin(playerid)) return 0;
- new bizid;
- if(sscanf(params, "i", bizid)) return SCM(playerid, LBLUE, "/modifybiz [bizid]");
- if(!BizInfo[bizid][bCreated]) return SCM(playerid, RED, "Error: This biz is not created.");
- BizCreating[playerid] = bizid;
- Dialog_Show(playerid, DIALOG_INFO_BIZ_ADMIN, DIALOG_STYLE_TABLIST, "Info biz", "View informations of the biz\nChange the enter price \t%i\nOpen/Lock the biz\t%s\nChange the balance\nRename the biz\nSell the biz", "Choose", "Cancel", bizid, BizInfo[bizid][bEnterPrice], OpenFormatBiz(bizid));
- return 1;
- }
- //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- CMD:makeinvestor(playerid, params[])
- {
- if(!PlayerHasABiz(playerid)) return SCM(playerid, RED, "Error: You don't have a biz!");
- new target, bizid = GetPlayerBiz(playerid);
- if(sscanf(params, "u", target)) return SCM(playerid, LBLUE, "/makeinvestor [playerid/name] [-1 : Cancel investor]");
- if(!IsPlayerConnected(target) && target != INVALID_PLAYER_ID) return SCM(playerid, RED, "Error: This player isn't connected or be more accurate in the name.");
- if(target == playerid) return SCM(playerid, RED, "Error: You can't make yourself as an investor.");
- if(target == INVALID_PLAYER_ID)
- {
- if(IsPlayerConnectedByName(GetName(BizInv[bizid][iName])))
- SCMF(GetIDByName(BizInv[bizid][iName]), WHITE, "You are no longer an investor of the "RED_U"%s's"WHITE_U" biz ("RED_U"%s"WHITE_U")", GetName(playerid), BizInfo[bizid][bName]);
- SCMF(playerid, RED, "%s "WHITE_U"has been removed of your investor.", GetName(target), BizInfo[bizid][bName]);
- ResetInvestorData(bizid);
- DestroyPickup(BizInfo[bizid][bPickupID]);
- DestroyPickup(BizInfo[bizid][bPickupEnter]);
- Delete3DTextLabel(BizLabelID[bizid]);
- Delete3DTextLabel(BizLabelEnterID[bizid]);
- SetBizInfos(bizid);
- return 1;
- }
- if(BizInv[bizid][iInves]) return SCMF(playerid, RED, "Error: You have already an investor : %s", BizInv[bizid][iName]);
- format(BizInv[bizid][iName], 24, "%s", GetName(target));
- BizInv[bizid][iInves] = true;
- BizInv[bizid][iSafe] = true;
- SCMF(playerid, RED, "%s "WHITE_U"is now the new investor in your biz ("RED_U"%s"WHITE_U")", GetName(target), BizInfo[bizid][bName]);
- SCMF(target, RED, "%s "WHITE_U"made you the new investor in his/her biz ("RED_U"%s"WHITE_U")", GetName(target), BizInfo[bizid][bName]);
- DestroyPickup(BizInfo[bizid][bPickupID]);
- DestroyPickup(BizInfo[bizid][bPickupEnter]);
- Delete3DTextLabel(BizLabelID[bizid]);
- Delete3DTextLabel(BizLabelEnterID[bizid]);
- SetBizInfos(bizid);
- return 1;
- }
- //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- CMD:modifinvestor(playerid)
- {
- if(!PlayerHasABiz(playerid)) return SCM(playerid, RED, "Error: You don't have a biz!");
- if(!BizInv[GetPlayerBiz(playerid)][iInves]) return SCM(playerid, RED, "Error: You don't have investor.");
- ShowDialogInvPerm(playerid, GetPlayerBiz(playerid));
- return 1;
- }
- //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- CMD:amodifinvestor(playerid, params[])
- {
- if(!IsPlayerAdmin(playerid)) return 0;
- new bizid;
- if(sscanf(params, "i", bizid)) return SCM(playerid, LBLUE, "[USE] /amodifinvestor [bizid]");
- if(!BizInv[bizid][iInves]) return SCM(playerid, RED, "Error: This biz doesn't have an investor.");
- ShowDialogInvPerm(playerid, bizid);
- return 1;
- }
- //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- CMD:ibiz(playerid)
- {
- new bizid = GetInvestorBizID(playerid);
- if(bizid == INVALID_BIZ_ID) return SCM(playerid, RED, "Error: You are not an investor of a biz.");
- ShowDialogInvestor(playerid, bizid);
- return 1;
- }
- //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- // ===========================================================================================================================================================================================
- // Dialogs
- // ===========================================================================================================================================================================================
- //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- DIALOG(DIALOG_INVESTOR)
- {
- if(!response) return 1;
- new bizid = GetInvestorBizID(playerid);
- if(bizid == INVALID_BIZ_ID) return Dialog_Show(playerid, ERROR, DIALOG_STYLE_MSGBOX, "Unknown", WHITE_U"An error occured. Take a screenshoot [F8] and inform Dayrion.\nError ID: 09", "Ok", "");
- switch(listitem)
- {
- case 0:
- {
- if(!BizInv[bizid][iSafe]) return ShowDialogInvestor(playerid, bizid), SCM(playerid, RED, "Error: You are not allowed to do that.");
- new str[250];
- format(str, sizeof(str),
- RED_U"- Biz ID: "WHITE_U"%i\n\
- "RED_U"- Owner : "WHITE_U"%s\n\
- "RED_U"- Door : "WHITE_U"%s\n\
- "RED_U"- Resale price : "WHITE_U"%i$\n\
- "RED_U"- Safe : "WHITE_U"%i$\n\
- "RED_U"- Investor : "WHITE_U"%s", BizInfo[bizid][bID], BizInfo[bizid][bOwner], OpenFormatBiz(bizid), floatround(BizInfo[bizid][bPrice]/2, floatround_round), BizInfo[bizid][bSafe], BizInv[bizid][iName]);
- BizCreating[playerid] = bizid;
- Dialog_Show(playerid, DIALOG_INFO, DIALOG_STYLE_MSGBOX, "Info biz", str, "Ok", "Back");
- }
- case 2:
- {
- if(!BizInv[bizid][iEnterPrice]) return ShowDialogInvestor(playerid, bizid), SCM(playerid, RED, "Error: You are not allowed to do that.");
- BizCreating[playerid] = bizid;
- Dialog_Show(playerid, DIALOG_PRICECHANGER, DIALOG_STYLE_INPUT, "Change the price enter", "Change the enter price", "Confirm", "Cancel");
- }
- case 1:
- {
- if(!BizInv[bizid][iLock]) return ShowDialogInvestor(playerid, bizid), SCM(playerid, RED, "Error: You are not allowed to do that.");
- if(GetNearestBiz(playerid) != bizid && LastBizVisited[playerid] != bizid) return SCM(playerid, RED, "Error: You are too far away from the biz.");
- if(BizInfo[bizid][bOpen])
- {
- BizInfo[bizid][bOpen] = false;
- DestroyPickup(BizInfo[bizid][bPickupID]);
- SCM(playerid, RED, "You have locked the biz.");
- BizInfo[bizid][bPickupID] = CreatePickup(ICON_BIZ_LOCKED, 1, BizInfo[bizid][bX], BizInfo[bizid][bY], BizInfo[bizid][bZ], 0);
- }
- else
- {
- BizInfo[bizid][bOpen] = true;
- DestroyPickup(BizInfo[bizid][bPickupID]);
- SCM(playerid, GREEN, "You have opened the biz.");
- BizInfo[bizid][bPickupID] = CreatePickup(ICON_BIZ_OPEN, 1, BizInfo[bizid][bX], BizInfo[bizid][bY], BizInfo[bizid][bZ], 0);
- }
- }
- case 4:
- {
- if(!BizInv[bizid][iDeposit]) return ShowDialogInvestor(playerid, bizid), SCM(playerid, RED, "Error: You are not allowed to do that.");
- if(LastBizVisited[playerid] != bizid) return SCM(playerid, RED, "Error: You need to be inside in the biz to do that.");
- BizCreating[playerid] = bizid;
- Dialog_Show(playerid, DIALOG_DEPOSIT, DIALOG_STYLE_INPUT, "Deposit money", "Set the amount of money to deposit it.", "Confirm", "Cancel");
- }
- case 5:
- {
- if(!BizInv[bizid][iWithdraw]) return ShowDialogInvestor(playerid, bizid), SCM(playerid, RED, "Error: You are not allowed to do that.");
- if(LastBizVisited[playerid] != bizid) return SCM(playerid, RED, "Error: You need to be inside in the biz to do that.");
- BizCreating[playerid] = bizid;
- Dialog_Show(playerid, DIALOG_WITHDRAW, DIALOG_STYLE_INPUT, "Withdraw money", "Set the amount of money to withdraw it.", "Confirm", "Cancel");
- }
- case 3:
- {
- if(!BizInv[bizid][iRename]) return ShowDialogInvestor(playerid, bizid), SCM(playerid, RED, "Error: You are not allowed to do that.");
- if(LastBizVisited[playerid] != bizid && GetNearestBiz(playerid) != bizid) return SCM(playerid, RED, "Error: You have to far away from the biz.");
- BizCreating[playerid] = bizid;
- Dialog_Show(playerid, DIALOG_NAME, DIALOG_STYLE_INPUT, "Name your biz", "Enter a name for your biz.", "Confirm", "Cancel");
- }
- default : Dialog_Show(playerid, ERROR, DIALOG_STYLE_MSGBOX, "Unknown", WHITE_U"An error occured. Take a screenshoot [F8] and inform Dayrion.\nError ID: 10", "Ok", "");
- }
- return 1;
- }
- //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- DIALOG(DIALOG_MODIFY_INVESTOR)
- {
- if(!response) return 1;
- new bizid = BizCreating[playerid];
- if(BizCreating[playerid] == -1) return Dialog_Show(playerid, ERROR, DIALOG_STYLE_MSGBOX, "Unknown", WHITE_U"An error occured. Take a screenshoot [F8] and inform Dayrion.\nError ID: 08", "Ok", "");
- switch(listitem)
- {
- case 0:
- {
- if(!BizInv[bizid][iSafe])
- {
- BizInv[bizid][iSafe] = true;
- SCMF(playerid, GREEN, "%s can now access to the biz's informations.", BizInv[bizid][iName]);
- ShowDialogInvPerm(playerid, bizid);
- }
- else
- {
- BizInv[bizid][iSafe] = false;
- SCMF(playerid, RED, "%s can not anymore access to the biz's informations.", BizInv[bizid][iName]);
- ShowDialogInvPerm(playerid, bizid);
- }
- }
- case 1:
- {
- if(!BizInv[bizid][iLock])
- {
- BizInv[bizid][iLock] = true;
- SCMF(playerid, GREEN, "%s can lock your biz.", BizInv[bizid][iName]);
- ShowDialogInvPerm(playerid, bizid);
- }
- else
- {
- BizInv[bizid][iLock] = false;
- SCMF(playerid, RED, "%s can not lock your biz.", BizInv[bizid][iName]);
- ShowDialogInvPerm(playerid, bizid);
- }
- }
- case 2:
- {
- if(!BizInv[bizid][iEnterPrice])
- {
- BizInv[bizid][iEnterPrice] = true;
- SCMF(playerid, GREEN, "%s can modify the enter price of your biz.", BizInv[bizid][iName]);
- ShowDialogInvPerm(playerid, bizid);
- }
- else
- {
- BizInv[bizid][iEnterPrice] = false;
- SCMF(playerid, RED, "%s can not anymore modify the enter price of your biz.", BizInv[bizid][iName]);
- ShowDialogInvPerm(playerid, bizid);
- }
- }
- case 3:
- {
- if(!BizInv[bizid][iRename])
- {
- BizInv[bizid][iRename] = true;
- SCMF(playerid, GREEN, "%s can now rename your biz.", BizInv[bizid][iName]);
- ShowDialogInvPerm(playerid, bizid);
- }
- else
- {
- BizInv[bizid][iRename] = false;
- SCMF(playerid, RED, "%s can not anymore rename your biz.", BizInv[bizid][iName]);
- ShowDialogInvPerm(playerid, bizid);
- }
- }
- case 4:
- {
- if(!BizInv[bizid][iDeposit])
- {
- BizInv[bizid][iDeposit] = true;
- SCMF(playerid, GREEN, "%s can deposit in your biz.", BizInv[bizid][iName]);
- ShowDialogInvPerm(playerid, bizid);
- }
- else
- {
- BizInv[bizid][iDeposit] = false;
- SCMF(playerid, RED, "%s can not anymore deposit in your biz.", BizInv[bizid][iName]);
- ShowDialogInvPerm(playerid, bizid);
- }
- }
- case 5:
- {
- if(!BizInv[bizid][iWithdraw])
- {
- BizInv[bizid][iWithdraw] = true;
- SCMF(playerid, GREEN, "%s can withdraw in your biz.", BizInv[bizid][iName]);
- ShowDialogInvPerm(playerid, bizid);
- }
- else
- {
- BizInv[bizid][iWithdraw] = false;
- SCMF(playerid, RED, "%s can not anymore withdraw in your biz.", BizInv[bizid][iName]);
- ShowDialogInvPerm(playerid, bizid);
- }
- }
- default : return Dialog_Show(playerid, ERROR, DIALOG_STYLE_MSGBOX, "Unknown", WHITE_U"An error occured. Take a screenshoot [F8] and inform Dayrion.\nError ID: 07", "Ok", "");
- }
- return 1;
- }
- //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- DIALOG(DIALOG_CREATEBIZ)
- {
- if(response)
- {
- BizInfo[BizCreating[playerid]][bInterior] = listitem;
- new IntA = BizInfo[BizCreating[playerid]][bInterior];
- switch(BizInfo[BizCreating[playerid]][bType])
- {
- case 1:
- {
- BizInfo[BizCreating[playerid]][beX] = Int247[IntA][X];
- BizInfo[BizCreating[playerid]][beY] = Int247[IntA][Y];
- BizInfo[BizCreating[playerid]][beZ] = Int247[IntA][Z];
- }
- case 2:
- {
- BizInfo[BizCreating[playerid]][beX] = Ammunation[IntA][X];
- BizInfo[BizCreating[playerid]][beY] = Ammunation[IntA][Y];
- BizInfo[BizCreating[playerid]][beZ] = Ammunation[IntA][Z];
- }
- case 3:
- {
- BizInfo[BizCreating[playerid]][beX] = Shop[IntA][X];
- BizInfo[BizCreating[playerid]][beY] = Shop[IntA][Y];
- BizInfo[BizCreating[playerid]][beZ] = Shop[IntA][Z];
- }
- case 4:
- {
- BizInfo[BizCreating[playerid]][beX] = Clothes[IntA][X];
- BizInfo[BizCreating[playerid]][beY] = Clothes[IntA][Y];
- BizInfo[BizCreating[playerid]][beZ] = Clothes[IntA][Z];
- }
- case 5:
- {
- BizInfo[BizCreating[playerid]][beX] = Food[IntA][X];
- BizInfo[BizCreating[playerid]][beY] = Food[IntA][Y];
- BizInfo[BizCreating[playerid]][beZ] = Food[IntA][Z];
- }
- case 6:
- {
- BizInfo[BizCreating[playerid]][beX] = Gym[IntA][X];
- BizInfo[BizCreating[playerid]][beY] = Gym[IntA][Y];
- BizInfo[BizCreating[playerid]][beZ] = Gym[IntA][Z];
- }
- default : printf("ERROR | Biz ID %i - (BizInfo[bizid][bType]) : %i | Cannot create enter pickup.", BizCreating[playerid], BizInfo[IntA][bType]);
- }
- DestroyPickup(BizInfo[BizCreating[playerid]][bPickupID]);
- SetBizInfos(BizCreating[playerid]);
- SaveBizData(BizCreating[playerid]);
- EnterInABiz(playerid, BizCreating[playerid]);
- BizCreating[playerid] = -1;
- }
- else
- {
- DestroyPickup(BizInfo[BizCreating[playerid]][bPickupID]);
- Delete3DTextLabel(BizLabelID[BizCreating[playerid]]);
- Delete3DTextLabel(BizLabelEnterID[BizCreating[playerid]]);
- ResetBizData(BizCreating[playerid]);
- BizCreating[playerid] = -1;
- }
- return 1;
- }
- //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- DIALOG(DIALOG_INFO_BIZ)
- {
- if(response)
- {
- new bizid = GetPlayerBiz(playerid);
- if(bizid == INVALID_BIZ_ID) return Dialog_Show(playerid, ERROR, DIALOG_STYLE_MSGBOX, "Unknown", WHITE_U"An error occured. Take a screenshoot [F8] and inform Dayrion.\nError ID: 03", "Ok", "");
- switch(listitem)
- {
- case 0:
- {
- new str[200];
- format(str, sizeof(str),
- RED_U"- Biz ID: "WHITE_U"%i\n\
- "RED_U"- Owner : "WHITE_U"%s\n\
- "RED_U"- Door : "WHITE_U"%s\n\
- "RED_U"- Resale price : "WHITE_U"%i$\n\
- "RED_U"- Safe : "WHITE_U"%i$", BizInfo[bizid][bID], BizInfo[bizid][bOwner], OpenFormatBiz(bizid), floatround(BizInfo[bizid][bPrice]/2, floatround_round), BizInfo[bizid][bSafe]);
- BizCreating[playerid] = bizid;
- Dialog_Show(playerid, DIALOG_INFO, DIALOG_STYLE_MSGBOX, "Info biz", str, "Ok", "Back");
- }
- case 1:
- {
- BizCreating[playerid] = bizid;
- Dialog_Show(playerid, DIALOG_PRICECHANGER, DIALOG_STYLE_INPUT, "Change the price enter", "Change the enter price", "Confirm", "Cancel");
- }
- case 2:
- {
- if(GetNearestBiz(playerid) != GetPlayerBiz(playerid) && LastBizVisited[playerid] != GetPlayerBiz(playerid)) return SCM(playerid, RED, "Error: You are too far away from your biz.");
- if(BizInfo[bizid][bOpen])
- {
- BizInfo[bizid][bOpen] = false;
- DestroyPickup(BizInfo[bizid][bPickupID]);
- SCM(playerid, RED, "You have locked your biz.");
- BizInfo[bizid][bPickupID] = CreatePickup(ICON_BIZ_LOCKED, 1, BizInfo[bizid][bX], BizInfo[bizid][bY], BizInfo[bizid][bZ], 0);
- }
- else
- {
- BizInfo[bizid][bOpen] = true;
- DestroyPickup(BizInfo[bizid][bPickupID]);
- SCM(playerid, GREEN, "You have opened your biz.");
- BizInfo[bizid][bPickupID] = CreatePickup(ICON_BIZ_OPEN, 1, BizInfo[bizid][bX], BizInfo[bizid][bY], BizInfo[bizid][bZ], 0);
- }
- }
- case 3:
- {
- if(LastBizVisited[playerid] != GetPlayerBiz(playerid)) return SCM(playerid, RED, "Error: You need to be inside your biz to do that.");
- BizCreating[playerid] = bizid;
- Dialog_Show(playerid, DIALOG_DEPOSIT, DIALOG_STYLE_INPUT, "Deposit money", "Set the amount of money to deposit it.", "Confirm", "Cancel");
- }
- case 4:
- {
- if(LastBizVisited[playerid] != GetPlayerBiz(playerid)) return SCM(playerid, RED, "Error: You need to be inside your biz to do that.");
- BizCreating[playerid] = bizid;
- Dialog_Show(playerid, DIALOG_WITHDRAW, DIALOG_STYLE_INPUT, "Withdraw money", "Set the amount of money to withdraw it.", "Confirm", "Cancel");
- }
- case 5:
- {
- if(LastBizVisited[playerid] != GetPlayerBiz(playerid) && GetNearestBiz(playerid) != GetPlayerBiz(playerid)) return SCM(playerid, RED, "Error: You have to far away from your biz.");
- BizCreating[playerid] = bizid;
- Dialog_Show(playerid, DIALOG_NAME, DIALOG_STYLE_INPUT, "Name your biz", "Enter a name for your biz.", "Confirm", "Cancel");
- }
- default : Dialog_Show(playerid, ERROR, DIALOG_STYLE_MSGBOX, "Unknown", WHITE_U"An error occured. Take a screenshoot [F8] and inform Dayrion.\nError ID: 04", "Ok", "");
- }
- }
- return 1;
- }
- //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- DIALOG(DIALOG_INFO)
- {
- if(response)
- {
- BizCreating[playerid] = -1;
- }
- else
- {
- if(!strcmp(BizInv[BizCreating[playerid]][iName], GetName(playerid)) && BizCreating[playerid] != -1) cmd_ibiz(playerid);
- else cmd_biz(playerid,"");
- }
- return 1;
- }
- //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- DIALOG(DIALOG_PRICECHANGER)
- {
- if(response)
- {
- if(strval(inputtext) == 0) return Dialog_Show(playerid, DIALOG_PRICECHANGER, DIALOG_STYLE_INPUT, "Change the price enter", "Change the enter price\n"RED_U"Please use only numeric values.", "Confirm", "Cancel");
- if(!BizInfo[BizCreating[playerid]][bBuy]) return SCM(playerid, RED, "Error: Nobody have buy this biz, you can't change this price changer.");
- if(strval(inputtext) > 50000000 || strval(inputtext) < 0) return Dialog_Show(playerid, DIALOG_PRICECHANGER, DIALOG_STYLE_INPUT, "Change the price enter", "Change the enter price\n"RED_U"The value should be between 0 & 50000000", "Confirm", "Cancel");
- SCMF(playerid, X11_NAVAJO_WHITE_2, "You have changed the enter price : %i$ -> %i$", BizInfo[BizCreating[playerid]][bEnterPrice], strval(inputtext));
- BizInfo[BizCreating[playerid]][bEnterPrice] = strval(inputtext);
- Delete3DTextLabel(BizLabelID[BizCreating[playerid]]);
- DestroyPickup(BizInfo[BizCreating[playerid]][bPickupID]);
- DestroyPickup(BizInfo[BizCreating[playerid]][bPickupEnter]);
- Delete3DTextLabel(BizLabelEnterID[BizCreating[playerid]]);
- SetBizInfos(BizCreating[playerid]);
- BizCreating[playerid] = -1;
- }
- return 1;
- }
- //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- DIALOG(DIALOG_DEPOSIT)
- {
- if(response)
- {
- if(strval(inputtext) == 0) return Dialog_Show(playerid, DIALOG_DEPOSIT, DIALOG_STYLE_INPUT, "Deposit money", "Set the amount of money to deposit it.\n"RED_U"Please use only numeric values.", "Confirm", "Cancel");
- if(strval(inputtext) > GetPlayerMoney(playerid)) return Dialog_Show(playerid, DIALOG_DEPOSIT, DIALOG_STYLE_INPUT, "Deposit money", "Set the amount of money to deposit it.\n"RED_U"You don't have this amount of money.", "Confirm", "Cancel");
- if(strval(inputtext) < 0) return Dialog_Show(playerid, DIALOG_DEPOSIT, DIALOG_STYLE_INPUT, "Deposit money", "Set the amount of money to deposit it.\n"RED_U"Please use only positive values.", "Confirm", "Cancel");
- if(strval(inputtext) + BizInfo[BizCreating[playerid]][bSafe] > MAX_BALANCE) return Dialog_Show(playerid, DIALOG_DEPOSIT, DIALOG_STYLE_INPUT, "Deposit money", "Set the amount of money to deposit it.\n"RED_U"This amount exceed the limit.", "Confirm", "Cancel");
- BizInfo[BizCreating[playerid]][bSafe] += strval(inputtext);
- SCMF(playerid, X11_CORNSILK_2, "You deposit %i$. (Balance : %i$)", strval(inputtext), BizInfo[BizCreating[playerid]][bSafe]);
- GivePlayerMoney(playerid, -strval(inputtext));
- BizCreating[playerid] = -1;
- if(BizInv[BizCreating[playerid]][iInves])
- {
- if(!IsPlayerConnectedByName(BizInv[BizCreating[playerid]][iName]) || !IsPlayerConnectedByName(BizInfo[BizCreating[playerid]][bOwner]))
- {
- BizCreating[playerid] = -1;
- return 1;
- }
- else
- {
- GivePlayerMoney(GetIDByName(BizInv[BizCreating[playerid]][iName]), floatround(strval(inputtext)*0.1));
- if(IsPlayerConnectedByName(BizInfo[BizCreating[playerid]][bOwner])) SCMF(GetIDByName(BizInfo[BizCreating[playerid]][bOwner]), RED, "%s won %i$.", BizInv[BizCreating[playerid]][iName], floatround(strval(inputtext)*0.1), strval(inputtext));
- SetMoneyGameText(playerid, false, strval(inputtext));
- BizCreating[playerid] = -1;
- return 1;
- }
- }
- }
- return 1;
- }
- //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- DIALOG(DIALOG_WITHDRAW)
- {
- if(response)
- {
- if(strval(inputtext) == 0) return Dialog_Show(playerid, DIALOG_WITHDRAW, DIALOG_STYLE_INPUT, "Deposit money", "Set the amount of money to withdraw it.\n"RED_U"Please use only numeric values.", "Confirm", "Cancel");
- if(strval(inputtext) > BizInfo[BizCreating[playerid]][bSafe]) return Dialog_Show(playerid, DIALOG_WITHDRAW, DIALOG_STYLE_INPUT, "Deposit money", "Set the amount of money to withdraw it.\n"RED_U"You don't have this amount of money in your biz.", "Confirm", "Cancel");
- if(strval(inputtext) < 0) return Dialog_Show(playerid, DIALOG_WITHDRAW, DIALOG_STYLE_INPUT, "Deposit money", "Set the amount of money to withdraw it.\n"RED_U"Please use only positive values.", "Confirm", "Cancel");
- if(BizInfo[BizCreating[playerid]][bSafe] - strval(inputtext) < 0) return Dialog_Show(playerid, DIALOG_WITHDRAW, DIALOG_STYLE_INPUT, "Deposit money", "Set the amount of money to withdraw it.\n"RED_U"You don't have this money on your biz.", "Confirm", "Cancel");
- BizInfo[BizCreating[playerid]][bSafe] -= strval(inputtext);
- SetMoneyGameText(playerid, false, strval(inputtext));
- SCMF(playerid, X11_CORNSILK_2, "You withdraw %i$. (Balance : %i$)", strval(inputtext), BizInfo[BizCreating[playerid]][bSafe]);
- GivePlayerMoney(playerid, strval(inputtext));
- BizCreating[playerid] = -1;
- }
- return 1;
- }
- //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- DIALOG(DIALOG_NAME)
- {
- if(response)
- {
- if(strlen(inputtext) > MAX_BIZ_NAME && IsPlayerAdmin(playerid)) return Dialog_Show(playerid, DIALOG_NAME, DIALOG_STYLE_INPUT, "Name your biz", "Enter a name for the biz ID:%i (Actually: '%s').\n"RED_U"The name is too long.", "Confirm", "Cancel", BizCreating[playerid], BizInfo[BizCreating[playerid]][bName]);
- else if(strlen(inputtext) > MAX_BIZ_NAME && !IsPlayerAdmin(playerid)) return Dialog_Show(playerid, DIALOG_NAME, DIALOG_STYLE_INPUT, "Name your biz", "Enter a name for your biz.\n"RED_U"The name is too long.", "Confirm", "Cancel");
- SCMF(playerid, X11_PEACH_PUFF_2, "You renamed your biz : '%s' -> '%s'", BizInfo[BizCreating[playerid]][bName], inputtext);
- format(BizInfo[BizCreating[playerid]][bName], MAX_BIZ_NAME, inputtext);
- Delete3DTextLabel(BizLabelID[BizCreating[playerid]]);
- Delete3DTextLabel(BizLabelEnterID[BizCreating[playerid]]);
- DestroyPickup(BizInfo[BizCreating[playerid]][bPickupID]);
- DestroyPickup(BizInfo[BizCreating[playerid]][bPickupEnter]);
- SetBizInfos(BizCreating[playerid]);
- BizCreating[playerid] = -1;
- }
- return 1;
- }
- //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- DIALOG(DIALOG_INFO_BIZ_ADMIN)
- {
- if(!IsPlayerAdmin(playerid)) return Dialog_Show(playerid, ERROR, DIALOG_STYLE_MSGBOX, "Unknown", WHITE_U"An error occured. Take a screenshoot [F8] and inform Dayrion.\nError ID: 05", "Ok", "");
- new bizid = BizCreating[playerid];
- if(response)
- {
- switch(listitem)
- {
- case 0:
- {
- new str[200];
- format(str, sizeof(str),
- RED_U"- Biz ID: "WHITE_U"%i\n\
- "RED_U"- Owner : "WHITE_U"%s\n\
- "RED_U"- Door : "WHITE_U"%s\n\
- "RED_U"- Resale price : "WHITE_U"%i$\n\
- "RED_U"- Safe : "WHITE_U"%i$\n\
- "RED_U"- Name : "WHITE_U"%s", BizInfo[bizid][bID], BizInfo[bizid][bOwner], OpenFormatBiz(bizid), floatround(BizInfo[bizid][bPrice]/2, floatround_round), BizInfo[bizid][bSafe], BizInfo[bizid][bName]);
- Dialog_Show(playerid, DIALOG_INFO, DIALOG_STYLE_MSGBOX, "Info biz", str, "Ok", "Back");
- }
- case 1:
- {
- Dialog_Show(playerid, DIALOG_PRICECHANGER, DIALOG_STYLE_INPUT, "Change the price enter", "Change the enter price.\nActually : %i$", "Confirm", "Cancel", BizInfo[bizid][bEnterPrice]);
- }
- case 2:
- {
- if(BizInfo[bizid][bOpen])
- {
- BizInfo[bizid][bOpen] = false;
- DestroyPickup(BizInfo[bizid][bPickupID]);
- SCM(playerid, RED, "You have closed this biz.");
- BizInfo[bizid][bPickupID] = CreatePickup(ICON_BIZ_LOCKED, 1, BizInfo[bizid][bX], BizInfo[bizid][bY], BizInfo[bizid][bZ], 0);
- }
- else
- {
- BizInfo[bizid][bOpen] = true;
- DestroyPickup(BizInfo[bizid][bPickupID]);
- SCM(playerid, GREEN, "You have opened this biz.");
- BizInfo[bizid][bPickupID] = CreatePickup(ICON_BIZ_OPEN, 1, BizInfo[bizid][bX], BizInfo[bizid][bY], BizInfo[bizid][bZ], 0);
- }
- }
- case 3:
- {
- Dialog_Show(playerid, DIALOG_BALANCE, DIALOG_STYLE_INPUT, "Modify balance", "Modify the current balance.\nActually : %i$", "Confirm", "Cancel", BizInfo[bizid][bEnterPrice]);
- }
- case 4:
- {
- Dialog_Show(playerid, DIALOG_NAME, DIALOG_STYLE_INPUT, "Name your biz", "Enter a name for the biz ID:%i (Actually : '%s')", "Confirm", "Cancel", bizid, BizInfo[bizid][bName]);
- }
- case 5:
- {
- if(!BizInfo[bizid][bBuy]) return SCM(playerid, RED, "Error: This biz is free and can't be sell right now.");
- BizInfo[bizid][bBuy] = false;
- format(BizInfo[bizid][bOwner], 24, "None");
- format(BizInfo[bizid][bName], MAX_BIZ_NAME, "None");
- BizInfo[bizid][bSafe] = 0;
- GivePlayerMoney(playerid, BizInfo[bizid][bPrice]/2);
- DestroyPickup(BizInfo[bizid][bPickupID]);
- DestroyPickup(BizInfo[bizid][bPickupEnter]);
- Delete3DTextLabel(BizLabelID[bizid]);
- Delete3DTextLabel(BizLabelEnterID[bizid]);
- SaveBizData(bizid);
- SetBizInfos(bizid);
- SCMF(playerid, RED, "[Admin]"WHITE_U" You have corretly sold biz ID:"RED_U"%i", bizid);
- }
- default : Dialog_Show(playerid, ERROR, DIALOG_STYLE_MSGBOX, "Unknown", WHITE_U"An error occured. Take a screenshoot [F8] and inform Dayrion.\nError ID: 06", "Ok", "");
- }
- if(!BizInfo[bizid][bBuy]) SCM(playerid, RED, "[Admin] Be careful, nobody bought this biz!");
- }
- else BizCreating[playerid] = -1;
- return 1;
- }
- //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- DIALOG(DIALOG_BALANCE)
- {
- if(response)
- {
- if(strval(inputtext) == 0) return Dialog_Show(playerid, DIALOG_BALANCE, DIALOG_STYLE_INPUT, "Modify balance", "Modify the current balance.\nActually : %i$\n"RED_U"Please use only numeric values.", "Confirm", "Cancel", BizInfo[BizCreating[playerid]][bEnterPrice]);
- if(strval(inputtext) < 0) return Dialog_Show(playerid, DIALOG_BALANCE, DIALOG_STYLE_INPUT, "Deposit money", "Modify the current balance.\nActually : %i$\n"RED_U"Please use only positive values.", "Confirm", "Cancel");
- SCMF(playerid, RED, "[Admin] "WHITE_U"You have changed the current balance of the biz ID:%i "RED_U"» %i$ -> %i$", BizCreating[playerid], BizInfo[BizCreating[playerid]][bSafe], strval(inputtext));
- BizInfo[BizCreating[playerid]][bSafe] = strval(inputtext);
- BizCreating[playerid] = -1;
- return 1;
- }
- else BizCreating[playerid] = -1;
- return 1;
- }
- //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- // ===========================================================================================================================================================================================
- // Functions
- // ===========================================================================================================================================================================================
- //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- SaveBizData(bizid)
- {
- new INI:File = INI_Open(BizPath(bizid));
- INI_SetTag(File, "Stats");
- INI_WriteInt(File,"ID",BizInfo[bizid][bID]);
- INI_WriteInt(File,"Interior",BizInfo[bizid][bInterior]);
- INI_WriteInt(File,"PickupID",BizInfo[bizid][bPickupID]);
- INI_WriteInt(File,"PickupEnter",BizInfo[bizid][bPickupEnter]);
- INI_WriteInt(File,"Type",BizInfo[bizid][bType]);
- INI_WriteInt(File,"Level",BizInfo[bizid][bLevel]);
- INI_WriteInt(File,"Price",BizInfo[bizid][bPrice]);
- INI_WriteFloat(File,"X",BizInfo[bizid][bX]);
- INI_WriteFloat(File,"Y",BizInfo[bizid][bY]);
- INI_WriteFloat(File,"Z",BizInfo[bizid][bZ]);
- INI_WriteFloat(File,"eX",BizInfo[bizid][beX]);
- INI_WriteFloat(File,"eY",BizInfo[bizid][beY]);
- INI_WriteFloat(File,"eZ",BizInfo[bizid][beZ]);
- INI_WriteBool(File,"Bought",BizInfo[bizid][bBuy]);
- INI_WriteString(File,"Owner",BizInfo[bizid][bOwner]);
- INI_WriteBool(File,"Existing",BizInfo[bizid][bCreated]);
- INI_WriteInt(File,"Safe",BizInfo[bizid][bSafe]);
- INI_WriteInt(File,"EnterPrice",BizInfo[bizid][bEnterPrice]);
- INI_WriteString(File,"Name",BizInfo[bizid][bName]);
- INI_WriteBool(File,"Open",BizInfo[bizid][bOpen]);
- INI_WriteInt(File,"VirtualWorld",BizInfo[bizid][bVW]);
- INI_WriteBool(File,"Investor",BizInfo[bizid][bInvestor]);
- INI_Close(File);
- return 1;
- }
- //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- ResetBizData(bizid)
- {
- BizInfo[bizid][bX] = 0.0;
- BizInfo[bizid][bY] = 0.0;
- BizInfo[bizid][bZ] = 0.0;
- BizInfo[bizid][beX] = 0.0;
- BizInfo[bizid][beY] = 0.0;
- BizInfo[bizid][beZ] = 0.0;
- BizInfo[bizid][bInterior] = -1;
- BizInfo[bizid][bCreated] = false;
- BizInfo[bizid][bPrice] = 0;
- BizInfo[bizid][bID] = bizid;
- BizInfo[bizid][bPickupID] = -1;
- BizInfo[bizid][bPickupEnter]= -1;
- BizInfo[bizid][bBuy] = false;
- BizInfo[bizid][bType] = 0;
- BizInfo[bizid][bLevel] = 0;
- BizInfo[bizid][bSafe] = 0;
- BizInfo[bizid][bOpen] = true;
- BizInfo[bizid][bEnterPrice] = 0;
- BizInfo[bizid][bVW] = 0;
- BizInfo[bizid][bInvestor] = false;
- format(BizInfo[bizid][bOwner], 24, "None");
- format(BizInfo[bizid][bName], MAX_BIZ_NAME, "None");
- SaveBizData(bizid);
- }
- //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- GetFreeBizID()
- {
- new lastid;
- for(new i; i<MAX_BIZ; i++)
- {
- if(BizInfo[i][bCreated]) continue;
- lastid = i;
- break;
- }
- return lastid;
- }
- //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- PlayerHasABiz(playerid)
- {
- new playeri = -1;
- for(new i; i<MAX_BIZ; i++)
- {
- if(!BizInfo[i][bCreated]) continue;
- if(strcmp(GetName(playerid), BizInfo[i][bOwner])) continue;
- playeri = i;
- break;
- }
- return playeri > -1 ? true : false;
- }
- //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- GetName(const playerid)
- {
- static gName[MAX_PLAYER_NAME];
- GetPlayerName(playerid, gName, sizeof(gName));
- return gName;
- }
- //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- SCMF(playerid, couleur, const msg[], va_args<>)
- {
- static
- string[145];
- va_format(string, sizeof(string), msg, va_start<3>);
- return SendClientMessage(playerid, couleur, string);
- }
- //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- SCM(playerid, color, const msg[]) return SendClientMessage(playerid, color, msg);
- stock SCMTA(color, const msg[]) return SendClientMessageToAll(color, msg);
- stock SCMFTA(color, const msg[], va_args<>)
- {
- static str[145];
- va_format(str, sizeof(str), msg, va_start<2>);
- return SCMTA(color, str);
- }
- //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- GetNameEx(const playerid)
- {
- static geName[MAX_PLAYER_NAME], geString[50];
- GetPlayerName(playerid, geName, sizeof(geName));
- format(geString, sizeof(geString), "%s (ID: %i)", geName, playerid);
- return geString;
- }
- //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- SetBizInfos(bizid)
- {
- if(!BizInfo[bizid][bCreated]) return printf("An error occured during setting infos of the biz ID: %i | Error ID: 07", bizid);
- static str[120];
- if(!BizInfo[bizid][bBuy])
- {
- format(str, sizeof(str), "~ FOR SALE ~\n"LBLUE_U"%s\nLevel : "WHITE_U"%i\n"LBLUE_U"Price : "WHITE_U"%i$", BizInfo[bizid][bName], BizInfo[bizid][bLevel], BizInfo[bizid][bPrice]);
- BizLabelID[bizid] = Create3DTextLabel(str, LBLUE, BizInfo[bizid][bX], BizInfo[bizid][bY], BizInfo[bizid][bZ], 20.0, 0, 0);
- BizInfo[bizid][bPickupID] = CreatePickup(ICON_BIZ_PENDING, 1, BizInfo[bizid][bX], BizInfo[bizid][bY], BizInfo[bizid][bZ], 0);
- BizInfo[bizid][bPickupEnter] = CreatePickup(ICON_BIZ_INTERIOR, 1, BizInfo[bizid][beX], BizInfo[bizid][beY], BizInfo[bizid][beZ], BizInfo[bizid][bVW]);
- BizLabelEnterID[bizid] = Create3DTextLabel("~ Press F to exit ~", WHITE, BizInfo[bizid][beX], BizInfo[bizid][beY], BizInfo[bizid][beZ], 20.0, BizInfo[bizid][bVW], 0);
- }
- else
- {
- format(str, sizeof(str), "%s\nOwner : "WHITE_U"%s\n"LBLUE_U"Enter price : "WHITE_U"%i$\n"LBLUE_U"Investor : "WHITE_U"%s", BizInfo[bizid][bName], BizInfo[bizid][bOwner], BizInfo[bizid][bEnterPrice], BizInv[bizid][iName]);
- BizLabelID[bizid] = Create3DTextLabel(str, LBLUE, BizInfo[bizid][bX], BizInfo[bizid][bY], BizInfo[bizid][bZ], 20.0, 0, 0);
- if(BizInfo[bizid][bOpen]) BizInfo[bizid][bPickupID] = CreatePickup(ICON_BIZ_OPEN, 1, BizInfo[bizid][bX], BizInfo[bizid][bY], BizInfo[bizid][bZ], 0);
- else BizInfo[bizid][bPickupID] = CreatePickup(ICON_BIZ_LOCKED, 1, BizInfo[bizid][bX], BizInfo[bizid][bY], BizInfo[bizid][bZ], 0);
- BizInfo[bizid][bPickupEnter] = CreatePickup(ICON_BIZ_INTERIOR, 1, BizInfo[bizid][beX], BizInfo[bizid][beY], BizInfo[bizid][beZ], BizInfo[bizid][bVW]);
- BizLabelEnterID[bizid] = Create3DTextLabel("~ Press F to exit ~", WHITE, BizInfo[bizid][beX], BizInfo[bizid][beY], BizInfo[bizid][beZ], 20.0, BizInfo[bizid][bVW], 0);
- }
- SaveBizData(bizid);
- return 1;
- }
- //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- GetNearestBiz(playerid)
- {
- new near = INVALID_BIZ_ID;
- for(new i; i<MAX_BIZ; i++)
- {
- if(!BizInfo[i][bCreated]) continue;
- if(!IsPlayerInRangeOfPoint(playerid, 3.0, BizInfo[i][bX], BizInfo[i][bY], BizInfo[i][bZ])) continue;
- near = i;
- }
- return near;
- }
- //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- IsNearABiz(playerid) return GetNearestBiz(playerid) == INVALID_BIZ_ID ? false : true;
- //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- EnterInABiz(playerid, bizid)
- {
- new IntA = BizInfo[bizid][bInterior];
- if(IntA == -1) return SCMF(playerid, -1," Debug: IntA: %i | bizid : %i | Interior: %i", IntA, bizid, BizInfo[bizid][bInterior]);
- switch(BizInfo[bizid][bType])
- {
- case 1:
- {
- SetPlayerPos(playerid, Int247[IntA][X], Int247[IntA][Y], Int247[IntA][Z]);
- SetPlayerInterior(playerid, Int247[IntA][Interior]);
- }
- case 2:
- {
- SetPlayerPos(playerid, Ammunation[IntA][X], Ammunation[IntA][Y], Ammunation[IntA][Z]);
- SetPlayerInterior(playerid, Ammunation[IntA][Interior]);
- }
- case 3:
- {
- SetPlayerPos(playerid, Shop[IntA][X], Shop[IntA][Y], Shop[IntA][Z]);
- SetPlayerInterior(playerid, Shop[IntA][Interior]);
- }
- case 4:
- {
- SetPlayerPos(playerid, Clothes[IntA][X], Clothes[IntA][Y], Clothes[IntA][Z]);
- SetPlayerInterior(playerid, Clothes[IntA][Interior]);
- }
- case 5:
- {
- SetPlayerPos(playerid, Food[IntA][X], Food[IntA][Y], Food[IntA][Z]);
- SetPlayerInterior(playerid, Food[IntA][Interior]);
- }
- case 6:
- {
- SetPlayerPos(playerid, Gym[IntA][X], Gym[IntA][Y], Gym[IntA][Z]);
- SetPlayerInterior(playerid, Gym[IntA][Interior]);
- }
- default : SCMF(playerid, -1," Debug: IntA: %i | bizid : %i | Interior: %i", IntA, bizid, BizInfo[bizid][bInterior]);
- }
- SetPlayerVirtualWorld(playerid, BizInfo[bizid][bVW]);
- LastBizVisited[playerid] = bizid;
- return 1;
- }
- //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- ExitABiz(playerid, bizid)
- {
- SetPlayerInterior(playerid, 0);
- SetPlayerVirtualWorld(playerid, 0);
- SetPlayerPos(playerid, BizInfo[bizid][bX], BizInfo[bizid][bY], BizInfo[bizid][bZ]);
- LastBizVisited[playerid] = INVALID_BIZ_ID;
- return 1;
- }
- //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- GetPlayerBiz(playerid)
- {
- static biz = INVALID_BIZ_ID;
- for(new i; i<MAX_BIZ; i++)
- {
- if(!BizInfo[i][bCreated]) continue;
- if(!strcmp(BizInfo[i][bOwner], GetName(playerid))) biz = i;
- else continue;
- }
- return biz;
- }
- //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- OpenFormatBiz(bizid)
- {
- static open[40];
- if(BizInfo[bizid][bOpen]) format(open, sizeof(open), "Open");
- else format(open, sizeof(open), "Closed");
- return open;
- }
- //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- forward TeleChecking(playerid);
- public TeleChecking(playerid)
- {
- if(GetPlayerInterior(playerid) > 0 && GetPlayerVirtualWorld(playerid) > 214799999) return 1;
- SCMF(playerid, RED, "An error occured. You left a biz by teleportation.");
- printf("[FS] Admin | %s left a biz by teleportation | LastBizVisited ID:%i", GetNameEx(playerid), LastBizVisited[playerid]);
- LastBizVisited[playerid] = INVALID_BIZ_ID;
- return 1;
- }
- //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- SaveInvestorData(bizid)
- {
- new INI:File = INI_Open(InvestorPath(bizid));
- INI_SetTag(File, "Stats");
- INI_WriteInt(File,"ID",BizInv[bizid][iID]);
- INI_WriteString(File,"Name", BizInv[bizid][iName]);
- INI_WriteBool(File,"Inves",BizInv[bizid][iInves]);
- INI_WriteBool(File,"Safe",BizInv[bizid][iLock]);
- INI_WriteBool(File,"Safe",BizInv[bizid][iSafe]);
- INI_WriteBool(File,"EnterPrice",BizInv[bizid][iEnterPrice]);
- INI_WriteBool(File,"Rename",BizInv[bizid][iRename]);
- INI_WriteBool(File,"Deposit",BizInv[bizid][iDeposit]);
- INI_WriteBool(File,"Withdraw",BizInv[bizid][iWithdraw]);
- INI_Close(File);
- }
- //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- IsPlayerConnectedByName(const name[])
- {
- foreach(new i : Player)
- {
- if(strcmp(name, GetName(i))) continue;
- return true;
- }
- return false;
- }
- //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- GetIDByName(const name[])
- {
- foreach(new i : Player)
- {
- if(!strcmp(GetName(i), name)) return i;
- }
- printf("[FS] Error : No player found for the name '%s'.", name);
- return -1;
- }
- //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- ShowDialogInvPerm(playerid, bizid)
- {
- new final[1000], str[150];
- if(BizInv[bizid][iSafe]) format(str, sizeof(str), WHITE_U "Access to biz's informations : "GREEN_U"Authorized"), strcat(final, str);
- else format(str, sizeof(str), WHITE_U "Access to biz's informations : "RED_U"Unauthorized"), strcat(final, str);
- if(BizInv[bizid][iLock]) format(str, sizeof(str), "\n"LBLUE_U"Can lock the biz : "GREEN_U"Authorized"), strcat(final, str);
- else format(str, sizeof(str), LBLUE_U "\nCan lock the biz : "RED_U"Unauthorized"), strcat(final, str);
- if(BizInv[bizid][iEnterPrice]) format(str, sizeof(str), LBLUE_U "\nModfiy the enter price : "GREEN_U"Authorized"), strcat(final, str);
- else format(str, sizeof(str), LBLUE_U "\nModfiy the enter price : "RED_U"Unauthorized"), strcat(final, str);
- if(BizInv[bizid][iRename]) format(str, sizeof(str), LBLUE_U "\nRename the biz : "GREEN_U"Authorized"), strcat(final, str);
- else format(str, sizeof(str), LBLUE_U "\nRename the biz : "RED_U"Unauthorized"), strcat(final, str);
- if(BizInv[bizid][iDeposit]) format(str, sizeof(str), LBLUE_U "\nCan deposit : "GREEN_U"Authorized"), strcat(final, str);
- else format(str, sizeof(str), LBLUE_U "\nCan deposit : "RED_U"Unauthorized"), strcat(final, str);
- if(BizInv[bizid][iWithdraw]) format(str, sizeof(str), LBLUE_U "\nCan withdraw : "GREEN_U"Authorized"), strcat(final, str);
- else format(str, sizeof(str), LBLUE_U "\nCan withdraw : "RED_U"Unauthorized"), strcat(final, str);
- format(str, sizeof(str), WHITE_U "Modify investor's rights of %s", BizInv[bizid][iName]);
- Dialog_Show(playerid, DIALOG_MODIFY_INVESTOR, DIALOG_STYLE_LIST, str, final, "Choose", "Cancel");
- BizCreating[playerid] = -1;
- BizCreating[playerid] = bizid;
- return 1;
- }
- //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- ShowDialogInvestor(playerid, bizid)
- {
- new final[1000], str[150];
- if(BizInv[bizid][iSafe]) format(str, sizeof(str), GREEN_U "Access to biz's informations\n"), strcat(final, str);
- else format(str, sizeof(str), WHITE_U RED_U"Access to biz's informations\n"), strcat(final, str);
- if(BizInv[bizid][iLock]) format(str, sizeof(str), GREEN_U"Unlock the biz\n"), strcat(final, str);
- else format(str, sizeof(str), RED_U "Lock the biz\n"), strcat(final, str);
- if(BizInv[bizid][iEnterPrice]) format(str, sizeof(str), GREEN_U "Modfiy the enter price\n"), strcat(final, str);
- else format(str, sizeof(str), RED_U "Modfiy the enter price\n"), strcat(final, str);
- if(BizInv[bizid][iRename]) format(str, sizeof(str), GREEN_U "Rename the biz\n"), strcat(final, str);
- else format(str, sizeof(str), RED_U "Rename the biz\n"), strcat(final, str);
- if(BizInv[bizid][iDeposit]) format(str, sizeof(str), GREEN_U "Deposit\n"), strcat(final, str);
- else format(str, sizeof(str), RED_U "Deposit\n"), strcat(final, str);
- if(BizInv[bizid][iWithdraw]) format(str, sizeof(str), GREEN_U "Withdraw"), strcat(final, str);
- else format(str, sizeof(str), RED_U "Withdraw"), strcat(final, str);
- format(str, sizeof(str), WHITE_U "Info the %s's biz.", BizInfo[bizid][bOwner]);
- Dialog_Show(playerid, DIALOG_INVESTOR, DIALOG_STYLE_LIST, str, final, "Choose", "Cancel");
- return 1;
- }
- //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- ResetInvestorData(bizid)
- {
- format(BizInv[bizid][iName], 24, "Nobody");
- BizInv[bizid][iInves] = false;
- BizInv[bizid][iSafe] = false;
- BizInv[bizid][iLock] = false;
- BizInv[bizid][iRename] = false;
- BizInv[bizid][iWithdraw] = false;
- BizInv[bizid][iDeposit] = false;
- SaveInvestorData(bizid);
- return 1;
- }
- //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- GetInvestorBizID(playerid)
- {
- for(new i; i < MAX_BIZ; i++)
- {
- if(!BizInv[i][iInves]) continue;
- if(strcmp(GetName(playerid), BizInv[i][iName])) continue;
- return i;
- }
- return INVALID_BIZ_ID;
- }
- //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- SetMoneyGameText(playerid, bool:negative, amount)
- {
- if(negative)
- {
- new str[50];
- format(str, sizeof(str), "~r~-%i$", amount);
- GameTextForPlayer(playerid, str, 500, 1);
- }
- else
- {
- new str[50];
- format(str, sizeof(str), "~g~%i$", amount);
- GameTextForPlayer(playerid, str, 500, 1);
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment