Raised This Month: $32 Target: $400
 8% 

[CS:S, CS:GO] Roll The Dice (Würfeln)


Post New Thread Reply   
 
Thread Tools Display Modes
Cruze
Veteran Member
Join Date: May 2017
Old 10-22-2018 , 12:36   Re: [CS:S, CS:GO] Roll The Dice (Würfeln)
Reply With Quote #141

Quote:
Originally Posted by Angeelor View Post
Can someone make a version for the Store by Zephyrus?

please?
Here is my version!
You need to put new translation file attached in this comment's attachment and delete cfg/dice/dice_config.cfg and reload/change map! New cvar "dice_credits" should be there in cfg/dice/dice_config.cfg. Put new value and reload/change map again.
PHP Code:
#include <sourcemod>
#include <sdktools>
#include <colors>
#include <autoexecconfig>
#include <store>

#undef REQUIRE_PLUGIN
#include <updater>

#pragma semicolon 1

#define DICES 33

new Handle:c_DiceText;
new 
Handle:c_ShowNumber;
new 
Handle:c_RandNumber;
new 
Handle:c_DiceTeam;
new 
Handle:c_DiceCount;
new 
Handle:c_DiceMoney;
new 
Handle:c_DiceCredits;

new 
String:DiceText[64];

new 
ShowNumber;
new 
RandNumber;
new 
DiceTeam;
new 
DiceMoney;
new 
DiceCredits;
new 
DiceCount;

new 
friction_default = -1;
new 
accelerate_default = -1;

new 
NoclipCounter[MAXPLAYERS 1];
new 
ClientDiced[MAXPLAYERS 1];
new 
FroggyJumped[MAXPLAYERS 1];
new 
fire[MAXPLAYERS 1];

new 
bool:EnabledNumbers[DICES+1];
new 
bool:LongJump[MAXPLAYERS 1];
new 
bool:Nightvision[MAXPLAYERS 1];
new 
bool:FroggyJump[MAXPLAYERS 1];
new 
bool:started;

public 
Plugin:myinfo =
{
    
name "Dice SM",
    
author "Popoklopsi edit Cruze",
    
version "1.6.2",
    
description "Roll the Dice by Popoklopsi",
    
url "https://forums.alliedmods.net/showthread.php?t=152035"
};

public 
APLRes:AskPluginLoad2(Handle:myselfbool:lateString:error[], err_max)
{
    
MarkNativeAsOptional("GetUserMessageType");

    return 
APLRes_Success;
}

public 
OnPluginStart()
{
    if (!
CColorAllowed(Color_Lightgreen) && CColorAllowed(Color_Darkred))
        
CReplaceColor(Color_LightgreenColor_Darkred);

    
started false;

    
AutoExecConfig_SetFile("dice_config""dice");
    
AutoExecConfig_CreateConVar("dice_sm""1.6.2""Dice for Sourcemod by Popoklopsi"FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY|FCVAR_DONTRECORD);
    
    
c_DiceText AutoExecConfig_CreateConVar("dice_text""dice""Command to dice (without exclamation mark), convert to UTF-8 without BOM for special characters");
    
c_ShowNumber AutoExecConfig_CreateConVar("dice_show""2""Players, which see the result: 1 = Everybody, 2 = just T's, 3 = just CT's, 4 = Only you");
    
c_RandNumber AutoExecConfig_CreateConVar("dice_rand""1""1 = Random text when result is a weapon, 0 = Off");
    
c_DiceTeam AutoExecConfig_CreateConVar("dice_team""2""2 = Only T's can dice, 3 = Only CT's can dice, 0 = Everybody can dice");
    
c_DiceCount AutoExecConfig_CreateConVar("dice_count""1""How often a player can dice per round");
    
c_DiceMoney AutoExecConfig_CreateConVar("dice_money""0""x = Money one dice costs, 0 = Off");
    
c_DiceCredits AutoExecConfig_CreateConVar("dice_credits""0""x = credits one dice costs, 0 = Off");

    
AutoExecConfig_CleanFile();
    
    
LoadEnables();

    
AutoExecConfig(true"dice_config""dice");
    
    
HookConVarChange(c_ShowNumberOnConVarChanged);
    
HookConVarChange(c_RandNumberOnConVarChanged);
    
HookConVarChange(c_DiceTeamOnConVarChanged);
    
    
HookEvent("player_spawn"PlayerSpawn);
    
HookEvent("player_death"PlayerDeath);
    
HookEvent("player_jump"PlayerJump);
    
HookEvent("round_start"RoundStart);
    
    
LoadTranslations("dice.phrases");
}

public 
OnConfigsExecuted()
{
    
decl String:ConsoleCmd[64];
    
    
GetConVarString(c_DiceTextDiceTextsizeof(DiceText));
    
    
ShowNumber GetConVarInt(c_ShowNumber);
    
RandNumber GetConVarInt(c_RandNumber);
    
DiceTeam GetConVarInt(c_DiceTeam);
    
DiceCount GetConVarInt(c_DiceCount);
    
DiceMoney GetConVarInt(c_DiceMoney);
    
DiceCredits GetConVarInt(c_DiceCredits);
    
accelerate_default GetConVarInt(FindConVar("sv_accelerate"));
    
friction_default GetConVarInt(FindConVar("sv_friction"));
    
    if (!
started)
    {
        
Format(ConsoleCmdsizeof(ConsoleCmd), "sm_%s"DiceText);
        
RegConsoleCmd(ConsoleCmdTypedText);
        
        
started true;
    }
}

public 
OnAllPluginsLoaded()
{
    if (
LibraryExists("updater"))
        
Updater_AddPlugin("http://popoklopsi.de/dice/update.txt");
}

public 
OnLibraryAdded(const String:name[])
{
    if (
StrEqual(name"updater"))
        
Updater_AddPlugin("http://popoklopsi.de/dice/update.txt");
}

public 
OnMapStart()
{
    
PrecacheSound("weapons/rpg/rocketfire1.wav");
    
PrecacheSound("weapons/rpg/rocket1.wav");
    
PrecacheSound("weapons/hegrenade/explode3.wav");
    
PrecacheModel("Effects/tp_eyefx/tp_eyefx.vmt");
}

public 
LoadEnables()
{
    
decl String:section[5];
    
    new 
Handle:keycvar CreateKeyValues("DiceEnables");
    
    if (
FileExists("cfg/dice/dice_enables.txt") && FileToKeyValues(keycvar"cfg/dice/dice_enables.txt"))
    {
        for (new 
1<= DICESx++)
        {
            
Format(sectionsizeof(section), "%i"x);
            
            if (
KvGetNum(keycvarsection1) == 1)
                
EnabledNumbers[x] = true;
            else
                
EnabledNumbers[x] = false;
        }
    }
    else
    {
        for (new 
1<= DICESx++)
            
EnabledNumbers[x] = true;
    }

    if (!
getGame())
        
EnabledNumbers[1] = false;
}

public 
Action:TypedText(clientargs)
{
    if (
client && client <= MaxClients && IsClientInGame(client))
        
PrepareDice(client);
    
    return 
Plugin_Handled;
}

public 
OnConVarChanged(Handle:hCvar, const String:oldValue[], const String:newValue[])
{
    if (
hCvar == c_ShowNumber
        
ShowNumber StringToInt(newValue);
        
    if (
hCvar == c_RandNumber
        
RandNumber StringToInt(newValue);
        
    if (
hCvar == c_DiceTeam
        
DiceTeam StringToInt(newValue);
}

public 
RoundStart(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
Handle:fr FindConVar("sv_friction");
    new 
Handle:ac FindConVar("sv_accelerate");

    if (
GetConVarInt(fr) != friction_default && friction_default != -1)
        
SetConVarInt(frfriction_defaulttruefalse);

    if (
GetConVarInt(ac) != accelerate_default && accelerate_default != -1)
        
SetConVarInt(acaccelerate_defaulttruefalse);
}

public 
PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"userid"));
    
    if (
IsPlayerAlive(client) && IsClientInGame(client))
    {
        
CPrintToChat(client"{lightgreen}[{green}%t{lightgreen}]{green} %t""dice""start"DiceText);
        
        
NoclipCounter[client] = 5;
        
ClientDiced[client] = 0;
        
FroggyJumped[client] = 0;
        
Nightvision[client] = false;
        
LongJump[client] = false;
        
FroggyJump[client] = false;
        
        
reset(client);
    }
}

public 
PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"userid"));
    
    
reset(client);
}

public 
PlayerJump(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"userid"));
    
    if (
LongJump[client]) 
        
longjump(client);
}

public 
Action:OnPlayerRunCmd(client, &buttons, &impulseFloat:vel[3], Float:angles[3], &weapon)
{
    if (!
IsClientInGame(client) || !IsPlayerAlive(client) || !FroggyJump[client])
        return 
Plugin_Continue;
    
    static 
bool:bPressed[MAXPLAYERS+1] = false;

    if(
GetEntityFlags(client) & FL_ONGROUND)
    {
        
FroggyJumped[client] = 0;
        
bPressed[client] = false;
    }
    else
    {
        if (
buttons IN_JUMP)
        {
            if(!
bPressed[client])
            {
                if(
FroggyJumped[client]++ == 1)
                    
froggyjump(client);
            }

            
bPressed[client] = true;
        }
        else
            
bPressed[client] = false;
    }

    
    return 
Plugin_Continue;
}

public 
PrepareDice(client)
{
    
decl String:Prefix[64];
    
    
Format(Prefixsizeof(Prefix), "{lightgreen}[{green}%T{lightgreen}]{green} ""dice"client);

    new 
money GetEntData(clientFindSendPropOffs("CCSPlayer""m_iAccount"));
    new 
credits Store_GetClientCredits(client);
    
    if (!
DiceTeam || GetClientTeam(client) == DiceTeam)
    {
        if (
ClientDiced[client] < DiceCount)
        {
            if (
IsPlayerAlive(client))
            {
                if(
DiceCredits 0)
                {
                    if ((
credits DiceCredits) >= 0)
                    {
                        
Store_SetClientCredits(clientcredits DiceCredits);
                        
CPrintToChat(client"%s%t"Prefix"spentcredits"DiceCredits);

                        
ClientDiced[client]++;
                        
DiceNow(client);
                    }
                    else 
CPrintToChat(client"%s%t"Prefix"credits"DiceCredits);
                    return;
                }
                if (
DiceMoney 0)
                {
                    if ((
money DiceMoney) >= 0)
                    {
                        
SetEntData(clientFindSendPropOffs("CCSPlayer""m_iAccount"), money DiceMoney);
                        
CPrintToChat(client"%s%t"Prefix"spentmoney"DiceMoney);

                        
ClientDiced[client]++;
                        
DiceNow(client);
                    }
                    else 
CPrintToChat(client"%s%t"Prefix"money"DiceMoney);
                    return;
                }
                else
                {
                    
ClientDiced[client]++;
                    
DiceNow(client);
                }
            }
            else 
CPrintToChat(client"%s%t"Prefix"dead");
        }
        else 
CPrintToChat(client"%s%t"Prefix"already"DiceCount);
    }
    else 
CPrintToChat(client"%s%t"Prefix"wrong");
}

DiceNow(client)
{
    new 
number;
    new 
count;

    
CPrintToChat(client"{lightgreen}[{green}%t{lightgreen}]{green} %t""dice""rolling"ClientDiced[client], DiceCount);

    
number count GetRandomInt(1DICES);

    while(!
EnabledNumbers[number])
    {
        if (
number == DICES)
            
number 1;
        else
            
number number DICES 1;

        if (
number == count)
            return;
    }

    switch (
number)
    {
        case 
1:
        {
            
drunk(client);
        }
        case 
2:
        {
            
drug(client);
        }
        case 
3:
        {
            
burn(client70);
        }
        case 
4:
        {
            
speed(client1.65);
        }
        case 
5:
        {
            
rocket(client);
        }
        case 
7:
        {
            
LongJump[client] = true;
        }
        case 
8:
        {
            
item(client1);
        }
        case 
9:
        {
            
health(client503);
        }
        case 
10:
        {
            
health(client502);
        }
        case 
11:
        {
            
speed(client0.65);
        }
        case 
12:
        {
            
item(client2);
        }
        case 
13:
        {
            
item(client3);
        }
        case 
15:
        {
            
gravity(client0.5);
        }
        case 
16:
        {
            
gravity(client2.0);
        }
        case 
17:
        {
            
speed(client1.65);
            
health(client502);
        }
        case 
18:
        {
            
health(client303);
            
gravity(client0.5);
            
speed(client0.65);
        }
        case 
19:
        {
            
gravity(client2.0);
            
speed(client0.65);
            
health(client302);
        }
        case 
20:
        {
            
noclip(clienttrue5.0);
            
            
CPrintToChat(client"{lightgreen}[{green}%t{lightgreen}]{green} %t""dice""noclip"NoclipCounter[client]);
            
            
CreateTimer(1.0NclipTimerclientTIMER_REPEAT);
        }
        case 
21:
        {
            
freeze(clienttrue30.0);
        }
        case 
22:
        {
            
shake(client10060140);
        }
        case 
23:
        {
            
item(client4);
        }
        case 
24:
        {
            
health(client11);
        }
        case 
25:
        {
            
item(client5);
        }
        case 
26:
        {
            
FroggyJump[client] = true;
        }
        case 
27:
        {
            
Nightvision[client] = true;
        }
        case 
28:
        {
            
SetEntProp(clientProp_Send"m_iDefaultFOV"35);
            
SetEntProp(clientProp_Send"m_iFOV"35);
        }
        case 
29:
        {
            
SetEntProp(clientProp_Send"m_iDefaultFOV"200);
            
SetEntProp(clientProp_Send"m_iFOV"200);
        }
        case 
30:
        {
            
SetInvisible(clientfalse);
        }
        case 
31:
        {
            
SetOnFire(clientfalse);
            
speed(client1.65);
            
health(client1002);
        }
        case 
32:
        {
            new 
Handle:cvar FindConVar("sv_accelerate");

            if (
cvar != INVALID_HANDLE)
                
SetConVarInt(cvar, -5truefalse);
        }
        case 
33:
        {
            new 
Handle:cvar FindConVar("sv_friction");

            if (
cvar != INVALID_HANDLE)
                
SetConVarInt(cvar1truefalse);
        }
    }
    
    
ShowText(clientnumber);
}

