Raised This Month: $12 Target: $400
 3% 

Kewaii Roulette in Command


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Shins
Junior Member
Join Date: Oct 2020
Old 11-21-2020 , 15:34   Kewaii Roulette in Command
Reply With Quote #1

Hello

I would like to make this in command !roulette <color> <credits>


PHP Code:
#pragma semicolon 1
#include <csgocolors>
#include <store>
#include <sourcemod>
#include <sdktools>
#pragma newdecls required

int ScrollTimes[MAXPLAYERS 1];
int WinNumber[MAXPLAYERS 1];
int betAmount[MAXPLAYERS 1];
bool isSpinning[MAXPLAYERS 1] = false;


//ConVar g_Cvar_NormalItems;
//ConVar g_Cvar_VIPItems;
ConVar g_Cvar_VIPFlag;

char FULL_SOUND_PATH[] = "sound/ruleta/ruleta.mp3";
char RELATIVE_SOUND_PATH[] = "*ruleta/ruleta.mp3";
    
//char g_sNormalItems[64];
//char g_sVIPItems[64];
#define PLUGIN_NAME "Store Roulette by Kewaii"
#define PLUGIN_AUTHOR "Kewaii"
#define PLUGIN_DESCRIPTION "Zephyrus Store Roulette"
#define PLUGIN_VERSION "1.3.9"
#define PLUGIN_TAG " \x07[ HAWKS ]"

public Plugin myinfo =
{
    
name        =    PLUGIN_NAME,
    
author        =    PLUGIN_AUTHOR,
    
description    =    PLUGIN_DESCRIPTION,
    
version        =    PLUGIN_VERSION,
    
url            =    "http://steamcommunity.com/id/KewaiiGamer"
};

public 
void OnPluginStart()
{    
    
g_Cvar_VIPFlag CreateConVar("kewaii_roulette_vip_flag""a""VIP Access Flag");
    
//g_Cvar_NormalItems = CreateConVar("kewaii_roulette_normal_items", "100,500,750,1000,1500,1750,2000,2500,3000,4000,5000", "Lists all the menu items for normal player roulette. Separate each item with a comma. Only integers allowed");
    //g_Cvar_VIPItems = CreateConVar("kewaii_roulette_vip_items", "5000,5500,6000,6500,7000,7500,8000,8500,9000,10000,12500,15000", "Lists all the menu items for VIP player roulette. Separate each item with a comma. Only integers allowed");
    
RegConsoleCmd("sm_ruleta"CommandRoulette);
    
LoadTranslations("kewaii_roulette.phrases");
    
AutoExecConfig(true"kewaii_roulette");
}

public 
void OnMapStart()
{
    
AddFileToDownloadsTableFULL_SOUND_PATH);
    
FakePrecacheSound(RELATIVE_SOUND_PATH);
}

public 
void OnClientPostAdminCheck(int client)
{
    
isSpinning[client] = false;
}

public 
Action CommandRoulette(int clientint args)
{
    if (
args 1)
    {
        
ReplyToCommand(client"[SM] Usage: sm_ruleta <culoare> <suma>");
        return 
Plugin_Handled;
    }
}

