Raised This Month: $248 Target: $400
 62% 

Throwing Swords


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
MayroN
Senior Member
Join Date: Aug 2017
Location: Kyiv
Old 09-10-2020 , 15:16   Throwing Swords
Reply With Quote #1

1. Put the ability to Bots - do not throw swords - something is wrong ((

2. You need to somehow block the ability by pressing E - that is, you press E, there is a Bar strip, then you move the sight closer to you at a distance - writes No space for a Throw (but in this case, one Sword takes away)

How is it necessary to prohibit the taking of the Sword knifeammo [id]

3.And the kill with the Sword is triggered every time this touch with the player - that is, the sword flies through the player with a blunt sword, as if the player is transparent ... Maybe in Solid it is xs ..

Sorry - I can't throw off the full code as I asked, if there are nuances, then throw off the bits - but there are enough of them)))

PHP Code:
/////BOTS ABILITY TO THROW SWORDS


enum (+= 7564364)
{
    
TASK_BOT_USE_SKILL
}

#define ID_BOT_USE_SKILL (taskid - TASK_BOT_USE_SKILL)

public round_start() 
{
    
roundfreeze false
    kill_all_entity
("throwing_knife")
    
kill_all_entity("knife_pickup")

    for (new 
id=1id<33id++)
    {
        if (!
is_user_connected(id)) continue;
        if (
is_user_bot(id))
        {
            if (
task_exists(id+TASK_BOT_USE_SKILL)) remove_task(id+TASK_BOT_USE_SKILL)
            
set_task(float(random_num(20,30)), "bot_use_skill"id+TASK_BOT_USE_SKILL)
        }
    }
}

// bot use skill
public bot_use_skill(taskid)
{
    new 
id ID_BOT_USE_SKILL
    
if (!is_user_alive(id)) return;
    if (!
is_user_bot(id)) return;

        
command_knife(id)
        
    if (
task_exists(taskid)) remove_task(taskid)
    
set_task(float(random_num(20,30)), "bot_use_skill"id+TASK_BOT_USE_SKILL)
}

/////EXECUTING THE SHOT ON THE E KEY


public CmdStart(id)
{
    if(!
is_user_alive(id))
        return;
    
    static 
iButtoniButton pev(idpev_button)
    static 
iOldButtoniOldButton pev(idpev_oldbuttons)

    new 
FloatfOriginStart[3], FloatfOriginEnd[3], FloatfAngles[3], FloatfDist    

        
new weapon,clip,ammo
        weapon 
get_user_weapon(id,clip,ammo)

    if( ( 
iButton IN_USE ) && !( iOldButton IN_USE ) )
    {    
           if(
weapon == CSW_KNIFE
           {
        if(!
is_user_alive(id))
            return;

            
get_data_aim(idfOriginStartfOriginEndfAngles)
            
fDist get_distance_f(fOriginStartfOriginEnd)

            if(
fDist THROW_MIN_DIST)
            {
                           
client_print(idprint_center"No Sword Throwing Space
"
)

                   
message_begin(MSG_ONEgMsgBarTime_id)
                       
write_byte(0)
                       
write_byte(0)
                       
message_end()
                       return;
                }

            if(
knifeammo[id] == 0
                {
                           
client_print(idprint_center"No more Swords
"
knifeammo[id])

                   
message_begin(MSG_ONEgMsgBarTime_id)
                       
write_byte(0)
                       
write_byte(0)
                       
message_end()
                       return;
                }

                if(!
cs_get_user_shield(id))
                {
                       
knife_animation(id2"models/models_wc/v_knife.mdl")
                           
emit_sound(idCHAN_VOICEKNIFE_SOUND1.0ATTN_NORM0PITCH_NORM)
                }        

        
message_begin(MSG_ONEgMsgBarTime_id)
        
write_byte(get_pcvar_num(cvar_timeknife))
        
write_byte(0)
        
message_end()        
    
        
set_task(get_pcvar_float(cvar_timeknife), "command_knife"id+TASK_BARTIME)
       }
        }
    
    if( 
iOldButton IN_USE && !( iButton IN_USE ) )
        
set_task(0.1"knife_stop"id)
}

public 
knife_stop(id)
{    
    
message_begin(MSG_ONEgMsgBarTime_id)
    
write_byte(0)
    
write_byte(0)
    
message_end()
    
    
remove_task(id+TASK_BARTIME)
}

/////SWORD TOUCH FUNCTION WITH PLAYER


public vexd_pfntouch(pToucherpTouched
{
    if ( !
is_valid_ent(pToucher) ) return

    new 
Classname[32]
    
entity_get_string(pToucherEV_SZ_classnameClassname31)
    new 
owner entity_get_edict(pToucherEV_ENT_owner)
    new 
Float:kOrigin[3]
    
entity_get_vector(pToucherEV_VEC_originkOrigin)

    if(
equal(Classname,"knife_pickup")) {
        if ( !
is_valid_ent(pTouched) ) return
        
        new 
Class2[32]     
        
entity_get_string(pTouchedEV_SZ_classnameClass231)
        if(!
equal(Class2,"player") || knifeammo[pTouched] >= get_cvar_num("amx_maxknifeammo")) return

        if((
knifeammo[pTouched] + holdammo[owner]) > get_cvar_num("amx_maxknifeammo")) {
            
holdammo[owner] -= get_cvar_num("amx_maxknifeammo") - knifeammo[pTouched]
            
knifeammo[pTouched] = get_cvar_num("amx_maxknifeammo")
            
emit_sound(pTouchedCHAN_ITEMKNIFE_DEPLOY1.0ATTN_NORM0PITCH_NORM)
        }
        else {
            
knifeammo[pTouched] += holdammo[owner]
            
emit_sound(pTouchedCHAN_ITEMKNIFE_DEPLOY1.0ATTN_NORM0PITCH_NORM)
            
remove_entity(pToucher)
        }
    }

    else if(
equal(Classname,"throwing_knife")) {
        if(
is_user_alive(pTouched)) {
            new 
movetype entity_get_int(pToucherEV_INT_movetype)
            if(
movetype == && knifeammo[pTouched] < get_cvar_num("amx_maxknifeammo")) {
                if(
knifeammo[pTouched] < get_cvar_num("amx_maxknifeammo")) knifeammo[pTouched] += 1
                client_print
(pTouched,print_center,"Вы взяли Меч",knifeammo[pTouched])
                
emit_sound(pTouchedCHAN_ITEMKNIFE_DEPLOY1.0ATTN_NORM0PITCH_NORM)
                                
Give_Knife(pTouched)
                                
screen_fade(pTouched)
                
remove_entity(pToucher)
            }
            else if (
movetype != 0) {
                if(
owner == pTouched) return

                
remove_entity(pToucher)

                if(
get_cvar_num("mp_friendlyfire") == && get_user_team(pTouched) == get_user_team(owner)) return

                new 
pTdead[33]
                
entity_set_float(pTouchedEV_FL_dmg_takeget_cvar_num("amx_knifedmg") * 1.0)

                if((
get_user_health(pTouched) - get_cvar_num("amx_knifedmg")) <= 0) {
                    
pTdead[pTouched] = 1
                
}
                else {
                    
set_user_health(pTouchedget_user_health(pTouched) - get_cvar_num("amx_knifedmg"))
                }

                if(
get_user_team(pTouched) == get_user_team(owner)) {
                    new 
name[33]
                    
get_user_name(owner,name,32)
                }

                
emit_sound(pTouchedCHAN_ITEMKNIFE_HIT1.0ATTN_NORM0PITCH_NORM)

                if(
pTdead[pTouched]) {
                    if(
get_user_team(pTouched) == get_user_team(owner)) {
                        
set_user_frags(ownerget_user_frags(owner) - 1)
                    }
                    else {
                        
set_user_frags(ownerget_user_frags(owner) + 1)
                    }

                    new 
gmsgScoreInfo get_user_msgid("ScoreInfo")
                    new 
gmsgDeathMsg get_user_msgid("DeathMsg")

                    
set_msg_block(gmsgDeathMsg,BLOCK_ONCE)
                    
set_msg_block(gmsgScoreInfo,BLOCK_ONCE)
                    
user_kill(pTouched,1)

                    
message_begin(MSG_ALL,gmsgScoreInfo)
                    
write_byte(owner)
                    
write_short(get_user_frags(owner))
                    
write_short(get_user_deaths(owner))
                    
write_short(0)
                    
write_short(get_user_team(owner))
                    
message_end()

                    
message_begin(MSG_ALL,gmsgScoreInfo)
                    
write_byte(pTouched)
                    
write_short(get_user_frags(pTouched))
                    
write_short(get_user_deaths(pTouched))
                    
write_short(0)
                    
write_short(get_user_team(pTouched))
                    
message_end()

                    
message_begin(MSG_ALL,gmsgDeathMsg,{0,0,0},0)
                    
write_byte(owner)
                    
write_byte(pTouched)
                    
write_byte(0)
                    
write_string("knife")
                    
message_end()

                    new 
tknifelog[16]
                    if (
get_cvar_num("amx_tknifelog")) tknifelog "throwing_knife"
                    
else tknifelog "knife"

                    
new namea[32], authida[35], teama[32]
                    new 
namev[32], authidv[35], teamv[32]
                    
get_user_name(owner,namea,31)
                    
get_user_authid(owner,authida,34)
                    
get_user_team(owner,teama,31)
                    
get_user_name(pTouched,namev,31)
                    
get_user_authid(pTouched,authidv,34)
                    
get_user_team(pTouched,teamv,31)

                    
log_message("^"%s<%d><%s><%s>^" killed ^"%s<%d><%s><%s>^" with ^"%s^"",
                    
namea,get_user_userid(owner),authida,teama,namev,get_user_userid(pTouched),authidv,teamv,tknifelog)
                }
            }
        }
        else {
            
entity_set_int(pToucherEV_INT_movetype0)
        }
    }
}

/////FUNCTION OF THE SWORD FLIGHT


public command_knife(id
{
    
id -= TASK_BARTIME

    
if(!is_user_alive(id) || roundfreeze) return PLUGIN_HANDLED

    
if(get_cvar_num("amx_knifeautoswitch")) 
        {
        
knifeout[id] = true
        client_cmd
(id,"weapon_knife")
    }

    if(!
knifeammo[id]) client_print(id,print_center,"Больше нет Мечей",knifeammo[id])
    if(!
knifeout[id] || !knifeammo[id]) return PLUGIN_HANDLED

    
if(tossdelay[id] > get_gametime() - 0.5) return PLUGIN_HANDLED
    
else tossdelay[id] = get_gametime()

    
knifeammo[id]--

    if (
knifeammo[id] == 3) {
        
client_print(id,print_center,"Осталось %i Меча",knifeammo[id])
    }
    if (
knifeammo[id] == 2) {
        
client_print(id,print_center,"Осталось %i Меча",knifeammo[id])
    }
    if (
knifeammo[id] == 1) {
        
client_print(id,print_center,"Остался %i Меч",knifeammo[id])
    }
    if (
knifeammo[id] == 0) {
        
client_print(id,print_center,"Больше нет Мечей",knifeammo[id])
                
ExecuteHamB(Ham_Item_Deployget_pdata_cbase(idOFFSET_CURRENT_WEAPON))
    }

    new 
FloatfOriginStart[3], FloatfOriginEnd[3], FloatfAngles[3], FloatfVelocity[3], FloatfDistFloatAiming[3]
    
    
get_data_aim(idfOriginStartfOriginEndfAngles)
    
fDist get_distance_f(fOriginStartfOriginEnd)
    
    if(
fDist THROW_MIN_DIST)
    {
        new 
iEnt create_entity(DEFAULT_CLASSNAME)
        
entity_set_string(iEntEV_SZ_classname"throwing_knife")
        
entity_set_edict(iEntEV_ENT_ownerid)
        
entity_set_vector(iEntEV_VEC_originfOriginStart)
        
                
fAngles[0] -= 90
                entity_set_vector
(iEntEV_VEC_anglesfAngles)

        new 
Float:MinBox[3] = {-1.0, -1.0, -1.0}
            new 
Float:MaxBox[3] = {1.01.01.0}
            
entity_set_vector(iEntEV_VEC_minsMinBox)
            
entity_set_vector(iEntEV_VEC_maxsMaxBox)
        
entity_set_model(iEntKNIFE_MODEL)
        
entity_set_int(iEntEV_INT_movetype6)
        
entity_set_int(iEntEV_INT_solid1)
                
entity_set_float(iEntEV_FL_nextthinkget_gametime() + KNIFE_TIME )

                
set_task(0.1"knife_fire"iEnt 984154)
        
        for(new 
i3i++)
            
fVelocity[i] = (fOriginEnd[i] - fOriginStart[i]) * THROW_MUL_VELOCITY fDist
        
        entity_set_vector
(iEntEV_VEC_velocityfVelocity)
    
        
Aiming[0] = random_float(-255.0255.0)
        
Aiming[1] = random_float(-255.0255.0)
        
Aiming[2] = random_float(-255.0255.0)
                
        
set_pev(iEntpev_avelocityAiming)    
    }
    else
        
client_print(idprint_center"Нет пространства для броска Меча")
        
    return 
PLUGIN_HANDLED

__________________
• МультиМод CS • 83.222.97.124:27015

MayroN is offline
Send a message via ICQ to MayroN Send a message via Skype™ to MayroN
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Upplands Väsby, Sweden
Old 09-10-2020 , 18:13   Re: Throwing Swords
Reply With Quote #2

First off... WHAT!? I couldn't understand anything you just wrote.

Second...
Bruh
__________________

Last edited by Black Rose; 09-10-2020 at 18:14.
Black Rose is online now
MayroN
Senior Member
Join Date: Aug 2017
Location: Kyiv
Old 09-11-2020 , 10:14   Re: Throwing Swords
Reply With Quote #3

Quote:
Originally Posted by Black Rose View Post
Second...
Bruh
How does this relate to my request?
__________________
• МультиМод CS • 83.222.97.124:27015

MayroN is offline
Send a message via ICQ to MayroN Send a message via Skype™ to MayroN
Celena Luna
Senior Member
Join Date: Aug 2013
Location: Okinawa, Japan
Old 09-11-2020 , 13:58   Re: Throwing Swords
Reply With Quote #4

Quote:
Originally Posted by MayroN View Post
How does this relate to my request?
No Steam no Support is something everyone should know by now

Also, with semi code like that, how can we know which part you scew up and help detect that. You should do some debugging like put print text in all if-else to see if something return that you didn't intent it to be
__________________
My plugin:

Last edited by Celena Luna; 09-11-2020 at 14:07.
Celena Luna is offline
Reply


Thread Tools
Display Modes

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:24.


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