public 
Action:NclipTimer(Handle:timerany:client)
{
    if (
NoclipCounter[client] > && IsPlayerAlive(client) && IsClientInGame(client))
    {
        
CPrintToChat(client"{lightgreen}[{green}%t{lightgreen}]{green} %t""dice""noclip"NoclipCounter[client]);

        
NoclipCounter[client]--;
        
        return 
Plugin_Continue;
    }
    
    
noclip(clientfalse0.0);
    
    return 
Plugin_Stop;
}

ShowText(clientDiceNumber)
{
    
decl String:Prefix[64];
    
decl String:trans[10];
    
decl String:trans_all[20];

    new 
clients[MAXPLAYERS 1];
    new 
ClientCount 0;

    
Format(Prefixsizeof(Prefix), "{lightgreen}[{green}%T{lightgreen}]{green} ""dice"LANG_SERVER);

    
Format(transsizeof(trans), "dice%i"DiceNumber);
    
Format(trans_allsizeof(trans_all), "dice%i_all"DiceNumber);
    
    if (
ShowNumber != 4)
    {
        for (new 
x=1<= MaxClientsx++)
        {
            if (
IsClientInGame(x))
            {
                if (
ShowNumber == || ShowNumber == GetClientTeam(x))
                    
clients[ClientCount++] = x;
            }
        }
    }
    else
    {
        
clients[0] = client;
        
ClientCount 1;
    }
    
    if ((
DiceNumber == || DiceNumber == 23 || DiceNumber == 25) && RandNumber == 1)
    {
        while (
DiceNumber == || DiceNumber == 22 || DiceNumber == 24)
            
DiceNumber GetRandomInt(1DICES);
            
        
Format(transsizeof(trans), "dice%i"DiceNumber);
        
        
CPrintToChat(client"%s%t"Prefix"deagle");
        
CPrintToChat(client"%s%t"Prefix"deagle");
    }

    if ((
DiceNumber == 32 || DiceNumber == 33) && ShowNumber != 1)
        
CPrintToChatAll("%s%t"Prefixtrans_allDiceNumber);

    for (new 
x=0ClientCountx++)
        
CPrintToChat(clients[x], "%s%t"PrefixtransclientDiceNumber);
}

// PRESETS

