AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugin/Gameplay Ideas and Requests (https://forums.alliedmods.net/forumdisplay.php?f=60)
-   -   I need Help With one Plugin please (https://forums.alliedmods.net/showthread.php?t=326848)

MasterWindowS 08-19-2020 15:48

I need Help With one Plugin please
 
1 Attachment(s)
Hi, I have seen this plugin from the CSS and found it very good. And I want it for myself in csgo, could someone give me a hand to pass it from css to csgo?

Code:

#include <sourcemod>
#include <sdktools>

#define PLUGIN_AUTHOR        "tuty"
#define PLUGIN_VERSION        "1.1"
#define FFADE_IN          0x0001
#pragma semicolon 1

new Handle:gRedBullEnabled = INVALID_HANDLE;
new Handle:gRedBullCost = INVALID_HANDLE;
new Handle:gRedBullEffectTime = INVALID_HANDLE;
new Handle:gRedBullHealth = INVALID_HANDLE;
new Handle:gRedBullArmor = INVALID_HANDLE;
new Handle:gRedBullSpeed = INVALID_HANDLE;
new bool:bUserHasRedBull[ 33 ];
new gPlayerMoney;

public Plugin:myinfo =
{
        name = "Red Bull: Source",
        author = PLUGIN_AUTHOR,
        description = "Say !redbull to buy a redbull.",
        version = PLUGIN_VERSION,
        url = "www.ligs.us"
};
public OnPluginStart()
{
        RegConsoleCmd( "say", Command_BuyRedByll );
        RegConsoleCmd( "say_team", Command_BuyRedByll );
       
        CreateConVar( "redbull_version", PLUGIN_VERSION, "Red Bull: Source", FCVAR_PLUGIN | FCVAR_SPONLY | FCVAR_REPLICATED | FCVAR_NOTIFY );
        gRedBullEnabled = CreateConVar( "redbull_enabled", "1" );
        gRedBullCost = CreateConVar( "redbull_cost", "2000" );
        gRedBullEffectTime = CreateConVar( "redbull_time", "20.0" );
        gRedBullHealth = CreateConVar( "redbull_health", "50" );
        gRedBullArmor = CreateConVar( "redbull_armor", "50" );
        gRedBullSpeed = CreateConVar( "redbull_speed", "3.9" );

        gPlayerMoney = FindSendPropOffs( "CCSPlayer", "m_iAccount" );
        AutoExecConfig();
}       
public OnClientConnected( id )
{
        bUserHasRedBull[ id ] = false;
}
public OnClientDisconnect( id )
{
        bUserHasRedBull[ id ] = false;
}
public Action:Command_BuyRedByll( id, args )
{
        decl String:Said[ 128 ];
        GetCmdArgString( Said, sizeof( Said ) - 1 );
        StripQuotes( Said );
        TrimString( Said );
       
        if( StrEqual( Said, "!redbull" ) || StrEqual( Said, "!RedBull" ) )
        {
                if( GetConVarInt( gRedBullEnabled ) == 0 )
                {
                        PrintToChat( id, "\x01[Red Bull: Source] \x03The plugin is disaled!" );
                       
                        return Plugin_Continue;
                }
               
                if( !IsPlayerAlive( id ) )
                {
                        PrintToChat( id, "\x01[Red Bull: Source] \x03Only alive players can buy a RedBull!" );
               
                        return Plugin_Continue;
                }
               
                if( bUserHasRedBull[ id ] )
                {
                        PrintToChat( id, "\x01[Red Bull: Source] \x03You already have RedBull effects on you." );
                       
                        return Plugin_Continue;
                }
               
                new money = GetClientMoney( id );
                new cost = GetConVarInt( gRedBullCost );
               
                if( money < cost )
                {
                        PrintToChat( id, "\x01[Red Bull: Source] \x03You don't have enough money to buy a RedBull! You need %d$!", cost );
                       
                        return Plugin_Continue;
                }
               
                bUserHasRedBull[ id ] = true;
                SetClientMoney( id, money - cost );
                CreateTimer( GetConVarFloat( gRedBullEffectTime ), RedBullEffectOff, id );

                SetEntPropFloat( id, Prop_Data, "m_flLaggedMovementValue", GetConVarFloat( gRedBullSpeed ) );
                SetEntProp( id, Prop_Data, "m_iHealth", GetClientHealth( id ) + GetConVarInt( gRedBullHealth ) );
                SetEntProp( id, Prop_Data, "m_ArmorValue", GetClientArmor( id ) + GetConVarInt( gRedBullArmor ) );
               
                PrintToChat( id, "\x01[Red Bull: Source] \x03RedBull gives you wings!" );
                PrintToChat( id, "\x01[Red Bull: Source] \x03RedBull improves performance, especially during times of increases stress or strain!" );
                SetClientScreenFade( id, 6, 255, 0, 0, 100 );
                SetClientShake( id, 10.0, 9000.0, 10.0, 40.0 );
        }
       
        return Plugin_Continue;
}               
public Action:RedBullEffectOff( Handle:timer, any:id )
{
        bUserHasRedBull[ id ] = false;
        SetClientScreenFade( id, 0, 0, 0, 0, 0 );
        SetEntPropFloat( id, Prop_Data, "m_flLaggedMovementValue", 1.0 );
        PrintToChat( id, "\x01[Red Bull: Source] \x03RedBull's effects are only temporary!" );
}
stock SetClientMoney( index, money )
{
        if( gPlayerMoney != -1 )
        {
                SetEntData( index, gPlayerMoney, money );
        }
}
stock GetClientMoney( index )
{
        if( gPlayerMoney != -1 )
        {
                return GetEntData( index, gPlayerMoney );
        }
       
        return 0;
}
stock SetClientScreenFade( index, delay, red, green, blue, alpha )
{
        new duration = delay * 1000;
       
        new Handle:FadeMsg = StartMessageOne( "Fade", index );
        BfWriteShort( FadeMsg, 500 );
        BfWriteShort( FadeMsg, duration );
        BfWriteShort( FadeMsg, FFADE_IN );
        BfWriteByte( FadeMsg, red );
        BfWriteByte( FadeMsg, green );
        BfWriteByte( FadeMsg, blue );       
        BfWriteByte( FadeMsg, alpha );
        EndMessage();
}
stock SetClientShake( index, Float:Amplitude, Float:Radius, Float:Duration, Float:Frequency )
{
        decl Float:ClientOrigin[ 3 ];
        new Ent = CreateEntityByName( "env_shake" );
               
        if( DispatchSpawn( Ent ) )
        {
                DispatchKeyValueFloat( Ent, "amplitude", Amplitude );
                DispatchKeyValueFloat( Ent, "radius", Radius );
                DispatchKeyValueFloat( Ent, "duration", Duration );
                DispatchKeyValueFloat( Ent, "frequency", Frequency );

                SetVariantString( "spawnflags 8" );
                AcceptEntityInput( Ent, "AddOutput" );
                AcceptEntityInput( Ent, "StartShake", index );
                GetClientAbsOrigin( index, ClientOrigin );
                TeleportEntity( Ent, ClientOrigin, NULL_VECTOR, NULL_VECTOR );
        }
}


stephen473 08-21-2020 13:59

Re: I need Help With one Plugin please
 
put smlib include your code.

PHP Code:

#include <smlib> 

and replace
PHP Code:

SetClientScreenFadeid625500100 ); 

to

PHP Code:

Client_ScreenFade(id6FFADE_IN625500100); 

and replace

PHP Code:

SetClientShakeid10.09000.010.040.0 ); 

to

PHP Code:

Client_Shake(idSHAKE_START10.040.010.0); 

also it would be better for you to speak english on your posts. otherwise you won't get help unless somebody make an effort to use translate like i did.

MasterWindowS 08-21-2020 17:18

Re: I need Help With one Plugin please
 
Quote:

Originally Posted by stephen473 (Post 2715035)
put smlib include your code.

PHP Code:

#include <smlib> 

and replace
PHP Code:

SetClientScreenFadeid625500100 ); 

to

PHP Code:

Client_ScreenFade(id6FFADE_IN625500100); 

and replace

PHP Code:

SetClientShakeid10.09000.010.040.0 ); 

to

PHP Code:

Client_Shake(idSHAKE_START10.040.010.0); 

also it would be better for you to speak english on your posts. otherwise you won't get help unless somebody make an effort to use translate like i did.

RedBull_css_csgo (1).sp
C:\Users\Paula\Downloads\RedBull_css_csgo (1).sp(3) : fatal error 183: cannot read from file: "smlib"
Done


I get this error, how could I solve it

stephen473 08-22-2020 14:08

Re: I need Help With one Plugin please
 
download the latest smlib from github . then put smlib.inc to your include folder

Bacardi 08-22-2020 14:14

Re: I need Help With one Plugin please
 
I tried remake plugin


https://forums.alliedmods.net/showth...66#post2715166


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

Powered by vBulletin®
Copyright ©2000 - 2021, vBulletin Solutions, Inc.