Raised This Month: $ Target: $400
 0% 

[HELP] Remove fire trail of Syn jetpack


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
tauber
Junior Member
Join Date: Nov 2009
Old 01-25-2016 , 11:23   [HELP] Remove fire trail of Syn jetpack
Reply With Quote #1

Hi! Help me please to remove fire effect behind the player.
Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <cstrike>
#include <engine>

new SPRITE_MODEL[]     = "sprites/explode1.spr"
new JETPACK_PMODEL[]     = "models/p_longjump.mdl"
new JETPACK_GOTSOUND[]     = "items/ammopickup2.wav"

new cvar_cost
new cvar_thrust
new cvar_min_speed
new cvar_max_speed

new sprite_fire

new g_HasJetpack[33]
new g_JetpackEnt[33]

static const PLUGIN_NAME[]     = "SyN Surf Jetpack"
static const PLUGIN_AUTHOR[]     = "Cheap_Suit"
static const PLUGIN_VERSION[]    = "1.4"

public plugin_init()
{
    new mapName[33]
    get_mapname(mapName, 32)
    
    if(!equali(mapName, "surf_", 5))
    {
        new pluginName[33]
        format(pluginName, 32, "[Disabled] %s", PLUGIN_NAME)
        register_plugin(pluginName, PLUGIN_VERSION, PLUGIN_AUTHOR)
        pause("ade")
    }
    else
    {
        register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)
        register_cvar(PLUGIN_NAME, PLUGIN_VERSION, FCVAR_SPONLY|FCVAR_SERVER)
        
        register_clcmd("sjp_givesj" ,         "cmd_GiveSJ",         ADMIN_IMMUNITY, "<userid> - Gives free surf jetpack")
        register_clcmd("sjp_stripsj" ,         "cmd_StripSJ",         ADMIN_IMMUNITY, "<userid> - Strips users surf jetpack")
        
        register_clcmd("say /buyjetpack",     "cmd_BuySurfJetpack", 0, "Buys surf jetpack")
        register_clcmd("say buy_jetpack",     "cmd_BuySurfJetpack", 0, "Buys surf jetpack")
        register_concmd("buy_jetpack",         "cmd_BuySurfJetpack", 0, "Buys surf jetpack")
        register_concmd("buyjetpack",         "cmd_BuySurfJetpack", 0, "Buys surf jetpack")
        
        cvar_cost    = register_cvar("sjp_cost", "5000")
        cvar_thrust     = register_cvar("sjp_thrust", "10")
        cvar_min_speed     = register_cvar("sjp_min_speed", "400")
        cvar_max_speed     = register_cvar("sjp_max_speed", "1200")
        
        register_event("DeathMsg",         "Event_DeathMsg", "a")
    }
}

public plugin_precache()
{
    sprite_fire = precache_model(SPRITE_MODEL)
    precache_sound(JETPACK_GOTSOUND)
    precache_model(JETPACK_PMODEL)
}

public client_connect(id)
{
    g_HasJetpack[id] = 0
    _removeJetpackEnt(id)
}
    
public client_disconnect(id)
{
    g_HasJetpack[id] = 0
    _removeJetpackEnt(id)
}

public Event_DeathMsg()
{
    new id = read_data(2)

    g_HasJetpack[id] = 0
    _removeJetpackEnt(id)

    return PLUGIN_CONTINUE
}

public cmd_BuySurfJetpack(id)
{
    new iMoney = cs_get_user_money(id)
    new iCost = get_pcvar_num(cvar_cost)
    
    if(!is_user_alive(id)) 
        client_print(id, print_center, "You cant buy when your dead!")
    else if(g_HasJetpack[id])
        client_print(id, print_center, "You already own a surf jetpack.")
    else if(iMoney < iCost)
        client_print(id, print_center, "Insufficient funds! ($%d)", iCost)
    else
    {
        _give_Jetpack(id)
        cs_set_user_money(id, iMoney - iCost, 1)
      }
    return PLUGIN_HANDLED
}

public cmd_GiveSJ(id , level , cid) 
{
    if(!cmd_access(id , level , cid , 2))
        return PLUGIN_HANDLED
        
    new arg1[33]
    read_argv(1 , arg1 , 32)

    new target = cmd_target(id , arg1 , 0)
    if(!is_user_connected(target))
    {
        console_print(id, "Player does not exist")
        return PLUGIN_HANDLED
    }

    if(g_HasJetpack[target])
    {
        console_print(id, "Player already has a surf jetpack")
        return PLUGIN_HANDLED
    }
    
    _give_Jetpack(target)

    new Name[33], Name2[33]
    get_user_name(id, Name, 32)
    get_user_name(target, Name2, 32)
    
    console_print(id, "You gave %s a surf jetpack", Name2)
    client_print(target, print_chat, "ADMIN: %s gave you a surf jetpack", Name)
    
    return PLUGIN_HANDLED
}