public reset(client)
{
    if (!
IsClientInGame(client)) 
        return;
    
    new 
Float:pos[3];
    new 
Float:angs[3];
    
    
gravity(client1.0);
    
noclip(clientfalse0.0);
    
freeze(clientfalse0.0);
    
speed(client1.0);
    
godmode(clientfalse);

    
SetInvisible(clienttrue);
    
SetOnFire(clienttrue);
    
    
ExtinguishEntity(client);
    
ClientCommand(client"r_screenoverlay 0");
    
    
GetClientAbsOrigin(clientpos);
    
GetClientEyeAngles(clientangs);

    
SetEntProp(clientProp_Send"m_iDefaultFOV"90);
    
    
angs[2] = 0.0;
    
    
TeleportEntity(clientposangsNULL_VECTOR);    
    
    new 
Handle:message StartMessageOne("Fade"clientUSERMSG_RELIABLE|USERMSG_BLOCKHOOKS);
            
    if(
GetFeatureStatus(FeatureType_Native"GetUserMessageType") == FeatureStatus_Available && GetUserMessageType() == UM_Protobuf
    {
        
PbSetInt(message"duration"1536);
        
PbSetInt(message"hold_time"1536);
        
PbSetInt(message"flags", (0x0001 0x0010));
        
PbSetColor(message"clr", {0000});
    }
    else
    {
        
BfWriteShort(message1536);
        
BfWriteShort(message1536);
        
BfWriteShort(message, (0x0001 0x0010));
        
BfWriteByte(message0);
        
BfWriteByte(message0);
        
BfWriteByte(message0);
        
BfWriteByte(message0);
    }

    
EndMessage();
    
    
message StartMessageOne("Shake"clientUSERMSG_RELIABLE|USERMSG_BLOCKHOOKS);

    if(
GetFeatureStatus(FeatureType_Native"GetUserMessageType") == FeatureStatus_Available && GetUserMessageType() == UM_Protobuf
    {
        
PbSetInt(message"command"1);
        
PbSetFloat(message"local_amplitude"0.0);
        
PbSetFloat(message"frequency"0.0);
        
PbSetFloat(message"duration"1.0);
    }
    else
    {
        
BfWriteByte(message1);
        
BfWriteFloat(message0.0);
        
BfWriteFloat(message0.0);
        
BfWriteFloat(message1.0);
    }
    
    
EndMessage();    
}

public 
longjump(client)
{
    if (!
IsClientInGame(client) || !IsPlayerAlive(client)) 
        return;
    
    new 
Float:velocity[3];
    new 
Float:velocity0;
    new 
Float:velocity1;
    
    
velocity0 GetEntPropFloat(clientProp_Send"m_vecVelocity[0]");
    
velocity1 GetEntPropFloat(clientProp_Send"m_vecVelocity[1]");
    
    
velocity[0] = (7.0 velocity0) * (1.0 4.1);
    
velocity[1] = (7.0 velocity1) * (1.0 4.1);
    
velocity[2] = 0.0;
    
    
SetEntPropVector(clientProp_Send"m_vecBaseVelocity"velocity);
}

public 
froggyjump(client)
{
    new 
Float:velocity[3];
    new 
Float:velocity0;
    new 
Float:velocity1;
    new 
Float:velocity2;
    new 
Float:velocity2_new;

    
velocity0 GetEntPropFloat(clientProp_Send"m_vecVelocity[0]");
    
velocity1 GetEntPropFloat(clientProp_Send"m_vecVelocity[1]");
    
velocity2 GetEntPropFloat(clientProp_Send"m_vecVelocity[2]");

    
velocity2_new 260.0;

    if (
velocity2 150.0
        
velocity2_new 270.0;
    if (
velocity2 100.0
        
velocity2_new 300.0;
    if (
velocity2 50.0
        
velocity2_new 330.0;
    if (
velocity2 0.0
        
velocity2_new 380.0;
    if (
velocity2 < -50.0
        
velocity2_new 400.0;
    if (
velocity2 < -100.0
        
velocity2_new 430.0;
    if (
velocity2 < -150.0
        
velocity2_new 450.0;
    if (
velocity2 < -200.0
        
velocity2_new 470.0;

    
velocity[0] = velocity0 0.1;
    
velocity[1] = velocity1 0.1;
    
velocity[2] = velocity2_new;
    
    
SetEntPropVector(clientProp_Send"m_vecBaseVelocity"velocity);
}

public 
OnGameFrame()
{
    for (new 
1MaxClients 1i++)
    {
        if (
IsClientInGame(i) && IsPlayerAlive(i) && Nightvision[i])
            
SetEntProp(iProp_Send"m_bNightVisionOn"1);
    }
}

public 
SetInvisible(clientbool:visible)
{
    new 
weapon;    

    new 
RenderMode:mode;
    new 
alpha;

    if (
visible)
    {
        
mode RENDER_NORMAL;
        
alpha 255;
    }
    else
    {
        
mode RENDER_TRANSCOLOR;
        
alpha 20;
    }

    for (new 
04i++)
    {
        if ((
weapon GetPlayerWeaponSlot(clienti)) != -1)
        {
            
SetEntityRenderMode(weaponmode);
            
SetEntityRenderColor(weapon255255255alpha);
        }
    }

    
SetEntityRenderColor(client255255255alpha);
    
SetEntityRenderMode(clientmode);
}

public 
SetOnFire(clientbool:extinguish)
{
    if (
fire[client] != 0
    {
        if (
IsValidEntity(fire[client]))
        {
            
decl String:class[128];
            
            
GetEdictClassname(fire[client], class, sizeof(class));
            
            if (
StrEqual(class, "env_fire")) 
                
RemoveEdict(fire[client]);
        }
        
        
fire[client] = 0;
    }

    if (!
extinguish)
        
CreateTimer(2.0SetOnFireTimerclient);
}

public 
Action:SetOnFireTimer(Handle:timerany:client)
{
    if (
IsClientInGame(client))
    {
        if ((
GetClientTeam(client) == || GetClientTeam(client) == 3) && IsPlayerAlive(client))
        {
            new 
view CreateEntityByName("env_fire");
            
            if (
view != -1)
            {
                
DispatchKeyValue(view"ignitionpoint""0");
                
DispatchKeyValue(view"spawnflags""285");
                
DispatchKeyValue(view"fireattack""0");
                
DispatchKeyValue(view"firesize""512");
                
DispatchKeyValueFloat(view"damagescale"0.0);
                
                if (
DispatchSpawn(view))
                {
                    
decl Float:origin[3];
                    
decl String:steamid[20];
                    
                    if (
IsValidEntity(view))
                    {
                        
fire[client] = view;
                        
                        
GetClientAbsOrigin(clientorigin);
                        
                        
TeleportEntity(vieworiginNULL_VECTORNULL_VECTOR);

                        
origin[2] = origin[2] + 90;

                        
AcceptEntityInput(view"StartFire");
                        
                        
//GetClientAuthString(client, steamid, sizeof(steamid));
                        
GetClientAuthId(clientAuthId_Steam2steamidsizeof(steamid));
                        
DispatchKeyValue(client"targetname"steamid);
                        
                        
SetVariantString(steamid);
                        
AcceptEntityInput(view"SetParent");
                    }
                }
            }
        }
    }
}

public 
gravity(clientFloat:amount)
{
    
SetEntityGravity(clientamount);
}

public 
item(clienttype)
{
    switch(
type)
    {
        case 
1:
        {
            
GivePlayerItem(client"weapon_deagle");
        }
        case 
2:
        {
            
GivePlayerItem(client"weapon_hegrenade");
        }
        case 
3:
        {
            
GivePlayerItem(client"weapon_flashbang");
            
GivePlayerItem(client"weapon_flashbang");
        }
        case 
4:
        {
            
GivePlayerItem(client"weapon_glock");
        }
        case 
5:
        {
            if (
getGame())
                
GivePlayerItem(client"weapon_m3");
            else
                
GivePlayerItem(client"weapon_sawedoff");
        }
    }
}

public 
bool:getGame()
{
    
decl String:game[64];

    
GetGameFolderName(gamesizeof(game));

    return (
StrEqual(game"cstrike"false));
}

public 
noclip(clientbool:turnOnFloat:time)
{
    if (
IsClientInGame(client))
    {
        if (
turnOn)
        {
            
SetEntityMoveType(clientMOVETYPE_NOCLIP);
        }
        else
            
SetEntityMoveType(clientMOVETYPE_WALK);
    }
}

public 
freeze(clientbool:turnOnFloat:time)
{    
    if (
IsClientInGame(client))
    {
        if (
turnOn)
        {
            
SetEntityMoveType(clientMOVETYPE_NONE);
            
            if (
time 0
                
CreateTimer(timefreezeOffclient);
        }
        else
            
SetEntityMoveType(clientMOVETYPE_WALK);
    }
}

public 
health(clientamounttype)
{
    switch(
type)
    {
        case 
1:
        {
            
SetEntityHealth(clientamount);
        }
        case 
2:
        {
            
SetEntityHealth(clientGetClientHealth(client) + amount);
        }
        case 
3:
        {
            new 
nhealth GetClientHealth(client) - amount;

            if (
nhealth <= 0)
                
ForcePlayerSuicide(client);
            else
                
SetEntityHealth(clientnhealth);
        }
    }
}

public 
drunk(client)
{
    
ClientCommand(client"r_screenoverlay Effects/tp_eyefx/tp_eyefx.vmt");
}

public 
drug(client)
{
    
CreateTimer(1.0drug_loopclientTIMER_REPEAT);    
}

public 
burn(clienthealth)
{
    new 
Float:time float(health) / 5.0;
    
    if (
health 100
        
IgniteEntity(clienttime);
    else 
        
IgniteEntity(client100.0);
}

public 
speed(clientFloat:speed)
{
    
SetEntPropFloat(clientProp_Data"m_flLaggedMovementValue"speed); 
}

public 
rocket(client)
{
    new 
Float:Origin[3];
    
    
GetClientAbsOrigin(clientOrigin);
    
    
Origin[2] = Origin[2] + 20;
    
    
godmode(clienttrue);
    
shake(client104025);
    
    
EmitSoundToAll("weapons/rpg/rocketfire1.wav"clientSNDCHAN_AUTOSNDLEVEL_NORMALSND_NOFLAGS0.5);
    
    
CreateTimer(1.0PlayRocketSoundclient);
    
CreateTimer(3.1EndRocketclient);
}

public 
godmode(clientbool:turnOn)
{
    if (
turnOn
        
SetEntProp(clientProp_Data"m_takedamage"01);
    else
        
SetEntProp(clientProp_Data"m_takedamage"21);
}

stock shake(clienttimedistancevalue)
{
    new 
Handle:message StartMessageOne("Shake"clientUSERMSG_RELIABLE|USERMSG_BLOCKHOOKS);

    if(
GetFeatureStatus(FeatureType_Native"GetUserMessageType") == FeatureStatus_Available && GetUserMessageType() == UM_Protobuf
    {
        
PbSetInt(message"command"0);
        
PbSetFloat(message"local_amplitude"float(value));
        
PbSetFloat(message"frequency"float(distance));
        
PbSetFloat(message"duration"float(time));
    }
    else
    {
        
BfWriteByte(message0);
        
BfWriteFloat(messagefloat(value));
        
BfWriteFloat(messagefloat(distance));
        
BfWriteFloat(messagefloat(time));
    }
    
    
EndMessage();    
}

public 
Action:PlayRocketSound(Handle:timerany:client)
{
    if (!
IsClientInGame(client) || !IsPlayerAlive(client)) 
        return;
    
    new 
Float:Origin[3];
    
    
GetClientAbsOrigin(clientOrigin);
    
    
Origin[2] = Origin[2] + 50;
    
    
EmitSoundToAll("weapons/rpg/rocket1.wav"clientSNDCHAN_AUTOSNDLEVEL_NORMALSND_NOFLAGS0.5);
    
    for (new 
x=1<= 15x++) 
        
CreateTimer(0.2*xrocket_loopclient);
    
    
TeleportEntity(clientOriginNULL_VECTORNULL_VECTOR);
}

public 
Action:EndRocket(Handle:timerany:client)
{
    if (!
IsClientInGame(client) || !IsPlayerAlive(client))
        return 
Plugin_Stop;
    
    new 
Float:Origin[3];
    
    
GetClientAbsOrigin(clientOrigin);
    
    
Origin[2] = Origin[2] + 50;
    
    for (new 
x=1<= MaxClientsx++)
    {
        if (
IsClientConnected(x)) 
            
StopSound(xSNDCHAN_AUTO"weapons/rpg/rocket1.wav");
    }
    
    
EmitSoundToAll("weapons/hegrenade/explode3.wav"clientSNDCHAN_AUTOSNDLEVEL_NORMALSND_NOFLAGS0.5);
    
    new 
expl CreateEntityByName("env_explosion");
    
    
TeleportEntity(explOriginNULL_VECTORNULL_VECTOR);
    
    
DispatchKeyValue(expl"fireballsprite""sprites/zerogxplode.spr");
    
DispatchKeyValue(expl"spawnflags""0");
    
DispatchKeyValue(expl"iMagnitude""1000");
    
DispatchKeyValue(expl"iRadiusOverride""100");
    
DispatchKeyValue(expl"rendermode""0");
    
    
DispatchSpawn(expl);
    
ActivateEntity(expl);
    
    
AcceptEntityInput(expl"Explode");
    
AcceptEntityInput(expl"Kill");
    
    
godmode(clientfalse);
    
ForcePlayerSuicide(client);

    return 
Plugin_Handled;
}

public 
Action:drug_loop(Handle:timerany:client)
{
    if (!
IsClientInGame(client)) 
        return 
Plugin_Stop;
    
    new 
Float:DrugAngles[20] = {0.05.010.015.020.025.020.015.010.05.00.0, -5.0, -10.0, -15.0, -20.0, -25.0, -20.0, -15.0, -10.0, -5.0};

    if (!
IsPlayerAlive(client))
    {
        new 
Float:pos[3];
        new 
Float:angs[3];
        
        
GetClientAbsOrigin(clientpos);
        
GetClientEyeAngles(clientangs);
        
        
angs[2] = 0.0;
        
        
TeleportEntity(clientposangsNULL_VECTOR);    
        
        new 
Handle:message StartMessageOne("Fade"clientUSERMSG_RELIABLE|USERMSG_BLOCKHOOKS);
        
        if(
GetFeatureStatus(FeatureType_Native"GetUserMessageType") == FeatureStatus_Available && GetUserMessageType() == UM_Protobuf
        {
            
PbSetInt(message"duration"1536);
            
PbSetInt(message"hold_time"1536);
            
PbSetInt(message"flags", (0x0001 0x0010));
            
PbSetColor(message"clr", {0000});
        }
        else
        {
            
BfWriteShort(message1536);
            
BfWriteShort(message1536);
            
BfWriteShort(message, (0x0001 0x0010));
            
BfWriteByte(message0);
            
BfWriteByte(message0);
            
BfWriteByte(message0);
            
BfWriteByte(message0);
        }
        
        
EndMessage();    
        
        return 
Plugin_Stop;
    }
    
    new 
Float:pos[3];
    new 
Float:angs[3];
    new 
coloring[4];

    
coloring[0] = GetRandomInt(0,255);
    
coloring[1] = GetRandomInt(0,255);
    
coloring[2] = GetRandomInt(0,255);
    
coloring[3] = 128;
    
    
GetClientAbsOrigin(clientpos);
    
GetClientEyeAngles(clientangs);
    
    
angs[2] = DrugAngles[GetRandomInt(0,100) % 20];
    
    
TeleportEntity(clientposangsNULL_VECTOR);

    new 
Handle:message StartMessageOne("Fade"client);

    if(
GetFeatureStatus(FeatureType_Native"GetUserMessageType") == FeatureStatus_Available && GetUserMessageType() == UM_Protobuf
    {
        
PbSetInt(message"duration"255);
        
PbSetInt(message"hold_time"255);
        
PbSetInt(message"flags", (0x0002));
        
PbSetColor(message"clr"coloring);
    }
    else
    {
        
BfWriteShort(message255);
        
BfWriteShort(message255);
        
BfWriteShort(message, (0x0002));
        
BfWriteByte(messageGetRandomInt(0,255));
        
BfWriteByte(messageGetRandomInt(0,255));
        
BfWriteByte(messageGetRandomInt(0,255));
        
BfWriteByte(message128);
    }
    
    
EndMessage();    
        
    return 
Plugin_Handled;
}

public 
Action:rocket_loop(Handle:timerany:client)
{
    if (!
IsClientInGame(client) || !IsPlayerAlive(client))
        return 
Plugin_Stop;
        
    new 
Float:velocity[3];
    
    
velocity[2] = 300.0;
    
    
TeleportEntity(clientNULL_VECTORNULL_VECTORvelocity);
    
    return 
Plugin_Handled;
}

public 
Action:freezeOff(Handle:timerany:client)
{
    
freeze(clientfalse0.0);
    
    return 
Plugin_Handled;

Attached Files
File Type: txt dice.phrases.txt (5.2 KB, 140 views)
__________________
Taking paid private requests! Contact me
Cruze is offline
paulo_crash
AlliedModders Donor
Join Date: May 2016
Location: Brazil
Old 10-22-2018 , 20:36   Re: [CS:S, CS:GO] Roll The Dice (Würfeln)
Reply With Quote #142

Quote:
Originally Posted by Cruze View Post
Compiles fine for me
As well... I did not change anything and it did not compile for me.

Quote:
Originally Posted by Cruze View Post
Here is my version!
You need to put new translation file attached in this comment's attachment and delete cfg/dice/dice_config.cfg and reload/change map! New cvar "dice_credits" should be there in cfg/dice/dice_config.cfg. Put new value and reload/change map again.
PHP Code:
#include <sourcemod>
#include <sdktools>
#include <colors>
#include <autoexecconfig>
#include <store>

#undef REQUIRE_PLUGIN
#include <updater>

#pragma semicolon 1

#define DICES 33

new Handle:c_DiceText;
new 
Handle:c_ShowNumber;
new 
Handle:c_RandNumber;
new 
Handle:c_DiceTeam;
new 
Handle:c_DiceCount;
new 
Handle:c_DiceMoney;
new 
Handle:c_DiceCredits;

new 
String:DiceText[64];

new 
ShowNumber;
new 
RandNumber;
new 
DiceTeam;
new 
DiceMoney;
new 
DiceCredits;
new 
DiceCount;

new 
friction_default = -1;
new 
accelerate_default = -1;

new 
NoclipCounter[MAXPLAYERS 1];
new 
ClientDiced[MAXPLAYERS 1];
new 
FroggyJumped[MAXPLAYERS 1];
new 
fire[MAXPLAYERS 1];

new 
bool:EnabledNumbers[DICES+1];
new 
bool:LongJump[MAXPLAYERS 1];
new 
bool:Nightvision[MAXPLAYERS 1];
new 
bool:FroggyJump[MAXPLAYERS 1];
new 
bool:started;

public 
Plugin:myinfo =
{
    
name "Dice SM",
    
author "Popoklopsi edit Cruze",
    
version "1.6.2",
    
description "Roll the Dice by Popoklopsi",
    
url "https://forums.alliedmods.net/showthread.php?t=152035"
};

public 
APLRes:AskPluginLoad2(Handle:myselfbool:lateString:error[], err_max)
{
    
MarkNativeAsOptional("GetUserMessageType");

    return 
APLRes_Success;
}

public 
OnPluginStart()
{
    if (!
CColorAllowed(Color_Lightgreen) && CColorAllowed(Color_Darkred))
        
CReplaceColor(Color_LightgreenColor_Darkred);

    
started false;

    
AutoExecConfig_SetFile("dice_config""dice");
    
AutoExecConfig_CreateConVar("dice_sm""1.6.2""Dice for Sourcemod by Popoklopsi"FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY|FCVAR_DONTRECORD);
    
    
c_DiceText AutoExecConfig_CreateConVar("dice_text""dice""Command to dice (without exclamation mark), convert to UTF-8 without BOM for special characters");
    
c_ShowNumber AutoExecConfig_CreateConVar("dice_show""2""Players, which see the result: 1 = Everybody, 2 = just T's, 3 = just CT's, 4 = Only you");
    
c_RandNumber AutoExecConfig_CreateConVar("dice_rand""1""1 = Random text when result is a weapon, 0 = Off");
    
c_DiceTeam AutoExecConfig_CreateConVar("dice_team""2""2 = Only T's can dice, 3 = Only CT's can dice, 0 = Everybody can dice");
    
c_DiceCount AutoExecConfig_CreateConVar("dice_count""1""How often a player can dice per round");
    
c_DiceMoney AutoExecConfig_CreateConVar("dice_money""0""x = Money one dice costs, 0 = Off");
    
c_DiceCredits AutoExecConfig_CreateConVar("dice_credits""0""x = credits one dice costs, 0 = Off");

    
AutoExecConfig_CleanFile();
    
    
LoadEnables();

    
AutoExecConfig(true"dice_config""dice");
    
    
HookConVarChange(c_ShowNumberOnConVarChanged);
    
HookConVarChange(c_RandNumberOnConVarChanged);
    
HookConVarChange(c_DiceTeamOnConVarChanged);
    
    
HookEvent("player_spawn"PlayerSpawn);
    
HookEvent("player_death"PlayerDeath);
    
HookEvent("player_jump"PlayerJump);
    
HookEvent("round_start"RoundStart);
    
    
LoadTranslations("dice.phrases");
}

public 
OnConfigsExecuted()
{
    
decl String:ConsoleCmd[64];
    
    
GetConVarString(c_DiceTextDiceTextsizeof(DiceText));
    
    
ShowNumber GetConVarInt(c_ShowNumber);
    
RandNumber GetConVarInt(c_RandNumber);
    
DiceTeam GetConVarInt(c_DiceTeam);
    
DiceCount GetConVarInt(c_DiceCount);
    
DiceMoney GetConVarInt(c_DiceMoney);
    
DiceCredits GetConVarInt(c_DiceCredits);
    
accelerate_default GetConVarInt(FindConVar("sv_accelerate"));
    
friction_default GetConVarInt(FindConVar("sv_friction"));
    
    if (!
started)
    {
        
Format(ConsoleCmdsizeof(ConsoleCmd), "sm_%s"DiceText);
        
RegConsoleCmd(ConsoleCmdTypedText);
        
        
started true;
    }
}

public 
OnAllPluginsLoaded()
{
    if (
LibraryExists("updater"))
        
Updater_AddPlugin("http://popoklopsi.de/dice/update.txt");
}

public 
OnLibraryAdded(const String:name[])
{
    if (
StrEqual(name"updater"))
        
Updater_AddPlugin("http://popoklopsi.de/dice/update.txt");
}

public 
OnMapStart()
{
    
PrecacheSound("weapons/rpg/rocketfire1.wav");
    
PrecacheSound("weapons/rpg/rocket1.wav");
    
PrecacheSound("weapons/hegrenade/explode3.wav");
    
PrecacheModel("Effects/tp_eyefx/tp_eyefx.vmt");
}

public 
LoadEnables()
{
    
decl String:section[5];
    
    new 
Handle:keycvar CreateKeyValues("DiceEnables");
    
    if (
FileExists("cfg/dice/dice_enables.txt") && FileToKeyValues(keycvar"cfg/dice/dice_enables.txt"))
    {
        for (new 
1<= DICESx++)
        {
            
Format(sectionsizeof(section), "%i"x);
            
            if (
KvGetNum(keycvarsection1) == 1)
                
EnabledNumbers[x] = true;
            else
                
EnabledNumbers[x] = false;
        }
    }
    else
    {
        for (new 
1<= DICESx++)
            
EnabledNumbers[x] = true;
    }

    if (!
getGame())
        
EnabledNumbers[1] = false;
}

public 
Action:TypedText(clientargs)
{
    if (
client && client <= MaxClients && IsClientInGame(client))
        
PrepareDice(client);
    
    return 
Plugin_Handled;
}

public 
OnConVarChanged(Handle:hCvar, const String:oldValue[], const String:newValue[])
{
    if (
hCvar == c_ShowNumber
        
ShowNumber StringToInt(newValue);
        
    if (
hCvar == c_RandNumber
        
RandNumber StringToInt(newValue);
        
    if (
hCvar == c_DiceTeam
        
DiceTeam StringToInt(newValue);
}

public 
RoundStart(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
Handle:fr FindConVar("sv_friction");
    new 
Handle:ac FindConVar("sv_accelerate");

    if (
GetConVarInt(fr) != friction_default && friction_default != -1)
        
SetConVarInt(frfriction_defaulttruefalse);

    if (
GetConVarInt(ac) != accelerate_default && accelerate_default != -1)
        
SetConVarInt(acaccelerate_defaulttruefalse);
}

public 
PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"userid"));
    
    if (
IsPlayerAlive(client) && IsClientInGame(client))
    {
        
CPrintToChat(client"{lightgreen}[{green}%t{lightgreen}]{green} %t""dice""start"DiceText);
        
        
NoclipCounter[client] = 5;
        
ClientDiced[client] = 0;
        
FroggyJumped[client] = 0;
        
Nightvision[client] = false;
        
LongJump[client] = false;
        
FroggyJump[client] = false;
        
        
reset(client);
    }
}

public 
PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"userid"));
    
    
reset(client);
}

public 
PlayerJump(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"userid"));
    
    if (
LongJump[client]) 
        
longjump(client);
}

public 
Action:OnPlayerRunCmd(client, &buttons, &impulseFloat:vel[3], Float:angles[3], &weapon)
{
    if (!
IsClientInGame(client) || !IsPlayerAlive(client) || !FroggyJump[client])
        return 
Plugin_Continue;
    
    static 
bool:bPressed[MAXPLAYERS+1] = false;

    if(
GetEntityFlags(client) & FL_ONGROUND)
    {
        
FroggyJumped[client] = 0;
        
bPressed[client] = false;
    }
    else
    {
        if (
buttons IN_JUMP)
        {
            if(!
bPressed[client])
            {
                if(
FroggyJumped[client]++ == 1)
                    
froggyjump(client);
            }

            
bPressed[client] = true;
        }
        else
            
bPressed[client] = false;
    }

    
    return 
Plugin_Continue;
}

public 
PrepareDice(client)
{
    
decl String:Prefix[64];
    
    
Format(Prefixsizeof(Prefix), "{lightgreen}[{green}%T{lightgreen}]{green} ""dice"client);

    new 
money GetEntData(clientFindSendPropOffs("CCSPlayer""m_iAccount"));
    new 
credits Store_GetClientCredits(client);
    
    if (!
DiceTeam || GetClientTeam(client) == DiceTeam)
    {
        if (
ClientDiced[client] < DiceCount)
        {
            if (
IsPlayerAlive(client))
            {
                if(
DiceCredits 0)
                {
                    if ((
credits DiceCredits) >= 0)
                    {
                        
Store_SetClientCredits(clientcredits DiceCredits);
                        
CPrintToChat(client"%s%t"Prefix"spentcredits"DiceCredits);

                        
ClientDiced[client]++;
                        
DiceNow(client);
                    }
                    else 
CPrintToChat(client"%s%t"Prefix"credits"DiceCredits);
                    return;
                }
                if (
DiceMoney 0)
                {
                    if ((
money DiceMoney) >= 0)
                    {
                        
SetEntData(clientFindSendPropOffs("CCSPlayer""m_iAccount"), money DiceMoney);
                        
CPrintToChat(client"%s%t"Prefix"spentmoney"DiceMoney);

                        
ClientDiced[client]++;
                        
DiceNow(client);
                    }
                    else 
CPrintToChat(client"%s%t"Prefix"money"DiceMoney);
                    return;
                }
                else
                {
                    
ClientDiced[client]++;
                    
DiceNow(client);
                }
            }
            else 
CPrintToChat(client"%s%t"Prefix"dead");
        }
        else 
CPrintToChat(client"%s%t"Prefix"already"DiceCount);
    }
    else 
CPrintToChat(client"%s%t"Prefix"wrong");
}

DiceNow(client)
{
    new 
number;
    new 
count;

    
CPrintToChat(client"{lightgreen}[{green}%t{lightgreen}]{green} %t""dice""rolling"ClientDiced[client], DiceCount);

    
number count GetRandomInt(1DICES);

    while(!
EnabledNumbers[number])
    {
        if (
number == DICES)
            
number 1;
        else
            
number number DICES 1;

        if (
number == count)
            return;
    }

    switch (
number)
    {
        case 
1:
        {
            
drunk(client);
        }
        case 
2:
        {
            
drug(client);
        }
        case 
3:
        {
            
burn(client70);
        }
        case 
4:
        {
            
speed(client1.65);
        }
        case 
5:
        {
            
rocket(client);
        }
        case 
7:
        {
            
LongJump[client] = true;
        }
        case 
8:
        {
            
item(client1);
        }
        case 
9:
        {
            
health(client503);
        }
        case 
10:
        {
            
health(client502);
        }
        case 
11:
        {
            
speed(client0.65);
        }
        case 
12:
        {
            
item(client2);
        }
        case 
13:
        {
            
item(client3);
        }
        case 
15:
        {
            
gravity(client0.5);
        }
        case 
16:
        {
            
gravity(client2.0);
        }
        case 
17:
        {
            
speed(client1.65);
            
health(client502);
        }
        case 
18:
        {
            
health(client303);
            
gravity(client0.5);
            
speed(client0.65);
        }
        case 
19:
        {
            
gravity(client2.0);
            
speed(client0.65);
            
health(client302);
        }
        case 
20:
        {
            
noclip(clienttrue5.0);
            
            
CPrintToChat(client"{lightgreen}[{green}%t{lightgreen}]{green} %t""dice""noclip"NoclipCounter[client]);
            
            
CreateTimer(1.0NclipTimerclientTIMER_REPEAT);
        }
        case 
21:
        {
            
freeze(clienttrue30.0);
        }
        case 
22:
        {
            
shake(client10060140);
        }
        case 
23:
        {
            
item(client4);
        }
        case 
24:
        {
            
health(client11);
        }
        case 
25:
        {
            
item(client5);
        }
        case 
26:
        {
            
FroggyJump[client] = true;
        }
        case 
27:
        {
            
Nightvision[client] = true;
        }
        case 
28:
        {
            
SetEntProp(clientProp_Send"m_iDefaultFOV"35);
            
SetEntProp(clientProp_Send"m_iFOV"35);
        }
        case 
29:
        {
            
SetEntProp(clientProp_Send"m_iDefaultFOV"200);
            
SetEntProp(clientProp_Send"m_iFOV"200);
        }
        case 
30:
        {
            
SetInvisible(clientfalse);
        }
        case 
31:
        {
            
SetOnFire(clientfalse);
            
speed(client1.65);
            
health(client1002);
        }
        case 
32:
        {
            new 
Handle:cvar FindConVar("sv_accelerate");

            if (
cvar != INVALID_HANDLE)
                
SetConVarInt(cvar, -5truefalse);
        }
        case 
33:
        {
            new 
Handle:cvar FindConVar("sv_friction");

            if (
cvar != INVALID_HANDLE)
                
SetConVarInt(cvar1truefalse);
        }
    }
    
    
ShowText(clientnumber);
}

public 
Action:NclipTimer(Handle:timerany:client)
{
    if (
NoclipCounter[client] > && IsPlayerAlive(client) && IsClientInGame(client))
    {
        
CPrintToChat(client"{lightgreen}[{green}%t{lightgreen}]{green} %t""dice""noclip"NoclipCounter[client]);

        
NoclipCounter[client]--;
        
        return 
Plugin_Continue;
    }
    
    
noclip(clientfalse0.0);
    
    return 
Plugin_Stop;
}

ShowText(clientDiceNumber)
{
    
decl String:Prefix[64];
    
decl String:trans[10];
    
decl String:trans_all[20];

    new 
clients[MAXPLAYERS 1];
    new 
ClientCount 0;

    
Format(Prefixsizeof(Prefix), "{lightgreen}[{green}%T{lightgreen}]{green} ""dice"LANG_SERVER);

    
Format(transsizeof(trans), "dice%i"DiceNumber);
    
Format(trans_allsizeof(trans_all), "dice%i_all"DiceNumber);
    
    if (
ShowNumber != 4)
    {
        for (new 
x=1<= MaxClientsx++)
        {
            if (
IsClientInGame(x))
            {
                if (
ShowNumber == || ShowNumber == GetClientTeam(x))
                    
clients[ClientCount++] = x;
            }
        }
    }
    else
    {
        
clients[0] = client;
        
ClientCount 1;
    }
    
    if ((
DiceNumber == || DiceNumber == 23 || DiceNumber == 25) && RandNumber == 1)
    {
        while (
DiceNumber == || DiceNumber == 22 || DiceNumber == 24)
            
DiceNumber GetRandomInt(1DICES);
            
        
Format(transsizeof(trans), "dice%i"DiceNumber);
        
        
CPrintToChat(client"%s%t"Prefix"deagle");
        
CPrintToChat(client"%s%t"Prefix"deagle");
    }

    if ((
DiceNumber == 32 || DiceNumber == 33) && ShowNumber != 1)
        
CPrintToChatAll("%s%t"Prefixtrans_allDiceNumber);

    for (new 
x=0ClientCountx++)
        
CPrintToChat(clients[x], "%s%t"PrefixtransclientDiceNumber);
}

// PRESETS

public reset(client)
{
    if (!
IsClientInGame(client)) 
        return;
    
    new 
Float:pos[3];
    new 
Float:angs[3];
    
    
gravity(client1.0);
    
noclip(clientfalse0.0);
    
freeze(clientfalse0.0);
    
speed(client1.0);
    
godmode(clientfalse);

    
SetInvisible(clienttrue);
    
SetOnFire(clienttrue);
    
    
ExtinguishEntity(client);
    
ClientCommand(client"r_screenoverlay 0");
    
    
GetClientAbsOrigin(clientpos);
    
GetClientEyeAngles(clientangs);

    
SetEntProp(clientProp_Send"m_iDefaultFOV"90);
    
    
angs[2] = 0.0;
    
    
TeleportEntity(clientposangsNULL_VECTOR);    
    
    new 
Handle:message StartMessageOne("Fade"clientUSERMSG_RELIABLE|USERMSG_BLOCKHOOKS);
            
    if(
GetFeatureStatus(FeatureType_Native"GetUserMessageType") == FeatureStatus_Available && GetUserMessageType() == UM_Protobuf
    {
        
PbSetInt(message"duration"1536);
        
PbSetInt(message"hold_time"1536);
        
PbSetInt(message"flags", (0x0001 0x0010));
        
PbSetColor(message"clr", {0000});
    }
    else
    {
        
BfWriteShort(message1536);
        
BfWriteShort(message1536);
        
BfWriteShort(message, (0x0001 0x0010));
        
BfWriteByte(message0);
        
BfWriteByte(message0);
        
BfWriteByte(message0);
        
BfWriteByte(message0);
    }

    
EndMessage();
    
    
message StartMessageOne("Shake"clientUSERMSG_RELIABLE|USERMSG_BLOCKHOOKS);

    if(
GetFeatureStatus(FeatureType_Native"GetUserMessageType") == FeatureStatus_Available && GetUserMessageType() == UM_Protobuf
    {
        
PbSetInt(message"command"1);
        
PbSetFloat(message"local_amplitude"0.0);
        
PbSetFloat(message"frequency"0.0);
        
PbSetFloat(message"duration"1.0);
    }
    else
    {
        
BfWriteByte(message1);
        
BfWriteFloat(message0.0);
        
BfWriteFloat(message0.0);
        
BfWriteFloat(message1.0);
    }
    
    
EndMessage();    
}

public 
longjump(client)
{
    if (!
IsClientInGame(client) || !IsPlayerAlive(client)) 
        return;
    
    new 
Float:velocity[3];
    new 
Float:velocity0;
    new 
Float:velocity1;
    
    
velocity0 GetEntPropFloat(clientProp_Send"m_vecVelocity[0]");
    
velocity1 GetEntPropFloat(clientProp_Send"m_vecVelocity[1]");
    
    
velocity[0] = (7.0 velocity0) * (1.0 4.1);
    
velocity[1] = (7.0 velocity1) * (1.0 4.1);
    
velocity[2] = 0.0;
    
    
SetEntPropVector(clientProp_Send"m_vecBaseVelocity"velocity);
}

public 
froggyjump(client)
{
    new 
Float:velocity[3];
    new 
Float:velocity0;
    new 
Float:velocity1;
    new 
Float:velocity2;
    new 
Float:velocity2_new;

    
velocity0 GetEntPropFloat(clientProp_Send"m_vecVelocity[0]");
    
velocity1 GetEntPropFloat(clientProp_Send"m_vecVelocity[1]");
    
velocity2 GetEntPropFloat(clientProp_Send"m_vecVelocity[2]");

    
velocity2_new 260.0;

    if (
velocity2 150.0
        
velocity2_new 270.0;
    if (
velocity2 100.0
        
velocity2_new 300.0;
    if (
velocity2 50.0
        
velocity2_new 330.0;
    if (
velocity2 0.0
        
velocity2_new 380.0;
    if (
velocity2 < -50.0
        
velocity2_new 400.0;
    if (
velocity2 < -100.0
        
velocity2_new 430.0;
    if (
velocity2 < -150.0
        
velocity2_new 450.0;
    if (
velocity2 < -200.0
        
velocity2_new 470.0;

    
velocity[0] = velocity0 0.1;
    
velocity[1] = velocity1 0.1;
    
velocity[2] = velocity2_new;
    
    
SetEntPropVector(clientProp_Send"m_vecBaseVelocity"velocity);
}

public 
OnGameFrame()
{
    for (new 
1MaxClients 1i++)
    {
        if (
IsClientInGame(i) && IsPlayerAlive(i) && Nightvision[i])
            
SetEntProp(iProp_Send"m_bNightVisionOn"1);
    }
}

public 
SetInvisible(clientbool:visible)
{
    new 
weapon;    

    new 
RenderMode:mode;
    new 
alpha;

    if (
visible)
    {
        
mode RENDER_NORMAL;
        
alpha 255;
    }
    else
    {
        
mode RENDER_TRANSCOLOR;
        
alpha 20;
    }

    for (new 
04i++)
    {
        if ((
weapon GetPlayerWeaponSlot(clienti)) != -1)
        {
            
SetEntityRenderMode(weaponmode);
            
SetEntityRenderColor(weapon255255255alpha);
        }
    }

    
SetEntityRenderColor(client255255255alpha);
    
SetEntityRenderMode(clientmode);
}

public 
SetOnFire(clientbool:extinguish)
{
    if (
fire[client] != 0
    {
        if (
IsValidEntity(fire[client]))
        {
            
decl String:class[128];
            
            
GetEdictClassname(fire[client], class, sizeof(class));
            
            if (
StrEqual(class, "env_fire")) 
                
RemoveEdict(fire[client]);
        }
        
        
fire[client] = 0;
    }

    if (!
extinguish)
        
CreateTimer(2.0SetOnFireTimerclient);
}

public 
Action:SetOnFireTimer(Handle:timerany:client)
{
    if (
IsClientInGame(client))
    {
        if ((
GetClientTeam(client) == || GetClientTeam(client) == 3) && IsPlayerAlive(client))
        {
            new 
view CreateEntityByName("env_fire");
            
            if (
view != -1)
            {
                
DispatchKeyValue(view"ignitionpoint""0");
                
DispatchKeyValue(view"spawnflags""285");
                
DispatchKeyValue(view"fireattack""0");
                
DispatchKeyValue(view"firesize""512");
                
DispatchKeyValueFloat(view"damagescale"0.0);
                
                if (
DispatchSpawn(view))
                {
                    
decl Float:origin[3];
                    
decl String:steamid[20];
                    
                    if (
IsValidEntity(view))
                    {
                        
fire[client] = view;
                        
                        
GetClientAbsOrigin(clientorigin);
                        
                        
TeleportEntity(vieworiginNULL_VECTORNULL_VECTOR);

                        
origin[2] = origin[2] + 90;

                        
AcceptEntityInput(view"StartFire");
                        
                        
//GetClientAuthString(client, steamid, sizeof(steamid));
                        
GetClientAuthId(clientAuthId_Steam2steamidsizeof(steamid));
                        
DispatchKeyValue(client"targetname"steamid);
                        
                        
SetVariantString(steamid);
                        
AcceptEntityInput(view"SetParent");
                    }
                }
            }
        }
    }
}

public 
gravity(clientFloat:amount)
{
    
SetEntityGravity(clientamount);
}

public 
item(clienttype)
{
    switch(
type)
    {
        case 
1:
        {
            
GivePlayerItem(client"weapon_deagle");
        }
        case 
2:
        {
            
GivePlayerItem(client"weapon_hegrenade");
        }
        case 
3:
        {
            
GivePlayerItem(client"weapon_flashbang");
            
GivePlayerItem(client"weapon_flashbang");
        }
        case 
4:
        {
            
GivePlayerItem(client"weapon_glock");
        }
        case 
5:
        {
            if (
getGame())
                
GivePlayerItem(client"weapon_m3");
            else
                
GivePlayerItem(client"weapon_sawedoff");
        }
    }
}

public 
bool:getGame()
{
    
decl String:game[64];

    
GetGameFolderName(gamesizeof(game));

    return (
StrEqual(game"cstrike"false));
}

public 
noclip(clientbool:turnOnFloat:time)
{
    if (
IsClientInGame(client))
    {
        if (
turnOn)
        {
            
SetEntityMoveType(clientMOVETYPE_NOCLIP);
        }
        else
            
SetEntityMoveType(clientMOVETYPE_WALK);
    }
}

public 
freeze(clientbool:turnOnFloat:time)
{    
    if (
IsClientInGame(client))
    {
        if (
turnOn)
        {
            
SetEntityMoveType(clientMOVETYPE_NONE);
            
            if (
time 0
                
CreateTimer(timefreezeOffclient);
        }
        else
            
SetEntityMoveType(clientMOVETYPE_WALK);
    }
}

public 
health(clientamounttype)
{
    switch(
type)
    {
        case 
1:
        {
            
SetEntityHealth(clientamount);
        }
        case 
2:
        {
            
SetEntityHealth(clientGetClientHealth(client) + amount);
        }
        case 
3:
        {
            new 
nhealth GetClientHealth(client) - amount;

            if (
nhealth <= 0)
                
ForcePlayerSuicide(client);
            else
                
SetEntityHealth(clientnhealth);
        }
    }
}

public 
drunk(client)
{
    
ClientCommand(client"r_screenoverlay Effects/tp_eyefx/tp_eyefx.vmt");
}

public 
drug(client)
{
    
CreateTimer(1.0drug_loopclientTIMER_REPEAT);    
}

public 
burn(clienthealth)
{
    new 
Float:time float(health) / 5.0;
    
    if (
health 100
        
IgniteEntity(clienttime);
    else 
        
IgniteEntity(client100.0);
}

public 
speed(clientFloat:speed)
{
    
SetEntPropFloat(clientProp_Data"m_flLaggedMovementValue"speed); 
}

public 
rocket(client)
{
    new 
Float:Origin[3];
    
    
GetClientAbsOrigin(clientOrigin);
    
    
Origin[2] = Origin[2] + 20;
    
    
godmode(clienttrue);
    
shake(client104025);
    
    
EmitSoundToAll("weapons/rpg/rocketfire1.wav"clientSNDCHAN_AUTOSNDLEVEL_NORMALSND_NOFLAGS0.5);
    
    
CreateTimer(1.0PlayRocketSoundclient);
    
CreateTimer(3.1EndRocketclient);
}

public 
godmode(clientbool:turnOn)
{
    if (
turnOn
        
SetEntProp(clientProp_Data"m_takedamage"01);
    else
        
SetEntProp(clientProp_Data"m_takedamage"21);
}

stock shake(clienttimedistancevalue)
{
    new 
Handle:message StartMessageOne("Shake"clientUSERMSG_RELIABLE|USERMSG_BLOCKHOOKS);

    if(
GetFeatureStatus(FeatureType_Native"GetUserMessageType") == FeatureStatus_Available && GetUserMessageType() == UM_Protobuf
    {
        
PbSetInt(message"command"0);
        
PbSetFloat(message"local_amplitude"float(value));
        
PbSetFloat(message"frequency"float(distance));
        
PbSetFloat(message"duration"float(time));
    }
    else
    {
        
BfWriteByte(message0);
        
BfWriteFloat(messagefloat(value));
        
BfWriteFloat(messagefloat(distance));
        
BfWriteFloat(messagefloat(time));
    }
    
    
EndMessage();    
}

public 
Action:PlayRocketSound(Handle:timerany:client)
{
    if (!
IsClientInGame(client) || !IsPlayerAlive(client)) 
        return;
    
    new 
Float:Origin[3];
    
    
GetClientAbsOrigin(clientOrigin);
    
    
Origin[2] = Origin[2] + 50;
    
    
EmitSoundToAll("weapons/rpg/rocket1.wav"clientSNDCHAN_AUTOSNDLEVEL_NORMALSND_NOFLAGS0.5);
    
    for (new 
x=1<= 15x++) 
        
CreateTimer(0.2*xrocket_loopclient);
    
    
TeleportEntity(clientOriginNULL_VECTORNULL_VECTOR);
}

public 
Action:EndRocket(Handle:timerany:client)
{
    if (!
IsClientInGame(client) || !IsPlayerAlive(client))
        return 
Plugin_Stop;
    
    new 
Float:Origin[3];
    
    
GetClientAbsOrigin(clientOrigin);
    
    
Origin[2] = Origin[2] + 50;
    
    for (new 
x=1<= MaxClientsx++)
    {
        if (
IsClientConnected(x)) 
            
StopSound(xSNDCHAN_AUTO"weapons/rpg/rocket1.wav");
    }
    
    
EmitSoundToAll("weapons/hegrenade/explode3.wav"clientSNDCHAN_AUTOSNDLEVEL_NORMALSND_NOFLAGS0.5);
    
    new 
expl CreateEntityByName("env_explosion");
    
    
TeleportEntity(explOriginNULL_VECTORNULL_VECTOR);
    
    
DispatchKeyValue(expl"fireballsprite""sprites/zerogxplode.spr");
    
DispatchKeyValue(expl"spawnflags""0");
    
DispatchKeyValue(expl"iMagnitude""1000");
    
DispatchKeyValue(expl"iRadiusOverride""100");
    
DispatchKeyValue(expl"rendermode""0");
    
    
DispatchSpawn(expl);
    
ActivateEntity(expl);
    
    
AcceptEntityInput(expl"Explode");
    
AcceptEntityInput(expl"Kill");
    
    
godmode(clientfalse);
    
ForcePlayerSuicide(client);

    return 
Plugin_Handled;
}

public 
Action:drug_loop(Handle:timerany:client)
{
    if (!
IsClientInGame(client)) 
        return 
Plugin_Stop;
    
    new 
Float:DrugAngles[20] = {0.05.010.015.020.025.020.015.010.05.00.0, -5.0, -10.0, -15.0, -20.0, -25.0, -20.0, -15.0, -10.0, -5.0};

    if (!
IsPlayerAlive(client))
    {
        new 
Float:pos[3];
        new 
Float:angs[3];
        
        
GetClientAbsOrigin(clientpos);
        
GetClientEyeAngles(clientangs);
        
        
angs[2] = 0.0;
        
        
TeleportEntity(clientposangsNULL_VECTOR);    
        
        new 
Handle:message StartMessageOne("Fade"clientUSERMSG_RELIABLE|USERMSG_BLOCKHOOKS);
        
        if(
GetFeatureStatus(FeatureType_Native"GetUserMessageType") == FeatureStatus_Available && GetUserMessageType() == UM_Protobuf
        {
            
PbSetInt(message"duration"1536);
            
PbSetInt(message"hold_time"1536);
            
PbSetInt(message"flags", (0x0001 0x0010));
            
PbSetColor(message"clr", {0000});
        }
        else
        {
            
BfWriteShort(message1536);
            
BfWriteShort(message1536);
            
BfWriteShort(message, (0x0001 0x0010));
            
BfWriteByte(message0);
            
BfWriteByte(message0);
            
BfWriteByte(message0);
            
BfWriteByte(message0);
        }
        
        
EndMessage();    
        
        return 
Plugin_Stop;
    }
    
    new 
Float:pos[3];
    new 
Float:angs[3];
    new 
coloring[4];

    
coloring[0] = GetRandomInt(0,255);
    
coloring[1] = GetRandomInt(0,255);
    
coloring[2] = GetRandomInt(0,255);
    
coloring[3] = 128;
    
    
GetClientAbsOrigin(clientpos);
    
GetClientEyeAngles(clientangs);
    
    
angs[2] = DrugAngles[GetRandomInt(0,100) % 20];
    
    
TeleportEntity(clientposangsNULL_VECTOR);

    new 
Handle:message StartMessageOne("Fade"client);

    if(
GetFeatureStatus(FeatureType_Native"GetUserMessageType") == FeatureStatus_Available && GetUserMessageType() == UM_Protobuf
    {
        
PbSetInt(message"duration"255);
        
PbSetInt(message"hold_time"255);
        
PbSetInt(message"flags", (0x0002));
        
PbSetColor(message"clr"coloring);
    }
    else
    {
        
BfWriteShort(message255);
        
BfWriteShort(message255);
        
BfWriteShort(message, (0x0002));
        
BfWriteByte(messageGetRandomInt(0,255));
        
BfWriteByte(messageGetRandomInt(0,255));
        
BfWriteByte(messageGetRandomInt(0,255));
        
BfWriteByte(message128);
    }
    
    
EndMessage();    
        
    return 
Plugin_Handled;
}

public 
Action:rocket_loop(Handle:timerany:client)
{
    if (!
IsClientInGame(client) || !IsPlayerAlive(client))
        return 
Plugin_Stop;
        
    new 
Float:velocity[3];
    
    
velocity[2] = 300.0;
    
    
TeleportEntity(clientNULL_VECTORNULL_VECTORvelocity);
    
    return 
Plugin_Handled;
}

public 
Action:freezeOff(Handle:timerany:client)
{
    
freeze(clientfalse0.0);
    
    return 
Plugin_Handled;

I can not compile too...

http://prntscr.com/l98ajy

But as this is possible, I already downloaded the new version of SourceMod and nothing...

Last edited by paulo_crash; 10-22-2018 at 20:38.
paulo_crash is offline
Cruze
Veteran Member
Join Date: May 2017
Old 10-22-2018 , 22:27   Re: [CS:S, CS:GO] Roll The Dice (Würfeln)
Reply With Quote #143

Quote:
Originally Posted by paulo_crash View Post
As well... I did not change anything and it did not compile for me.


I can not compile too...

http://prntscr.com/l98ajy

But as this is possible, I already downloaded the new version of SourceMod and nothing...
Try updating your colors.inc maybe
__________________
Taking paid private requests! Contact me
Cruze is offline
paulo_crash
AlliedModders Donor
Join Date: May 2016
Location: Brazil
Old 10-22-2018 , 22:33   Re: [CS:S, CS:GO] Roll The Dice (Würfeln)
Reply With Quote #144

Quote:
Originally Posted by Cruze View Post
Try updating your colors.inc maybe
Yes, thank you!
paulo_crash is offline
paulo_crash
AlliedModders Donor
Join Date: May 2016
Location: Brazil
Old 10-22-2018 , 23:16   Re: [CS:S, CS:GO] Roll The Dice (Würfeln)
Reply With Quote #145

Quote:
Originally Posted by Cruze View Post
Here is my version!
You need to put new translation file attached in this comment's attachment and delete cfg/dice/dice_config.cfg and reload/change map! New cvar "dice_credits" should be there in cfg/dice/dice_config.cfg. Put new value and reload/change map again.
PHP Code:
#include <sourcemod>
#include <sdktools>
#include <colors>
#include <autoexecconfig>
#include <store>

#undef REQUIRE_PLUGIN
#include <updater>

#pragma semicolon 1

#define DICES 33

new Handle:c_DiceText;
new 
Handle:c_ShowNumber;
new 
Handle:c_RandNumber;
new 
Handle:c_DiceTeam;
new 
Handle:c_DiceCount;
new 
Handle:c_DiceMoney;
new 
Handle:c_DiceCredits;

new 
String:DiceText[64];

new 
ShowNumber;
new 
RandNumber;
new 
DiceTeam;
new 
DiceMoney;
new 
DiceCredits;
new 
DiceCount;

new 
friction_default = -1;
new 
accelerate_default = -1;

new 
NoclipCounter[MAXPLAYERS 1];
new 
ClientDiced[MAXPLAYERS 1];
new 
FroggyJumped[MAXPLAYERS 1];
new 
fire[MAXPLAYERS 1];

new 
bool:EnabledNumbers[DICES+1];
new 
bool:LongJump[MAXPLAYERS 1];
new 
bool:Nightvision[MAXPLAYERS 1];
new 
bool:FroggyJump[MAXPLAYERS 1];
new 
bool:started;

public 
Plugin:myinfo =
{
    
name "Dice SM",
    
author "Popoklopsi edit Cruze",
    
version "1.6.2",
    
description "Roll the Dice by Popoklopsi",
    
url "https://forums.alliedmods.net/showthread.php?t=152035"
};

public 
APLRes:AskPluginLoad2(Handle:myselfbool:lateString:error[], err_max)
{
    
MarkNativeAsOptional("GetUserMessageType");

    return 
APLRes_Success;
}

public 
OnPluginStart()
{
    if (!
CColorAllowed(Color_Lightgreen) && CColorAllowed(Color_Darkred))
        
CReplaceColor(Color_LightgreenColor_Darkred);

    
started false;

    
AutoExecConfig_SetFile("dice_config""dice");
    
AutoExecConfig_CreateConVar("dice_sm""1.6.2""Dice for Sourcemod by Popoklopsi"FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY|FCVAR_DONTRECORD);
    
    
c_DiceText AutoExecConfig_CreateConVar("dice_text""dice""Command to dice (without exclamation mark), convert to UTF-8 without BOM for special characters");
    
c_ShowNumber AutoExecConfig_CreateConVar("dice_show""2""Players, which see the result: 1 = Everybody, 2 = just T's, 3 = just CT's, 4 = Only you");
    
c_RandNumber AutoExecConfig_CreateConVar("dice_rand""1""1 = Random text when result is a weapon, 0 = Off");
    
c_DiceTeam AutoExecConfig_CreateConVar("dice_team""2""2 = Only T's can dice, 3 = Only CT's can dice, 0 = Everybody can dice");
    
c_DiceCount AutoExecConfig_CreateConVar("dice_count""1""How often a player can dice per round");
    
c_DiceMoney AutoExecConfig_CreateConVar("dice_money""0""x = Money one dice costs, 0 = Off");
    
c_DiceCredits AutoExecConfig_CreateConVar("dice_credits""0""x = credits one dice costs, 0 = Off");

    
AutoExecConfig_CleanFile();
    
    
LoadEnables();

    
AutoExecConfig(true"dice_config""dice");
    
    
HookConVarChange(c_ShowNumberOnConVarChanged);
    
HookConVarChange(c_RandNumberOnConVarChanged);
    
HookConVarChange(c_DiceTeamOnConVarChanged);
    
    
HookEvent("player_spawn"PlayerSpawn);
    
HookEvent("player_death"PlayerDeath);
    
HookEvent("player_jump"PlayerJump);
    
HookEvent("round_start"RoundStart);
    
    
LoadTranslations("dice.phrases");
}

public 
OnConfigsExecuted()
{
    
decl String:ConsoleCmd[64];
    
    
GetConVarString(c_DiceTextDiceTextsizeof(DiceText));
    
    
ShowNumber GetConVarInt(c_ShowNumber);
    
RandNumber GetConVarInt(c_RandNumber);
    
DiceTeam GetConVarInt(c_DiceTeam);
    
DiceCount GetConVarInt(c_DiceCount);
    
DiceMoney GetConVarInt(c_DiceMoney);
    
DiceCredits GetConVarInt(c_DiceCredits);
    
accelerate_default GetConVarInt(FindConVar("sv_accelerate"));
    
friction_default GetConVarInt(FindConVar("sv_friction"));
    
    if (!
started)
    {
        
Format(ConsoleCmdsizeof(ConsoleCmd), "sm_%s"DiceText);
        
RegConsoleCmd(ConsoleCmdTypedText);
        
        
started true;
    }
}

public 
OnAllPluginsLoaded()
{
    if (
LibraryExists("updater"))
        
Updater_AddPlugin("http://popoklopsi.de/dice/update.txt");
}

public 
OnLibraryAdded(const String:name[])
{
    if (
StrEqual(name"updater"))
        
Updater_AddPlugin("http://popoklopsi.de/dice/update.txt");
}

public 
OnMapStart()
{
    
PrecacheSound("weapons/rpg/rocketfire1.wav");
    
PrecacheSound("weapons/rpg/rocket1.wav");
    
PrecacheSound("weapons/hegrenade/explode3.wav");
    
PrecacheModel("Effects/tp_eyefx/tp_eyefx.vmt");
}

public 
LoadEnables()
{
    
decl String:section[5];
    
    new 
Handle:keycvar CreateKeyValues("DiceEnables");
    
    if (
FileExists("cfg/dice/dice_enables.txt") && FileToKeyValues(keycvar"cfg/dice/dice_enables.txt"))
    {
        for (new 
1<= DICESx++)
        {
            
Format(sectionsizeof(section), "%i"x);
            
            if (
KvGetNum(keycvarsection1) == 1)
                
EnabledNumbers[x] = true;
            else
                
EnabledNumbers[x] = false;
        }
    }
    else
    {
        for (new 
1<= DICESx++)
            
EnabledNumbers[x] = true;
    }

    if (!
getGame())
        
EnabledNumbers[1] = false;
}

public 
Action:TypedText(clientargs)
{
    if (
client && client <= MaxClients && IsClientInGame(client))
        
PrepareDice(client);
    
    return 
Plugin_Handled;
}

public 
OnConVarChanged(Handle:hCvar, const String:oldValue[], const String:newValue[])
{
    if (
hCvar == c_ShowNumber
        
ShowNumber StringToInt(newValue);
        
    if (
hCvar == c_RandNumber
        
RandNumber StringToInt(newValue);
        
    if (
hCvar == c_DiceTeam
        
DiceTeam StringToInt(newValue);
}

public 
RoundStart(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
Handle:fr FindConVar("sv_friction");
    new 
Handle:ac FindConVar("sv_accelerate");

    if (
GetConVarInt(fr) != friction_default && friction_default != -1)
        
SetConVarInt(frfriction_defaulttruefalse);

    if (
GetConVarInt(ac) != accelerate_default && accelerate_default != -1)
        
SetConVarInt(acaccelerate_defaulttruefalse);
}

public 
PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"userid"));
    
    if (
IsPlayerAlive(client) && IsClientInGame(client))
    {
        
CPrintToChat(client"{lightgreen}[{green}%t{lightgreen}]{green} %t""dice""start"DiceText);
        
        
NoclipCounter[client] = 5;
        
ClientDiced[client] = 0;
        
FroggyJumped[client] = 0;
        
Nightvision[client] = false;
        
LongJump[client] = false;
        
FroggyJump[client] = false;
        
        
reset(client);
    }
}

public 
PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"userid"));
    
    
reset(client);
}

public 
PlayerJump(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"userid"));
    
    if (
LongJump[client]) 
        
longjump(client);
}

public 
Action:OnPlayerRunCmd(client, &buttons, &impulseFloat:vel[3], Float:angles[3], &weapon)
{
    if (!
IsClientInGame(client) || !IsPlayerAlive(client) || !FroggyJump[client])
        return 
Plugin_Continue;
    
    static 
bool:bPressed[MAXPLAYERS+1] = false;

    if(
GetEntityFlags(client) & FL_ONGROUND)
    {
        
FroggyJumped[client] = 0;
        
bPressed[client] = false;
    }
    else
    {
        if (
buttons IN_JUMP)
        {
            if(!
bPressed[client])
            {
                if(
FroggyJumped[client]++ == 1)
                    
froggyjump(client);
            }

            
bPressed[client] = true;
        }
        else
            
bPressed[client] = false;
    }

    
    return 
Plugin_Continue;
}

public 
PrepareDice(client)
{
    
decl String:Prefix[64];
    
    
Format(Prefixsizeof(Prefix), "{lightgreen}[{green}%T{lightgreen}]{green} ""dice"client);

    new 
money GetEntData(clientFindSendPropOffs("CCSPlayer""m_iAccount"));
    new 
credits Store_GetClientCredits(client);
    
    if (!
DiceTeam || GetClientTeam(client) == DiceTeam)
    {
        if (
ClientDiced[client] < DiceCount)
        {
            if (
IsPlayerAlive(client))
            {
                if(
DiceCredits 0)
                {
                    if ((
credits DiceCredits) >= 0)
                    {
                        
Store_SetClientCredits(clientcredits DiceCredits);
                        
CPrintToChat(client"%s%t"Prefix"spentcredits"DiceCredits);

                        
ClientDiced[client]++;
                        
DiceNow(client);
                    }
                    else 
CPrintToChat(client"%s%t"Prefix"credits"DiceCredits);
                    return;
                }
                if (
DiceMoney 0)
                {
                    if ((
money DiceMoney) >= 0)
                    {
                        
SetEntData(clientFindSendPropOffs("CCSPlayer""m_iAccount"), money DiceMoney);
                        
CPrintToChat(client"%s%t"Prefix"spentmoney"DiceMoney);

                        
ClientDiced[client]++;
                        
DiceNow(client);
                    }
                    else 
CPrintToChat(client"%s%t"Prefix"money"DiceMoney);
                    return;
                }
                else
                {
                    
ClientDiced[client]++;
                    
DiceNow(client);
                }
            }
            else 
CPrintToChat(client"%s%t"Prefix"dead");
        }
        else 
CPrintToChat(client"%s%t"Prefix"already"DiceCount);
    }
    else 
CPrintToChat(client"%s%t"Prefix"wrong");
}

DiceNow(client)
{
    new 
number;
    new 
count;

    
CPrintToChat(client"{lightgreen}[{green}%t{lightgreen}]{green} %t""dice""rolling"ClientDiced[client], DiceCount);

    
number count GetRandomInt(1DICES);

    while(!
EnabledNumbers[number])
    {
        if (
number == DICES)
            
number 1;
        else
            
number number DICES 1;

        if (
number == count)
            return;
    }

    switch (
number)
    {
        case 
1:
        {
            
drunk(client);
        }
        case 
2:
        {
            
drug(client);
        }
        case 
3:
        {
            
burn(client70);
        }
        case 
4:
        {
            
speed(client1.65);
        }
        case 
5:
        {
            
rocket(client);
        }
        case 
7:
        {
            
LongJump[client] = true;
        }
        case 
8:
        {
            
item(client1);
        }
        case 
9:
        {
            
health(client503);
        }
        case 
10:
        {
            
health(client502);
        }
        case 
11:
        {
            
speed(client0.65);
        }
        case 
12:
        {
            
item(client2);
        }
        case 
13:
        {
            
item(client3);
        }
        case 
15:
        {
            
gravity(client0.5);
        }
        case 
16:
        {
            
gravity(client2.0);
        }
        case 
17:
        {
            
speed(client1.65);
            
health(client502);
        }
        case 
18:
        {
            
health(client303);
            
gravity(client0.5);
            
speed(client0.65);
        }
        case 
19:
        {
            
gravity(client2.0);
            
speed(client0.65);
            
health(client302);
        }
        case 
20:
        {
            
noclip(clienttrue5.0);
            
            
CPrintToChat(client"{lightgreen}[{green}%t{lightgreen}]{green} %t""dice""noclip"NoclipCounter[client]);
            
            
CreateTimer(1.0NclipTimerclientTIMER_REPEAT);
        }
        case 
21:
        {
            
freeze(clienttrue30.0);
        }
        case 
22:
        {
            
shake(client10060140);
        }
        case 
23:
        {
            
item(client4);
        }
        case 
24:
        {
            
health(client11);
        }
        case 
25:
        {
            
item(client5);
        }
        case 
26:
        {
            
FroggyJump[client] = true;
        }
        case 
27:
        {
            
Nightvision[client] = true;
        }
        case 
28:
        {
            
SetEntProp(clientProp_Send"m_iDefaultFOV"35);
            
SetEntProp(clientProp_Send"m_iFOV"35);
        }
        case 
29:
        {
            
SetEntProp(clientProp_Send"m_iDefaultFOV"200);
            
SetEntProp(clientProp_Send"m_iFOV"200);
        }
        case 
30:
        {
            
SetInvisible(clientfalse);
        }
        case 
31:
        {
            
SetOnFire(clientfalse);
            
speed(client1.65);
            
health(client1002);
        }
        case 
32:
        {
            new 
Handle:cvar FindConVar("sv_accelerate");

            if (
cvar != INVALID_HANDLE)
                
SetConVarInt(cvar, -5truefalse);
        }
        case 
33:
        {
            new 
Handle:cvar FindConVar("sv_friction");

            if (
cvar != INVALID_HANDLE)
                
SetConVarInt(cvar1truefalse);
        }
    }
    
    
ShowText(clientnumber);
}

public 
Action:NclipTimer(Handle:timerany:client)
{
    if (
NoclipCounter[client] > && IsPlayerAlive(client) && IsClientInGame(client))
    {
        
CPrintToChat(client"{lightgreen}[{green}%t{lightgreen}]{green} %t""dice""noclip"NoclipCounter[client]);

        
NoclipCounter[client]--;
        
        return 
Plugin_Continue;
    }
    
    
noclip(clientfalse0.0);
    
    return 
Plugin_Stop;
}

ShowText(clientDiceNumber)
{
    
decl String:Prefix[64];
    
decl String:trans[10];
    
decl String:trans_all[20];

    new 
clients[MAXPLAYERS 1];
    new 
ClientCount 0;

    
Format(Prefixsizeof(Prefix), "{lightgreen}[{green}%T{lightgreen}]{green} ""dice"LANG_SERVER);

    
Format(transsizeof(trans), "dice%i"DiceNumber);
    
Format(trans_allsizeof(trans_all), "dice%i_all"DiceNumber);
    
    if (
ShowNumber != 4)
    {
        for (new 
x=1<= MaxClientsx++)
        {
            if (
IsClientInGame(x))
            {
                if (
ShowNumber == || ShowNumber == GetClientTeam(x))
                    
clients[ClientCount++] = x;
            }
        }
    }
    else
    {
        
clients[0] = client;
        
ClientCount 1;
    }
    
    if ((
DiceNumber == || DiceNumber == 23 || DiceNumber == 25) && RandNumber == 1)
    {
        while (
DiceNumber == || DiceNumber == 22 || DiceNumber == 24)
            
DiceNumber GetRandomInt(1DICES);
            
        
Format(transsizeof(trans), "dice%i"DiceNumber);
        
        
CPrintToChat(client"%s%t"Prefix"deagle");
        
CPrintToChat(client"%s%t"Prefix"deagle");
    }

    if ((
DiceNumber == 32 || DiceNumber == 33) && ShowNumber != 1)
        
CPrintToChatAll("%s%t"Prefixtrans_allDiceNumber);

    for (new 
x=0ClientCountx++)
        
CPrintToChat(clients[x], "%s%t"PrefixtransclientDiceNumber);
}

// PRESETS

public reset(client)
{
    if (!
IsClientInGame(client)) 
        return;
    
    new 
Float:pos[3];
    new 
Float:angs[3];
    
    
gravity(client1.0);
    
noclip(clientfalse0.0);
    
freeze(clientfalse0.0);
    
speed(client1.0);
    
godmode(clientfalse);

    
SetInvisible(clienttrue);
    
SetOnFire(clienttrue);
    
    
ExtinguishEntity(client);
    
ClientCommand(client"r_screenoverlay 0");
    
    
GetClientAbsOrigin(clientpos);
    
GetClientEyeAngles(clientangs);

    
SetEntProp(clientProp_Send"m_iDefaultFOV"90);
    
    
angs[2] = 0.0;
    
    
TeleportEntity(clientposangsNULL_VECTOR);    
    
    new 
Handle:message StartMessageOne("Fade"clientUSERMSG_RELIABLE|USERMSG_BLOCKHOOKS);
            
    if(
GetFeatureStatus(FeatureType_Native"GetUserMessageType") == FeatureStatus_Available && GetUserMessageType() == UM_Protobuf
    {
        
PbSetInt(message"duration"1536);
        
PbSetInt(message"hold_time"1536);
        
PbSetInt(message"flags", (0x0001 0x0010));
        
PbSetColor(message"clr", {0000});
    }
    else
    {
        
BfWriteShort(message1536);
        
BfWriteShort(message1536);
        
BfWriteShort(message, (0x0001 0x0010));
        
BfWriteByte(message0);
        
BfWriteByte(message0);
        
BfWriteByte(message0);
        
BfWriteByte(message0);
    }

    
EndMessage();
    
    
message StartMessageOne("Shake"clientUSERMSG_RELIABLE|USERMSG_BLOCKHOOKS);

    if(
GetFeatureStatus(FeatureType_Native"GetUserMessageType") == FeatureStatus_Available && GetUserMessageType() == UM_Protobuf
    {
        
PbSetInt(message"command"1);
        
PbSetFloat(message"local_amplitude"0.0);
        
PbSetFloat(message"frequency"0.0);
        
PbSetFloat(message"duration"1.0);
    }
    else
    {
        
BfWriteByte(message1);
        
BfWriteFloat(message0.0);
        
BfWriteFloat(message0.0);
        
BfWriteFloat(message1.0);
    }
    
    
EndMessage();    
}

public 
longjump(client)
{
    if (!
IsClientInGame(client) || !IsPlayerAlive(client)) 
        return;
    
    new 
Float:velocity[3];
    new 
Float:velocity0;
    new 
Float:velocity1;
    
    
velocity0 GetEntPropFloat(clientProp_Send"m_vecVelocity[0]");
    
velocity1 GetEntPropFloat(clientProp_Send"m_vecVelocity[1]");
    
    
velocity[0] = (7.0 velocity0) * (1.0 4.1);
    
velocity[1] = (7.0 velocity1) * (1.0 4.1);
    
velocity[2] = 0.0;
    
    
SetEntPropVector(clientProp_Send"m_vecBaseVelocity"velocity);
}

public 
froggyjump(client)
{
    new 
Float:velocity[3];
    new 
Float:velocity0;
    new 
Float:velocity1;
    new 
Float:velocity2;
    new 
Float:velocity2_new;

    
velocity0 GetEntPropFloat(clientProp_Send"m_vecVelocity[0]");
    
velocity1 GetEntPropFloat(clientProp_Send"m_vecVelocity[1]");
    
velocity2 GetEntPropFloat(clientProp_Send"m_vecVelocity[2]");

    
velocity2_new 260.0;

    if (
velocity2 150.0
        
velocity2_new 270.0;
    if (
velocity2 100.0
        
velocity2_new 300.0;
    if (
velocity2 50.0
        
velocity2_new 330.0;
    if (
velocity2 0.0
        
velocity2_new 380.0;
    if (
velocity2 < -50.0
        
velocity2_new 400.0;
    if (
velocity2 < -100.0
        
velocity2_new 430.0;
    if (
velocity2 < -150.0
        
velocity2_new 450.0;
    if (
velocity2 < -200.0
        
velocity2_new 470.0;

    
velocity[0] = velocity0 0.1;
    
velocity[1] = velocity1 0.1;
    
velocity[2] = velocity2_new;
    
    
SetEntPropVector(clientProp_Send"m_vecBaseVelocity"velocity);
}

public 
OnGameFrame()
{
    for (new 
1MaxClients 1i++)
    {
        if (
IsClientInGame(i) && IsPlayerAlive(i) && Nightvision[i])
            
SetEntProp(iProp_Send"m_bNightVisionOn"1);
    }
}

public 
SetInvisible(clientbool:visible)
{
    new 
weapon;    

    new 
RenderMode:mode;
    new 
alpha;

    if (
visible)
    {
        
mode RENDER_NORMAL;
        
alpha 255;
    }
    else
    {
        
mode RENDER_TRANSCOLOR;
        
alpha 20;
    }

    for (new 
04i++)
    {
        if ((
weapon GetPlayerWeaponSlot(clienti)) != -1)
        {
            
SetEntityRenderMode(weaponmode);
            
SetEntityRenderColor(weapon255255255alpha);
        }
    }

    
SetEntityRenderColor(client255255255alpha);
    
SetEntityRenderMode(clientmode);
}

public 
SetOnFire(clientbool:extinguish)
{
    if (
fire[client] != 0
    {
        if (
IsValidEntity(fire[client]))
        {
            
decl String:class[128];
            
            
GetEdictClassname(fire[client], class, sizeof(class));
            
            if (
StrEqual(class, "env_fire")) 
                
RemoveEdict(fire[client]);
        }
        
        
fire[client] = 0;
    }

    if (!
extinguish)
        
CreateTimer(2.0SetOnFireTimerclient);
}

public 
Action:SetOnFireTimer(Handle:timerany:client)
{
    if (
IsClientInGame(client))
    {
        if ((
GetClientTeam(client) == || GetClientTeam(client) == 3) && IsPlayerAlive(client))
        {
            new 
view CreateEntityByName("env_fire");
            
            if (
view != -1)
            {
                
DispatchKeyValue(view"ignitionpoint""0");
                
DispatchKeyValue(view"spawnflags""285");
                
DispatchKeyValue(view"fireattack""0");
                
DispatchKeyValue(view"firesize""512");
                
DispatchKeyValueFloat(view"damagescale"0.0);
                
                if (
DispatchSpawn(view))
                {
                    
decl Float:origin[3];
                    
decl String:steamid[20];
                    
                    if (
IsValidEntity(view))
                    {
                        
fire[client] = view;
                        
                        
GetClientAbsOrigin(clientorigin);
                        
                        
TeleportEntity(vieworiginNULL_VECTORNULL_VECTOR);

                        
origin[2] = origin[2] + 90;

                        
AcceptEntityInput(view"StartFire");
                        
                        
//GetClientAuthString(client, steamid, sizeof(steamid));
                        
GetClientAuthId(clientAuthId_Steam2steamidsizeof(steamid));
                        
DispatchKeyValue(client"targetname"steamid);
                        
                        
SetVariantString(steamid);
                        
AcceptEntityInput(view"SetParent");
                    }
                }
            }
        }
    }
}

public 
gravity(clientFloat:amount)
{
    
SetEntityGravity(clientamount);
}

public 
item(clienttype)
{
    switch(
type)
    {
        case 
1:
        {
            
GivePlayerItem(client"weapon_deagle");
        }
        case 
2:
        {
            
GivePlayerItem(client"weapon_hegrenade");
        }
        case 
3:
        {
            
GivePlayerItem(client"weapon_flashbang");
            
GivePlayerItem(client"weapon_flashbang");
        }
        case 
4:
        {
            
GivePlayerItem(client"weapon_glock");
        }
        case 
5:
        {
            if (
getGame())
                
GivePlayerItem(client"weapon_m3");
            else
                
GivePlayerItem(client"weapon_sawedoff");
        }
    }
}

public 
bool:getGame()
{
    
decl String:game[64];

    
GetGameFolderName(gamesizeof(game));

    return (
StrEqual(game"cstrike"false));
}

public 
noclip(clientbool:turnOnFloat:time)
{
    if (
IsClientInGame(client))
    {
        if (
turnOn)
        {
            
SetEntityMoveType(clientMOVETYPE_NOCLIP);
        }
        else
            
SetEntityMoveType(clientMOVETYPE_WALK);
    }
}

public 
freeze(clientbool:turnOnFloat:time)
{    
    if (
IsClientInGame(client))
    {
        if (
turnOn)
        {
            
SetEntityMoveType(clientMOVETYPE_NONE);
            
            if (
time 0
                
CreateTimer(timefreezeOffclient);
        }
        else
            
SetEntityMoveType(clientMOVETYPE_WALK);
    }
}

public 
health(clientamounttype)
{
    switch(
type)
    {
        case 
1:
        {
            
SetEntityHealth(clientamount);
        }
        case 
2:
        {
            
SetEntityHealth(clientGetClientHealth(client) + amount);
        }
        case 
3:
        {
            new 
nhealth GetClientHealth(client) - amount;

            if (
nhealth <= 0)
                
ForcePlayerSuicide(client);
            else
                
SetEntityHealth(clientnhealth);
        }
    }
}

public 
drunk(client)
{
    
ClientCommand(client"r_screenoverlay Effects/tp_eyefx/tp_eyefx.vmt");
}

public 
drug(client)
{
    
CreateTimer(1.0drug_loopclientTIMER_REPEAT);    
}

public 
burn(clienthealth)
{
    new 
Float:time float(health) / 5.0;
    
    if (
health 100
        
IgniteEntity(clienttime);
    else 
        
IgniteEntity(client100.0);
}

public 
speed(clientFloat:speed)
{
    
SetEntPropFloat(clientProp_Data"m_flLaggedMovementValue"speed); 
}

public 
rocket(client)
{
    new 
Float:Origin[3];
    
    
GetClientAbsOrigin(clientOrigin);
    
    
Origin[2] = Origin[2] + 20;
    
    
godmode(clienttrue);
    
shake(client104025);
    
    
EmitSoundToAll("weapons/rpg/rocketfire1.wav"clientSNDCHAN_AUTOSNDLEVEL_NORMALSND_NOFLAGS0.5);
    
    
CreateTimer(1.0PlayRocketSoundclient);
    
CreateTimer(3.1EndRocketclient);
}

public 
godmode(clientbool:turnOn)
{
    if (
turnOn
        
SetEntProp(clientProp_Data"m_takedamage"01);
    else
        
SetEntProp(clientProp_Data"m_takedamage"21);
}

stock shake(clienttimedistancevalue)
{
    new 
Handle:message StartMessageOne("Shake"clientUSERMSG_RELIABLE|USERMSG_BLOCKHOOKS);

    if(
GetFeatureStatus(FeatureType_Native"GetUserMessageType") == FeatureStatus_Available && GetUserMessageType() == UM_Protobuf
    {
        
PbSetInt(message"command"0);
        
PbSetFloat(message"local_amplitude"float(value));
        
PbSetFloat(message"frequency"float(distance));
        
PbSetFloat(message"duration"float(time));
    }
    else
    {
        
BfWriteByte(message0);
        
BfWriteFloat(messagefloat(value));
        
BfWriteFloat(messagefloat(distance));
        
BfWriteFloat(messagefloat(time));
    }
    
    
EndMessage();    
}

public 
Action:PlayRocketSound(Handle:timerany:client)
{
    if (!
IsClientInGame(client) || !IsPlayerAlive(client)) 
        return;
    
    new 
Float:Origin[3];
    
    
GetClientAbsOrigin(clientOrigin);
    
    
Origin[2] = Origin[2] + 50;
    
    
EmitSoundToAll("weapons/rpg/rocket1.wav"clientSNDCHAN_AUTOSNDLEVEL_NORMALSND_NOFLAGS0.5);
    
    for (new 
x=1<= 15x++) 
        
CreateTimer(0.2*xrocket_loopclient);
    
    
TeleportEntity(clientOriginNULL_VECTORNULL_VECTOR);
}

public 
Action:EndRocket(Handle:timerany:client)
{
    if (!
IsClientInGame(client) || !IsPlayerAlive(client))
        return 
Plugin_Stop;
    
    new 
Float:Origin[3];
    
    
GetClientAbsOrigin(clientOrigin);
    
    
Origin[2] = Origin[2] + 50;
    
    for (new 
x=1<= MaxClientsx++)
    {
        if (
IsClientConnected(x)) 
            
StopSound(xSNDCHAN_AUTO"weapons/rpg/rocket1.wav");
    }
    
    
EmitSoundToAll("weapons/hegrenade/explode3.wav"clientSNDCHAN_AUTOSNDLEVEL_NORMALSND_NOFLAGS0.5);
    
    new 
expl CreateEntityByName("env_explosion");
    
    
TeleportEntity(explOriginNULL_VECTORNULL_VECTOR);
    
    
DispatchKeyValue(expl"fireballsprite""sprites/zerogxplode.spr");
    
DispatchKeyValue(expl"spawnflags""0");
    
DispatchKeyValue(expl"iMagnitude""1000");
    
DispatchKeyValue(expl"iRadiusOverride""100");
    
DispatchKeyValue(expl"rendermode""0");
    
    
DispatchSpawn(expl);
    
ActivateEntity(expl);
    
    
AcceptEntityInput(expl"Explode");
    
AcceptEntityInput(expl"Kill");
    
    
godmode(clientfalse);
    
ForcePlayerSuicide(client);

    return 
Plugin_Handled;
}

public 
Action:drug_loop(Handle:timerany:client)
{
    if (!
IsClientInGame(client)) 
        return 
Plugin_Stop;
    
    new 
Float:DrugAngles[20] = {0.05.010.015.020.025.020.015.010.05.00.0, -5.0, -10.0, -15.0, -20.0, -25.0, -20.0, -15.0, -10.0, -5.0};

    if (!
IsPlayerAlive(client))
    {
        new 
Float:pos[3];
        new 
Float:angs[3];
        
        
GetClientAbsOrigin(clientpos);
        
GetClientEyeAngles(clientangs);
        
        
angs[2] = 0.0;
        
        
TeleportEntity(clientposangsNULL_VECTOR);    
        
        new 
Handle:message StartMessageOne("Fade"clientUSERMSG_RELIABLE|USERMSG_BLOCKHOOKS);
        
        if(
GetFeatureStatus(FeatureType_Native"GetUserMessageType") == FeatureStatus_Available && GetUserMessageType() == UM_Protobuf
        {
            
PbSetInt(message"duration"1536);
            
PbSetInt(message"hold_time"1536);
            
PbSetInt(message"flags", (0x0001 0x0010));
            
PbSetColor(message"clr", {0000});
        }
        else
        {
            
BfWriteShort(message1536);
            
BfWriteShort(message1536);
            
BfWriteShort(message, (0x0001 0x0010));
            
BfWriteByte(message0);
            
BfWriteByte(message0);
            
BfWriteByte(message0);
            
BfWriteByte(message0);
        }
        
        
EndMessage();    
        
        return 
Plugin_Stop;
    }
    
    new 
Float:pos[3];
    new 
Float:angs[3];
    new 
coloring[4];

    
coloring[0] = GetRandomInt(0,255);
    
coloring[1] = GetRandomInt(0,255);
    
coloring[2] = GetRandomInt(0,255);
    
coloring[3] = 128;
    
    
GetClientAbsOrigin(clientpos);
    
GetClientEyeAngles(clientangs);
    
    
angs[2] = DrugAngles[GetRandomInt(0,100) % 20];
    
    
TeleportEntity(clientposangsNULL_VECTOR);

    new 
Handle:message StartMessageOne("Fade"client);

    if(
GetFeatureStatus(FeatureType_Native"GetUserMessageType") == FeatureStatus_Available && GetUserMessageType() == UM_Protobuf
    {
        
PbSetInt(message"duration"255);
        
PbSetInt(message"hold_time"255);
        
PbSetInt(message"flags", (0x0002));
        
PbSetColor(message"clr"coloring);
    }
    else
    {
        
BfWriteShort(message255);
        
BfWriteShort(message255);
        
BfWriteShort(message, (0x0002));
        
BfWriteByte(messageGetRandomInt(0,255));
        
BfWriteByte(messageGetRandomInt(0,255));
        
BfWriteByte(messageGetRandomInt(0,255));
        
BfWriteByte(message128);
    }
    
    
EndMessage();    
        
    return 
Plugin_Handled;
}

public 
Action:rocket_loop(Handle:timerany:client)
{
    if (!
IsClientInGame(client) || !IsPlayerAlive(client))
        return 
Plugin_Stop;
        
    new 
Float:velocity[3];
    
    
velocity[2] = 300.0;
    
    
TeleportEntity(clientNULL_VECTORNULL_VECTORvelocity);
    
    return 
Plugin_Handled;
}

public 
Action:freezeOff(Handle:timerany:client)
{
    
freeze(clientfalse0.0);
    
    return 
Plugin_Handled;

I'm with your version, but when you type it says nothing happens. I already changed the translation file as it is asking for yours, I configured the credit and nothing.

[EDIT1]
Now it worked normally, player digits !dice and buys the dice with the credits of the store, thank you!

Last edited by paulo_crash; 10-23-2018 at 01:28.
paulo_crash is offline
Lucian_
BANNED
Join Date: Mar 2018
Location: GB
Old 12-29-2018 , 05:38   Re: [CS:S, CS:GO] Roll The Dice (Würfeln)
Reply With Quote #146

Quote:
Originally Posted by Lucian_ View Post
can you put an archive with cfg and what does it need to work with credits? not with money! Thank you
can you put an archive with cfg and what does it need to work with credits? not with money! Thank you
Lucian_ is offline
Send a message via ICQ to Lucian_ Send a message via AIM to Lucian_ Send a message via Yahoo to Lucian_ Send a message via Skype™ to Lucian_
paulo_crash
AlliedModders Donor
Join Date: May 2016
Location: Brazil
Old 12-29-2018 , 12:27   Re: [CS:S, CS:GO] Roll The Dice (Würfeln)
Reply With Quote #147

Quote:
Originally Posted by Lucian_ View Post
can you put an archive with cfg and what does it need to work with credits? not with money! Thank you
Just put the version of @Cruze on your server #141, after the plugin first runs it generates the config, then only switch there to the credits option in the store.

The config would look like this:
Code:
// This file was auto-generated by SourceMod (v1.9.0.6245)
// ConVars for plugin "dice_sm.smx"


// How often a player can dice per round
// -
// Default: "1"
dice_count "1"

// x = credits one dice costs, 0 = Off
// -
// Default: "0"
dice_credits "350"

// x = Money one dice costs, 0 = Off
// -
// Default: "0"
dice_money "0"

// 1 = Random text when result is a weapon, 0 = Off
// -
// Default: "1"
dice_rand "1"

// Players, which see the result: 1 = Everybody, 2 = just T's, 3 = just CT's, 4 = Only you
// -
// Default: "2"
dice_show "4"

// 2 = Only T's can dice, 3 = Only CT's can dice, 0 = Everybody can dice
// -
// Default: "2"
dice_team "2"

// Command to dice (without exclamation mark), convert to UTF-8 without BOM for special characters
// -
// Default: "dice"
dice_text "dado"
paulo_crash is offline
Lucian_
BANNED
Join Date: Mar 2018
Location: GB
Old 12-30-2018 , 07:59   Re: [CS:S, CS:GO] Roll The Dice (Würfeln)
Reply With Quote #148

Quote:
Originally Posted by paulo_crash View Post
Just put the version of @Cruze on your server #141, after the plugin first runs it generates the config, then only switch there to the credits option in the store.

The config would look like this:
Code:
// This file was auto-generated by SourceMod (v1.9.0.6245)
// ConVars for plugin "dice_sm.smx"


// How often a player can dice per round
// -
// Default: "1"
dice_count "1"

// x = credits one dice costs, 0 = Off
// -
// Default: "0"
dice_credits "350"

// x = Money one dice costs, 0 = Off
// -
// Default: "0"
dice_money "0"

// 1 = Random text when result is a weapon, 0 = Off
// -
// Default: "1"
dice_rand "1"

// Players, which see the result: 1 = Everybody, 2 = just T's, 3 = just CT's, 4 = Only you
// -
// Default: "2"
dice_show "4"

// 2 = Only T's can dice, 3 = Only CT's can dice, 0 = Everybody can dice
// -
// Default: "2"
dice_team "2"

// Command to dice (without exclamation mark), convert to UTF-8 without BOM for special characters
// -
// Default: "dice"
dice_text "dado"
i put . but dont work

// Command to dice (without exclamation mark), convert to UTF-8 without BOM for special characters
// -
// Default: "dice"
dice_text "dice"

// 2 = Only T's can dice, 3 = Only CT's can dice, 0 = Everybody can dice
// -
// Default: "2"
dice_team "0"

// Players, which see the result: 1 = Everybody, 2 = just T's, 3 = just CT's, 4 = Only you
// -
// Default: "2"
dice_show "4"

// 1 = Random text when result is a weapon, 0 = Off
// -
// Default: "1"
dice_rand "0"

// How often a player can dice per round
// -
// Default: "1"
dice_count "1"

// x = Money one dice costs, 0 = Off
// -
// Default: "0"
dice_money "0"

// x = Credits one dice costs, 0 = Off
// -
// Default: "0"
dice_credits "1000"
Lucian_ is offline
Send a message via ICQ to Lucian_ Send a message via AIM to Lucian_ Send a message via Yahoo to Lucian_ Send a message via Skype™ to Lucian_
Cruze
Veteran Member
Join Date: May 2017
Old 12-30-2018 , 08:57   Re: [CS:S, CS:GO] Roll The Dice (Würfeln)
Reply With Quote #149

Quote:
Originally Posted by Lucian_ View Post
i put . but dont work
How does it not work exactly?

also post error logs.
__________________
Taking paid private requests! Contact me
Cruze is offline
eliteroyal
AlliedModders Donor
Join Date: Dec 2016
Location: Moldova
Old 04-04-2019 , 12:42   Re: [CS:S, CS:GO] Roll The Dice (Würfeln)
Reply With Quote #150

Is there a version where it limits the player to use it only once per map?
(csgo linux)
__________________
PEACE FROM MOLDOVA

Last edited by eliteroyal; 04-04-2019 at 12:42.
eliteroyal is offline
Reply



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 07:40.


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