/*Menu CreateRouletteMenu(int client)
{
    Menu menu = new Menu(RouletteMenuHandler);
    char buffer[128];
    Format(buffer, sizeof(buffer), "%T", "ChooseType", client);
    menu.SetTitle(buffer);    
    menu.AddItem("player", "Player");
    menu.AddItem("vip", "VIP", !HasClientVIP(client) ? ITEMDRAW_DISABLED : ITEMDRAW_DEFAULT);        
    return menu;
}

public int RouletteMenuHandler(Menu menu, MenuAction action, int client, int selection)
{
    switch(action)
    {
        case MenuAction_Select:
        {
            if(IsClientInGame(client))
            {
                char option[32];
                menu.GetItem(selection, option, sizeof(option));
                if (StrEqual(option, "player"))
                {
                    CreatePlayerRouletteMenu(client).Display(client, MENU_TIME_FOREVER);
                }
                if (StrEqual(option, "vip"))
                {
                    CreateVIPRouletteMenu(client).Display(client, MENU_TIME_FOREVER);
                }
            }
        }
        case MenuAction_End:
        {
            delete menu;
        }
    }
}


Menu CreatePlayerRouletteMenu(int client)
{
    Menu menu = new Menu(CreditsChosenMenuHandler);
    char buffer[128];
    Format(buffer, sizeof(buffer), "%T", "ChooseCredits", client, Store_GetClientCredits(client));
    menu.SetTitle(buffer);    
    GetConVarString(g_Cvar_NormalItems, g_sNormalItems, sizeof(g_sNormalItems));
    char sItems[18][16];
    ExplodeString(g_sNormalItems, ",", sItems, sizeof(sItems), sizeof(sItems[]));
    for (int i = 0; i < sizeof(sItems); i++) {
        if (!StrEqual(sItems[i], "")) {
            menu.AddItem(sItems[i], sItems[i], Store_GetClientCredits(client) >= StringToInt(sItems[i]) ? ITEMDRAW_DEFAULT : ITEMDRAW_DISABLED);    
        }
    }
    menu.ExitBackButton = true;
    return menu;
}


Menu CreateVIPRouletteMenu(int client)
{
    Menu menu = new Menu(CreditsChosenMenuHandler);
    char buffer[128];        
    Format(buffer, sizeof(buffer), "%T", "ChooseCredits", client, Store_GetClientCredits(client));
    menu.SetTitle(buffer);    
    GetConVarString(g_Cvar_VIPItems, g_sVIPItems, sizeof(g_sVIPItems));
    char sItems[18][16];
    ExplodeString(g_sVIPItems, ",", sItems, sizeof(sItems), sizeof(sItems[]));
    for (int i = 0; i < sizeof(sItems); i++) {
        if (!StrEqual(sItems[i], "")) {
            menu.AddItem(sItems[i], sItems[i], Store_GetClientCredits(client) >= StringToInt(sItems[i]) ? ITEMDRAW_DEFAULT : ITEMDRAW_DISABLED);    
        }
    }
    menu.ExitBackButton = true;
    return menu;
}

public int CreditsChosenMenuHandler(Menu menu, MenuAction action, int client, int selection)
{
    switch(action)
    {
        case MenuAction_Select:
        {
            if(IsClientInGame(client))
            {
                char option[32];
                menu.GetItem(selection, option, sizeof(option));
                                
                int crd = Store_GetClientCredits(client);
                int bet = StringToInt(option);
                if(crd >= bet)
                {
                    if (!isSpinning[client])
                    {
                        Store_SetClientCredits(client, crd - bet);
                        betAmount[client] = bet;
                        SpinCredits(client);
                        isSpinning[client] = true;
                    }
                    else
                    {
                        CPrintToChat(client, "%s %t", PLUGIN_TAG, "AlreadySpinning");
                    }
                } 
                else
                {
                    CPrintToChat(client, "%s %t", PLUGIN_TAG,  "NoEnoughCredits", bet - crd);
                }
            }
        }
        case MenuAction_Cancel:
        {
            if (IsClientInGame(client) && selection == MenuCancel_ExitBack)
            {
                CreateRouletteMenu(client).Display(client, 10);
            }
        }
        case MenuAction_End:
        {
            delete menu;
        }
    }
}*/

public void SpinCredits(int client)
{
    
int    FakeNumber GetRandomInt(0,999);
    if(
FakeNumber && FakeNumber 111)
    {
    
PrintHintText(client"</font><font color='#75D1FF'>→ </font><font color='#FFFFFF'>Culoare: </font><font color='#00FF00'> Verde  </font><font color='#75D1FF'>←"FakeNumber);
    }
    if(
FakeNumber 111 && FakeNumber 555)
    {
    
PrintHintText(client"</font><font color='#75D1FF'>→ </font><font color='#FFFFFF'>Culoare: </font><font color='#000000'>Negru </font><font color='#75D1FF'>←"FakeNumber);
    }
    if(
FakeNumber >= 555 && FakeNumber 999)
    {
    
PrintHintText(client"</font><font color='#75D1FF'>→ </font><font color='#FFFFFF'>Culoare: </font><font color='#E60000'>Rosu  </font><font color='#75D1FF'>←"FakeNumber);
    }
    if(
ScrollTimes[client] == 0)
    {
        
ClientCommand(client"playgamesound *ui/csgo_ui_crate_open.wav");
    }
    if(
ScrollTimes[client] < 20)
    {
        
CreateTimer(0.05TimerNextclient);
        
ScrollTimes[client] += 1;
        
ClientCommand(client"playgamesound *ui/csgo_ui_crate_item_scroll.wav");
    } 
    else if(
ScrollTimes[client] < 30)
    {
        
float AddSomeTime 0.05 ScrollTimes[client] / 3;
        
CreateTimer(AddSomeTimeTimerNextclient);
        
ScrollTimes[client] += 1;
        
ClientCommand(client"playgamesound *ui/csgo_ui_crate_item_scroll.wav");
    }
    else if(
ScrollTimes[client] == 30)
    {
        
int troll GetRandomInt(1,2);
        if(
troll == 1)
        {
            
ClientCommand(client"playgamesound *ui/csgo_ui_crate_item_scroll.wav");
            
ScrollTimes[client] += 1;
            
CreateTimer(1.5TimerNextclient);
        }
        else
        {
            
ClientCommand(client"playgamesound *ui/csgo_ui_crate_item_scroll.wav");
            
CreateTimer(1.5TimerFinishingclient);
            
WinNumber[client] = FakeNumber;
            
ScrollTimes[client] = 0;
        }
    } 
    else
    {
        
ClientCommand(client"playgamesound *ui/csgo_ui_crate_item_scroll.wav");
        
CreateTimer(1.5TimerFinishingclient);
        
WinNumber[client] = FakeNumber;
        
ScrollTimes[client] = 0;
    }
}

public 
Action TimerFinishing(Handle timerany client)
{
    if (
IsClientInGame(client))
    {
        
isSpinning[client] = false;
        
WinCredits(clientWinNumber[client], betAmount[client]);
    }
}

public 
void WinCredits(int clientint Numberint Bet)
{
    if(
IsClientInGame(client))
    {            
        
int multiplier;
        if(
Number >= && Number 111)
        {
            
multiplier 14;
            if(
Bet multiplier >= 70000)
            {
                
EmitSoundToAll(RELATIVE_SOUND_PATH);
            }
            else
            {
            
ClientCommand(client"playgamesound *ui/item_drop3_rare.wav");
            }
        }
        if(
Number >= 111 && Number 555)
        {
            
multiplier 2;
            
ClientCommand(client"playgamesound *ui/item_drop3_rare.wav");
        }
        if(
Number >= 555 && Number 999)
        {
            
multiplier 2;
            
ClientCommand(client"playgamesound *ui/item_drop3_rare.wav");
        }
        if (
multiplier 0)
        {    
            if(
Bet multiplier >= 10000)
            {
                if(
Number >= && Number 111)
                {
                
CPrintToChatAll("%s \x04%N \x01a castigat \x07%i \x01credite pe culoarea verde!"PLUGIN_TAGclientBet multiplier);
                }
                if(
Number >= 111 && Number 555)
                {
                
CPrintToChatAll("%s \x04%N \x01a castigat \x07%i \x01credite pe culoarea neagra!"PLUGIN_TAGclientBet multiplier);
                }
                if(
Number >= 555 && Number 999)
                {
                
CPrintToChatAll("%s \x04%N \x01a castigat \x07%i \x01credite pe culoarea rosie!"PLUGIN_TAGclientBet multiplier);
                }
            }
            if(
Number >= && Number 111)
            {
                
CPrintToChat(client"%s \x01Ai castigat {red}%i credite \x01pe culoare verde!"PLUGIN_TAGBet multiplier);
            }
            if(
Number >= 111 && Number 555)
            {
                
CPrintToChat(client"%s \x01Ai castigat {red}%i credite \x01pe culoarea neagra!"PLUGIN_TAGBet multiplier);
            }
            if(
Number >= 555 && Number 999)
            {
                
CPrintToChat(client"%s \x01Ai castigat {red}%i credite \x01pe culoarea rosie!"PLUGIN_TAGBet multiplier);
            }
            
Store_SetClientCredits(clientStore_GetClientCredits(client) + Bet * (multiplier 1));
        }
    }
}

public 
Action TimerNext(Handle timerany client)
{
    if (
IsClientInGame(client))
    {
        
SpinCredits(client);
    }
}

public 
bool HasClientVIP(int client)
{
    
char ConVarValue[32];
    
GetConVarString(g_Cvar_VIPFlagConVarValuesizeof(ConVarValue));
    
int flag ReadFlagString(ConVarValue);
    return 
CheckCommandAccess(client""flagtrue);
    
}

void FakePrecacheSound(const char[] szPath)
{
    
AddToStringTable(FindStringTable"soundprecache" ), szPath);

Shins is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 18:58.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode