Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sourcemod>
- #include <sdktools>
- #include <baronnhud>
- #include <colors>
- #pragma semicolon 1
- #define MIN_CREDITS 499
- #define SMIN_CREDITS 500
- #define MAX_CREDITS 200000
- #define PREFIX "\x01[\x04Roulette\x01]"
- native Store_GetClientCredits(client);
- native Store_SetClientCredits(client, credits);
- int roll = 48;
- int cNum;
- int rStatus = 0;
- int green[33], blue[33], red[33];
- public Plugin myinfo =
- {
- name = "[Store] Roulette",
- author = "BaroNN & Hirsw0w",
- description = "",
- version = "1.4",
- url = ""
- };
- public void OnPluginStart()
- {
- RegConsoleCmd("sm_roulette", Command_Roulette);
- CreateTimer(10.0, Timer_Roullete);
- }
- public Action Timer_Roullete(Handle timer)
- {
- if(rStatus == 0)
- {
- rStatus = 1;
- BNShowHudAll("255 255 255", "5.0", "120 Seconds To Place Bets, /roulette [red/blue/green] <Amount>", "0.20", "1.0");
- for (int i = 1; i <= 32;i++)
- {
- green[i] = 0;
- red[i] = 0;
- blue[i] = 0;
- }
- }
- else if(rStatus == 1)
- {
- CreateTimer(1.0 / 48.0, rSpin);
- cNum = GetRandomInt(0, 14);
- roll = 45;
- rStatus = 2;
- BNShowHudAll("255 255 255", "5.0", "Placing bets time is over, let it roll!", "0.20", "1.0");
- }
- CreateTimer(120.0, Timer_Roullete);
- }
- public Action Command_Roulette(int client, int args)
- {
- if(rStatus != 1)
- {
- PrintToChat(client, "%s \x10The roullete placing bets time is over, \x3wait for the next one to start.", PREFIX);
- return Plugin_Handled;
- }
- char arg1[32], arg2[32], Name[32];
- GetClientName(client, Name, 32);
- GetCmdArg(1, arg1, 32);
- GetCmdArg(2, arg2, 32);
- int price = StringToInt(arg2);
- if(arg1[0] == '\0' || arg2[0] == '\0')
- {
- PrintToChat(client, "%s \x10Usage: /roulette \x1[\x2red\x01/\x03blue\x01/\x4green\x1] \x1[\x10Credits\x1]", PREFIX);
- return Plugin_Handled;
- }
- if(price > Store_GetClientCredits(client))
- {
- PrintToChat(client, "%s \x2You don't have enough credits to place a bet on the roulette.", PREFIX);
- return Plugin_Handled;
- }
- if(price < MIN_CREDITS)
- {
- PrintToChat(client, "%s \x04You have to spend at least \x02%d \x04credits.", PREFIX, SMIN_CREDITS);
- return Plugin_Handled;
- }
- else if(price > MAX_CREDITS)
- {
- PrintToChat(client, "%s \x04You can't spend that much credits (Max: \x02%d\x04).", PREFIX, MAX_CREDITS);
- return Plugin_Handled;
- }
- if(!strcmp(arg1,"green",true))
- {
- green[client] += price;
- Store_SetClientCredits(client, Store_GetClientCredits(client) - price);
- PrintToChat(client, "%s \x10You Placed %d Credits On The Color: \x04Green!", PREFIX, price);
- }
- else if(!strcmp(arg1,"blue",true))
- {
- blue[client] += price;
- Store_SetClientCredits(client, Store_GetClientCredits(client) - price);
- PrintToChat(client, "%s \x10You Placed %d Credits On The Color: \x03Blue!", PREFIX, price);
- }
- else if(!strcmp(arg1,"red",true))
- {
- red[client] += price;
- Store_SetClientCredits(client, Store_GetClientCredits(client) - price);
- PrintToChat(client, "%s \x10You Placed %d Credits On The Color: \x02Red!", PREFIX, price);
- }
- return Plugin_Handled;
- }
- public Action rSpin(Handle timer)
- {
- cNum++;
- if (cNum == 15)cNum = 0;
- if(cNum == 0)PrintHintTextToAll("<big><b>\t\t<font color='#00FF00'>0</font>\n\t\t^</b></big>");
- else if(cNum % 2 == 0)PrintHintTextToAll("<big><b>\t\t<font color='#0000FF'>%d</font>\n\t\t^</b></big>",cNum);
- else PrintHintTextToAll("<big><b>\t\t<font color='#FF0000'>%d</font>\n\t\t^</b></big>",cNum);
- if (roll != 0)
- {
- roll--;
- CreateTimer(1.0 / float(roll+1), rSpin);
- }
- else if(roll == 0)
- {
- rStatus = 0;
- char name[9];
- if (cNum == 0) Format(name,9, "green");
- else if (cNum % 2 == 0)Format(name,9, "blue");
- else Format(name,9, "red");
- BNShowHudAll("255 102 51", "5.0", "Winning Number Is %d, Winning color %s", "0.20", "1.0", cNum, name);
- for (int i = 1; i <= 32;i++)
- {
- if (!IsClientConnected(i))continue;
- if(green[i] > 0)
- {
- if(cNum == 0)
- {
- PrintToChat(i,"%s \x04You have \x04Won! \x01 %d\x04credits on green.", PREFIX, green[i], green[i] * 14);
- Store_SetClientCredits(i, Store_GetClientCredits(i) + green[i] * 14);
- }
- else PrintToChat(i, "%s \x04You have \x02Lost\x01 %d \x04credits on green.", PREFIX, green[i]);
- }
- if(blue[i] > 0)
- {
- if(cNum % 2 == 0)
- {
- PrintToChat(i,"%s \x03You have \x04won!\x01 %d\x03credits on blue.", PREFIX, blue[i] * 2);
- Store_SetClientCredits(i, Store_GetClientCredits(i) + blue[i] * 2);
- }
- else PrintToChat(i, "%s \x03You have \x02Lost\x01 %d \x03credits on blue.", PREFIX, blue[i]);
- }
- if(red[i] > 0)
- {
- if(cNum % 2 != 0)
- {
- PrintToChat(i,"%s \x02You have Won \x01 %d\x02credits on red.", PREFIX, red[i] * 2);
- Store_SetClientCredits(i, Store_GetClientCredits(i) + red[i] * 2);
- }
- else PrintToChat(i, "%s \x02You have Lost \x01 %d\x02credits on red.", PREFIX, red[i]);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement