Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sourcemod>
- #include <cstrike>
- #include <sdktools>
- native Store_GetClientCredits(client);
- native Store_SetClientCredits(client, credits);
- #define PREFIX "\x01[\x03CaseOpening\x01]\x04"
- char casePREFIX[32] = "";
- int gTime[32], bCase[32], Item, Case, MIN, MAX;
- ConVar OpenCost1, OpenCost2, OpenCost3, OpenCost4, OpenCost5, OpenCost6;
- ConVar MinPrice1, MinPrice2, MinPrice3, MinPrice4, MinPrice5, MinPrice6;
- ConVar MaxPrice1, MaxPrice2, MaxPrice3, MaxPrice4, MaxPrice5, MaxPrice6;
- public Plugin myinfo =
- {
- name = "[Store] Case Opening",
- author = "BaroNN",
- description = "Case Opening Plugin for Zephyrus Store",
- version = "1.2",
- url = ""
- };
- public void OnPluginStart()
- {
- RegConsoleCmd("sm_cases", CaseMenu);
- RegConsoleCmd("sm_case", CaseMenu);
- RegConsoleCmd("sm_opencase", CaseMenu);
- // Case 1 //
- OpenCost1 = CreateConVar("store_case1_open_cost", "1000");
- MinPrice1 = CreateConVar("store_case1_min_price", "100");
- MaxPrice1 = CreateConVar("store_case1_max_price", "2000");
- // Case 2 //
- OpenCost2 = CreateConVar("store_case2_open_cost", "5000");
- MinPrice2 = CreateConVar("store_case2_min_price", "100");
- MaxPrice2 = CreateConVar("store_case2_max_price", "6000");
- // Case 3 //
- OpenCost3 = CreateConVar("store_case3_open_cost", "10000");
- MinPrice3 = CreateConVar("store_case3_min_price", "100");
- MaxPrice3 = CreateConVar("store_case3_max_price", "11000");
- // Case 4 //
- OpenCost4 = CreateConVar("store_case4_open_cost", "25000");
- MinPrice4 = CreateConVar("store_case4_min_price", "100");
- MaxPrice4 = CreateConVar("store_case4_max_price", "26500");
- // Case 5 //
- OpenCost5 = CreateConVar("store_case5_open_cost", "50000");
- MinPrice5 = CreateConVar("store_case5_min_price", "100");
- MaxPrice5 = CreateConVar("store_case5_max_price", "65000");
- // Case 6 //
- OpenCost6 = CreateConVar("store_case6_open_cost", "100000");
- MinPrice6 = CreateConVar("store_case6_min_price", "100");
- MaxPrice6 = CreateConVar("store_case6_max_price", "110000");
- AutoExecConfig(true, "store_caseopening");
- }
- public void OnMapStart()
- {
- PrecacheSound("misc/caseopening.mp3", true);
- AddFileToDownloadsTable("sound/caseopening.mp3");
- }
- public Action CaseMenu(int client, int args)
- {
- if (gTime[client] > GetTime())
- {
- PrintToChat(client, "%s \x03You can open only one case per\x03 10 \x04seconds.", PREFIX);
- return Plugin_Handled;
- }
- if (bCase[client])
- {
- PrintToChat(client, "%s \x03You are allready opening a case wait.", PREFIX);
- return Plugin_Handled;
- }
- Handle menu = CreateMenu(Handelecases);
- SetMenuTitle(menu, "[Store] Case Opening Menu\nBalance: %d (By BaroNN)", Store_GetClientCredits(client));
- AddMenuItem(menu, "", "Hurricane Case [1000 Credits]");
- AddMenuItem(menu, "", "Vulcan Case [5000 Credits]");
- AddMenuItem(menu, "", "Revolution Case [10000 Credits]");
- AddMenuItem(menu, "", "Velocity Case [25000 Credits]");
- AddMenuItem(menu, "", "Masterline Case [50000 Credits]");
- AddMenuItem(menu, "", "BaroNN Case [100000 Credits]");
- DisplayMenu(menu, client, 30);
- return Plugin_Continue;
- }
- public int Handelecases(Menu menu, MenuAction action, int client, int itemNum)
- {
- if (action == MenuAction_End)
- CloseHandle(menu);
- if (action == MenuAction_Select)
- {
- switch (itemNum)
- {
- case 0:Case = GetConVarInt(OpenCost1), casePREFIX = "Hurricane";
- case 1:Case = GetConVarInt(OpenCost2), casePREFIX = "Vulcan";
- case 2:Case = GetConVarInt(OpenCost3), casePREFIX = "Revolution";
- case 3:Case = GetConVarInt(OpenCost4), casePREFIX = "Velocity";
- case 4:Case = GetConVarInt(OpenCost5), casePREFIX = "Masterline";
- case 5:Case = GetConVarInt(OpenCost6), casePREFIX = "BaroNN";
- }
- Item = itemNum;
- StartOpening(client);
- }
- }
- stock void StartOpening(int client)
- {
- if (Store_GetClientCredits(client) >= Case)
- {
- bCase[client] = true;
- ClientCommand(client, "play *caseopening.mp3");
- CreateTimer(0.1, CaseStart, client, TIMER_REPEAT);
- Store_SetClientCredits(client, Store_GetClientCredits(client) - Case);
- }
- else PrintToChat(client, "%s \x03You Dont Have Enough Credits\x10 To Open The \x03%s \x04Case.", PREFIX, casePREFIX);
- }
- public Action CaseStart(Handle timer, any client)
- {
- if (IsClientConnected(client) && IsClientInGame(client) && !IsFakeClient(client))
- {
- static int Number = 0;
- switch (Item)
- {
- case 0:MIN = GetConVarInt(MinPrice1), MAX = GetConVarInt(MaxPrice1);
- case 1:MIN = GetConVarInt(MinPrice2), MAX = GetConVarInt(MaxPrice2);
- case 2:MIN = GetConVarInt(MinPrice3), MAX = GetConVarInt(MaxPrice3);
- case 3:MIN = GetConVarInt(MinPrice4), MAX = GetConVarInt(MaxPrice4);
- case 4:MIN = GetConVarInt(MinPrice5), MAX = GetConVarInt(MaxPrice5);
- case 5:MIN = GetConVarInt(MinPrice6), MAX = GetConVarInt(MaxPrice6);
- }
- if (Number >= 100)
- {
- Number = 0;
- int randomNumber = GetRandomInt(MIN, MAX);
- PrintCenterText(client, "<big><b><font color='#dd2f2f'><center>[%s Case]</center>\n</font><font color='#0000FF'>|| <font color='#15fb00'>%i</font> <font color='#00CCFF'>Credits</font><font color='#0000FF'> ||</font></b></big>", casePREFIX, randomNumber);
- PrintToChat(client, "%s \x01%N \x10Has Opened a \x03%s \x04Case \x10And Found: \x03%i \x01Credits!", PREFIX, client, casePREFIX, randomNumber);
- Store_SetClientCredits(client, Store_GetClientCredits(client) + randomNumber);
- gTime[client] = GetTime() + 10;
- bCase[client] = false;
- return Plugin_Stop;
- }
- int randomNumber = GetRandomInt(MIN, MAX);
- PrintCenterText(client, "<big><b><font color='#0000FF'>||</font> <font color='#15fb00'>%i</font><font color='#00CCFF'> Credits</font> <font color='#0000FF'>||</font></b></big>", randomNumber);
- Number++;
- return Plugin_Continue;
- }
- return Plugin_Handled;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement