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

[req] Jailbreak Redball..


Post New Thread Reply   
 
Thread Tools Display Modes
saarthbhosale
Member
Join Date: Feb 2020
Old 04-19-2020 , 12:23   Re: [req] Jailbreak Redball..
Reply With Quote #11

Quote:
Originally Posted by Xalus View Post
Instead of glow, I added fire on the ball.
Looks better.

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <engine>
#include <fakemeta>
#include <hamsandwich>

#define redball_classname "redball_class"
#define redball_model "models/kickball/ball.mdl"
#define redball_firemodel "sprites/flame.spr"

new g_redball_menug_redball_firemodelid

public plugin_init()
{
    
register_plugin("[Jailbreak] Redball""1.0""xPaw / Xalus")

    
// Register: Clcmds
    
register_clcmd("say /redball""redball_clcmd")

    
// Register: Logevents
    
register_logevent("server_roundend"2"1=Round_End")

    
// Create global menu
    
g_redball_menu menu_create("\dJailbreak\r Red ball""redball_menu_handler")
    
menu_additem(g_redball_menu"Spawn ball")
    
menu_additem(g_redball_menu"Remove balls")
}
public 
plugin_precache()
{
    
precache_model(redball_model)
    
g_redball_firemodelid precache_model(redball_firemodel)
}

public 
server_roundend()
{
    
redball_remove()
}

public 
redball_clcmd(client)
{
    if( (
is_user_alive(client) && cs_get_user_team(client) == CS_TEAM_CT)
        || 
is_user_admin(client) )
    {
        
menu_display(clientg_redball_menu)
    }
    return 
PLUGIN_HANDLED
}

public 
redball_menu_handler(clientmenuitem)
{
    if( 
item != MENU_EXIT
        
&& (is_user_alive(client) || is_user_admin(client)) )
    {
        if(!
item)
        {
            
redball_spawn(client)
            return
        }
        
redball_remove(client)
    }
}
redball_remove(client 0)
{
    
remove_entity_name(redball_classname)

    if(
client)
    {
        new 
client_name[32]
        
get_user_name(clientclient_namecharsmax(client_name))
        
client_print(0print_chat">Jailbreak> %s removed all redballs."client_name)
    }
}

redball_spawn(client)
{
    new 
ball_entity create_entity("info_target")
    if(
is_valid_ent(ball_entity))
    {
        
entity_set_string(ball_entityEV_SZ_classnameredball_classname)
        
entity_set_int(ball_entityEV_INT_solidSOLID_BBOX)
        
entity_set_int(ball_entityEV_INT_movetypeMOVETYPE_BOUNCE)
        
entity_set_float(ball_entityEV_FL_health300.0)
        
entity_set_float(ball_entityEV_FL_takedamage1.0)
        
entity_set_model(ball_entityredball_model)
        
entity_set_size(ball_entityFloat:{-15.0, -15.00.0}, Float:{15.015.012.0})

        new 
client_aimorigin[3], Float:ball_origin[3]
        
get_user_origin(clientclient_aimorigin3)

        
client_aimorigin[2] += 10
        IVecFVec
(client_aimoriginball_origin)

        
entity_set_origin(ball_entityball_origin)
        
entity_set_vector(ball_entityEV_VEC_velocityFloat:{0.00.00.0})

        new 
client_name[32]
        
get_user_name(clientclient_namecharsmax(client_name))
        
client_print(0print_chat">Jailbreak> %s spawned a redball."client_name)

        
// Register stuff
        
RegisterHamFromEntity(Ham_Touchball_entity"redball_touch"1)
        
RegisterHamFromEntity(Ham_TakeDamageball_entity"redball_damage"0)
        
RegisterHamFromEntity(Ham_Thinkball_entity"redball_think"0)

        
entity_set_float(ball_entityEV_FL_nextthinkget_gametime( ) + 0.05)
    }
}
public 
redball_think(ball_entity)
{
    if(
is_valid_ent(ball_entity))
    {
        
entity_set_float(ball_entityEV_FL_nextthinkget_gametime( ) + 0.05)

        new 
Float:ball_origin[3]
        
entity_get_vector(ball_entityEV_VEC_originball_origin)

        new 
Float:flRand random_float(1.05.0);

        
message_begin(MSG_BROADCASTSVC_TEMPENTITY);
        
write_byte(TE_SPRITE);
        
engfunc(EngFunc_WriteCoordball_origin[0]); // Position
        
engfunc(EngFunc_WriteCoordball_origin[1]);
        
engfunc(EngFunc_WriteCoordball_origin[2] + flRand 5.0// 120;
        
write_short(g_redball_firemodelid);    // Sprite index
        
write_byte(floatround(flRand));        // Scale
        
write_byte(50);        // Brightness
        
message_end();
    }
}
public 
redball_touch(ball_entityclient)
{
    if(
is_valid_ent(ball_entity))
    {
        if(
is_user_alive(client) )
        {
            if(
cs_get_user_team(client) == CS_TEAM_CT)
            {
                
redball_kick(ball_entityclient2000)
                return
            }

            
redball_kick(ball_entityclient550)
            
user_kill(client)
            return
        }

        new 
Float:ball_velocity[3]
        
entity_get_vector(ball_entityEV_VEC_velocityball_velocity)

        if(
floatroundvector_lengthball_velocity ) ) > 10)
        {
            
ball_velocity[0] *= 0.90;
            
ball_velocity[1] *= 0.90;
            
ball_velocity[2] *= 0.90;

            
entity_set_vector(ball_entityEV_VEC_velocityball_velocity)
        }
    }
}

public 
redball_damage(ball_entityinflictorattackerFloat:damagedamagebits)
{
    if( 
is_valid_ent(ball_entity)
        && 
is_user_alive(attacker) )
    {
        new 
Float:ball_health entity_get_float(ball_entityEV_FL_health)
        if(
ball_health >= 0.0
            
&& (ball_health damage) <= 0.0)
        {
            new 
client_name[32]
            
get_user_name(attackerclient_namecharsmax(client_name))
            
client_print(0print_chat">Jailbreak> %s killed the redball."client_name)
            return
        }
        
redball_kick(ball_entityattacker500)
    }
}

redball_kick(ball_entityclientpower)
{
    new 
Float:ball_origin[3], Float:ball_velocity[3]
    
entity_get_vector(ball_entityEV_VEC_originball_origin)
    
velocity_by_aim(clientpowerball_velocity)
    
ball_velocity[2] += 30.0
    entity_set_vector
(ball_entityEV_VEC_velocityball_velocity)

Nice one Thank you for this plugin!

Last edited by saarthbhosale; 04-19-2020 at 12:48.
saarthbhosale 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 13:45.


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