public cmd_StripSJ(id , level , cid) 
{
    if(!cmd_access(id , level , cid , 2))
        return PLUGIN_HANDLED
        
    new arg1[33]
    read_argv(1 , arg1 , 32)

    new target = cmd_target(id , arg1 , 0)
    if(!is_user_connected(target))
    {
        console_print(id, "Player does not exist")
        return PLUGIN_HANDLED
    }

    if(!g_HasJetpack[target])
    {
        console_print(id, "Player does not have a surf jetpack")
        return PLUGIN_HANDLED
    }
    
    g_HasJetpack[id] = 0
    _removeJetpackEnt(id)

    new Name[33], Name2[33]
    get_user_name(id, Name, 32)
    get_user_name(target, Name2, 32)
    
    console_print(id, "You stripped %s a surf jetpack", Name2)
    client_print(target, print_chat, "ADMIN: %s stripped your surf jetpack", Name)
    
    return PLUGIN_HANDLED
}

public _give_Jetpack(id)
{
    g_HasJetpack[id] = 1
    client_cmd(id, "spk %s", JETPACK_GOTSOUND)
    client_print(id, print_chat, "You've got a surf jetpack! :: HOW TO USE :: ~ Just Surf ~ ")
    
    if(g_JetpackEnt[id] < 1)
    {
        g_JetpackEnt[id] = create_entity("info_target")
        if(is_valid_ent(g_JetpackEnt[id]))
        {
            entity_set_model(g_JetpackEnt[id], JETPACK_PMODEL)
            entity_set_int(g_JetpackEnt[id], EV_INT_movetype, MOVETYPE_FOLLOW)
            entity_set_edict(g_JetpackEnt[id], EV_ENT_aiment, id)
        }
    }
}

public _removeJetpackEnt(id)
{
    if(g_JetpackEnt[id] > 0)
        remove_entity(g_JetpackEnt[id])
    g_JetpackEnt[id] = 0
}

public client_PreThink(id)
{
    if(!is_user_alive(id) || !g_HasJetpack[id])
        return PLUGIN_CONTINUE
        
    if(get_user_speed(id) < get_pcvar_num(cvar_min_speed))
        return PLUGIN_CONTINUE    
        
    new Button = get_user_button(id)
    if(Button & IN_MOVELEFT || Button & IN_MOVERIGHT)
    {        
        _jetEffect(id)    
        _jetThrust(id)
    }
    return PLUGIN_CONTINUE
}

public _jetThrust(id)
{    
    new Float:fVelocity[3]
    entity_get_vector(id, EV_VEC_velocity, fVelocity)

    new Float:fAngle[3]
    entity_get_vector(id, EV_VEC_angles, fAngle)
    engfunc(EngFunc_MakeVectors, fAngle)
                
    new Float:fForward[3]
    get_global_vector(GL_v_forward, fForward)
                
    fVelocity[0] += fForward[0] * get_pcvar_num(cvar_thrust)
    fVelocity[1] += fForward[1] * get_pcvar_num(cvar_thrust)
            
    if(get_user_speed(id) < get_pcvar_num(cvar_max_speed))
        entity_set_vector(id, EV_VEC_velocity, fVelocity)
        
    return PLUGIN_CONTINUE
}

public _jetEffect(id)
{    
    new iOrigin[3]
    get_user_origin(id, iOrigin, 0)
    
    message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
    write_byte(17)
    write_coord(iOrigin[0])
    write_coord(iOrigin[1])
    write_coord(iOrigin[2])
    write_short(sprite_fire)
    write_byte(10)
    write_byte(115)
    message_end()
    
    entity_set_int(id , EV_INT_gaitsequence , 8)
}

stock get_user_speed(id)
{
    new Float:fVelocity[3]
    entity_get_vector(id, EV_VEC_velocity, fVelocity)
    
    new iVelocity[3]
    FVecIVec(fVelocity, iVelocity)
    
    new iVelocity0 = iVelocity[0] * iVelocity[0]
    new iVelocity1 = iVelocity[1] * iVelocity[1]
    
    return sqroot(iVelocity0 + iVelocity1)
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/
tauber is offline
JusTGo
Veteran Member
Join Date: Mar 2013
Old 01-25-2016 , 12:37   Re: [HELP] Remove fire trail of Syn jetpack
Reply With Quote #2

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

new JETPACK_PMODEL[]     = "models/p_longjump.mdl"
new JETPACK_GOTSOUND[]     = "items/ammopickup2.wav"

new cvar_cost
new cvar_thrust
new cvar_min_speed
new cvar_max_speed

new g_HasJetpack[33]
new 
g_JetpackEnt[33]

static const 
PLUGIN_NAME[]     = "SyN Surf Jetpack"
static const PLUGIN_AUTHOR[]     = "Cheap_Suit"
static const PLUGIN_VERSION[]    = "1.4"

public plugin_init()
{
    new 
mapName[33]
    
get_mapname(mapName32)
    
    if(!
equali(mapName"surf_"5))
    {
        new 
pluginName[33]
        
format(pluginName32"[Disabled] %s"PLUGIN_NAME)
        
register_plugin(pluginNamePLUGIN_VERSIONPLUGIN_AUTHOR)
        
pause("ade")
    }
    else
    {
        
register_plugin(PLUGIN_NAMEPLUGIN_VERSIONPLUGIN_AUTHOR)
        
register_cvar(PLUGIN_NAMEPLUGIN_VERSIONFCVAR_SPONLY|FCVAR_SERVER)
        
        
register_clcmd("sjp_givesj" ,         "cmd_GiveSJ",         ADMIN_IMMUNITY"<userid> - Gives free surf jetpack")
        
register_clcmd("sjp_stripsj" ,         "cmd_StripSJ",         ADMIN_IMMUNITY"<userid> - Strips users surf jetpack")
        
        
register_clcmd("say /buyjetpack",     "cmd_BuySurfJetpack"0"Buys surf jetpack")
        
register_clcmd("say buy_jetpack",     "cmd_BuySurfJetpack"0"Buys surf jetpack")
        
register_concmd("buy_jetpack",         "cmd_BuySurfJetpack"0"Buys surf jetpack")
        
register_concmd("buyjetpack",         "cmd_BuySurfJetpack"0"Buys surf jetpack")
        
        
cvar_cost    register_cvar("sjp_cost""5000")
        
cvar_thrust     register_cvar("sjp_thrust""10")
        
cvar_min_speed     register_cvar("sjp_min_speed""400")
        
cvar_max_speed     register_cvar("sjp_max_speed""1200")
        
        
register_event("DeathMsg",         "Event_DeathMsg""a")
    }
}

public 
plugin_precache()
{
    
precache_sound(JETPACK_GOTSOUND)
    
precache_model(JETPACK_PMODEL)
}

public 
client_connect(id)
{
    
g_HasJetpack[id] = 0
    _removeJetpackEnt
(id)
}
    
public 
client_disconnect(id)
{
    
g_HasJetpack[id] = 0
    _removeJetpackEnt
(id)
}

public 
Event_DeathMsg()
{
    new 
id read_data(2)

    
g_HasJetpack[id] = 0
    _removeJetpackEnt
(id)

    return 
PLUGIN_CONTINUE
}

public 
cmd_BuySurfJetpack(id)
{
    new 
iMoney cs_get_user_money(id)
    new 
iCost get_pcvar_num(cvar_cost)
    
    if(!
is_user_alive(id)) 
        
client_print(idprint_center"You cant buy when your dead!")
    else if(
g_HasJetpack[id])
        
client_print(idprint_center"You already own a surf jetpack.")
    else if(
iMoney iCost)
        
client_print(idprint_center"Insufficient funds! ($%d)"iCost)
    else
    {
        
_give_Jetpack(id)
        
cs_set_user_money(idiMoney iCost1)
      }
    return 
PLUGIN_HANDLED
}

public 
cmd_GiveSJ(id level cid
{
    if(!
cmd_access(id level cid 2))
        return 
PLUGIN_HANDLED
        
    
new arg1[33]
    
read_argv(arg1 32)

    new 
target cmd_target(id arg1 0)
    if(!
is_user_connected(target))
    {
        
console_print(id"Player does not exist")
        return 
PLUGIN_HANDLED
    
}

    if(
g_HasJetpack[target])
    {
        
console_print(id"Player already has a surf jetpack")
        return 
PLUGIN_HANDLED
    
}
    
    
_give_Jetpack(target)

    new 
Name[33], Name2[33]
    
get_user_name(idName32)
    
get_user_name(targetName232)
    
    
console_print(id"You gave %s a surf jetpack"Name2)
    
client_print(targetprint_chat"ADMIN: %s gave you a surf jetpack"Name)
    
    return 
PLUGIN_HANDLED
}

public 
cmd_StripSJ(id level cid
{
    if(!
cmd_access(id level cid 2))
        return 
PLUGIN_HANDLED
        
    
new arg1[33]
    
read_argv(arg1 32)

    new 
target cmd_target(id arg1 0)
    if(!
is_user_connected(target))
    {
        
console_print(id"Player does not exist")
        return 
PLUGIN_HANDLED
    
}

    if(!
g_HasJetpack[target])
    {
        
console_print(id"Player does not have a surf jetpack")
        return 
PLUGIN_HANDLED
    
}
    
    
g_HasJetpack[id] = 0
    _removeJetpackEnt
(id)

    new 
Name[33], Name2[33]
    
get_user_name(idName32)
    
get_user_name(targetName232)
    
    
console_print(id"You stripped %s a surf jetpack"Name2)
    
client_print(targetprint_chat"ADMIN: %s stripped your surf jetpack"Name)
    
    return 
PLUGIN_HANDLED
}

public 
_give_Jetpack(id)
{
    
g_HasJetpack[id] = 1
    client_cmd
(id"spk %s"JETPACK_GOTSOUND)
    
client_print(idprint_chat"You've got a surf jetpack! :: HOW TO USE :: ~ Just Surf ~ ")
    
    if(
g_JetpackEnt[id] < 1)
    {
        
g_JetpackEnt[id] = create_entity("info_target")
        if(
is_valid_ent(g_JetpackEnt[id]))
        {
            
entity_set_model(g_JetpackEnt[id], JETPACK_PMODEL)
            
entity_set_int(g_JetpackEnt[id], EV_INT_movetypeMOVETYPE_FOLLOW)
            
entity_set_edict(g_JetpackEnt[id], EV_ENT_aimentid)
        }
    }
}

public 
_removeJetpackEnt(id)
{
    if(
g_JetpackEnt[id] > 0)
        
remove_entity(g_JetpackEnt[id])
    
g_JetpackEnt[id] = 0
}

public 
client_PreThink(id)
{
    if(!
is_user_alive(id) || !g_HasJetpack[id])
        return 
PLUGIN_CONTINUE
        
    
if(get_user_speed(id) < get_pcvar_num(cvar_min_speed))
        return 
PLUGIN_CONTINUE    
        
    
new Button get_user_button(id)
    if(
Button IN_MOVELEFT || Button IN_MOVERIGHT)
    {           
        
_jetThrust(id)
    }
    return 
PLUGIN_CONTINUE
}

public 
_jetThrust(id)
{    
    new 
Float:fVelocity[3]
    
entity_get_vector(idEV_VEC_velocityfVelocity)

    new 
Float:fAngle[3]
    
entity_get_vector(idEV_VEC_anglesfAngle)
    
engfunc(EngFunc_MakeVectorsfAngle)
                
    new 
Float:fForward[3]
    
get_global_vector(GL_v_forwardfForward)
                
    
fVelocity[0] += fForward[0] * get_pcvar_num(cvar_thrust)
    
fVelocity[1] += fForward[1] * get_pcvar_num(cvar_thrust)
            
    if(
get_user_speed(id) < get_pcvar_num(cvar_max_speed))
        
entity_set_vector(idEV_VEC_velocityfVelocity)
        
    return 
PLUGIN_CONTINUE
}

stock get_user_speed(id)
{
    new 
Float:fVelocity[3]
    
entity_get_vector(idEV_VEC_velocityfVelocity)
    
    new 
iVelocity[3]
    
FVecIVec(fVelocityiVelocity)
    
    new 
iVelocity0 iVelocity[0] * iVelocity[0]
    new 
iVelocity1 iVelocity[1] * iVelocity[1]
    
    return 
sqroot(iVelocity0 iVelocity1)
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/ 
__________________
JusTGo is offline
tauber
Junior Member
Join Date: Nov 2009
Old 01-25-2016 , 12:50   Re: [HELP] Remove fire trail of Syn jetpack
Reply With Quote #3

compiled without errors, but server won't start..
tauber is offline
JusTGo
Veteran Member
Join Date: Mar 2013
Old 01-25-2016 , 13:51   Re: [HELP] Remove fire trail of Syn jetpack
Reply With Quote #4

Quote:
Originally Posted by tauber View Post
compiled without errors, but server won't start..
what are the errors does it start with out the plugin enabled ?
__________________
JusTGo is offline
tauber
Junior Member
Join Date: Nov 2009
Old 01-25-2016 , 14:49   Re: [HELP] Remove fire trail of Syn jetpack
Reply With Quote #5

in the log file only this: L 01/25/2016 - 20:25:49: -------- Mapchange to surf_green --------

it does start with original plugin
tauber is offline
tauber
Junior Member
Join Date: Nov 2009
Old 01-25-2016 , 19:39   Re: [HELP] Remove fire trail of Syn jetpack
Reply With Quote #6

Quote:
Originally Posted by JusTGo View Post
what are the errors does it start with out the plugin enabled ?
Sorry, it works just fine. Thank you very much.
tauber 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 09:23.


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