Raised This Month: $ Target: $400
 0% 

Need scripters help!!


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
joblessuser
Member
Join Date: May 2013
Old 09-24-2013 , 08:42   Need scripters help!!
Reply With Quote #1

This Plugin count kills and shows in sprite. This program is actually counting the kill as KPD(kills per death) i.e., it count the kills until player dead even after round end it continues to next round if player survive the last round. But i want to count the kill as KPR(kill per round) i.e., i need it to count the kills for rounds and for the next round kills count to be reset.

note: I'm not taking about Team score reset. It should not be reset. This is for clan server.
Death Sprite Effect
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fakemeta>
#include <dhudmessage>

new knife_killgrenade_killheadshotnormal_kill

new level[32]
new 
bool:kills[32]

new 
one_kill
new two_kill
new three_kill
new four_kill
new five_kill
new six_kill
new seven_kill
new eight_kill
new more_than_eight_kill
new g_lastkill
new g_firstblood

public plugin_precache()
{
        
headshot precache_model("sprites/headshot.spr")
        
knife_kill precache_model("sprites/knife_kill.spr")
        
grenade_kill precache_model("sprites/grenade_kill.spr")
        
one_kill precache_model("sprites/1_kill.spr")
        
two_kill precache_model("sprites/2_kill.spr")
        
three_kill precache_model("sprites/3_kill.spr")
        
four_kill precache_model("sprites/4_kill.spr")
        
five_kill precache_model("sprites/5_kill.spr")
        
six_kill precache_model("sprites/6_kill.spr")
        
seven_kill precache_model("sprites/7_kill.spr")
        
eight_kill precache_model("sprites/8_kill.spr")
        
more_than_eight_kill precache_model("sprites/more_than_8_kill.spr")
        
normal_kill precache_model("sprites/normal_kill.spr")
    
precache_sound("misc/headshot.wav")
        
precache_sound("misc/knife_kill.wav")
        
precache_sound("misc/grenade_kill.wav")
        
precache_sound("misc/wallshot.wav")
        
precache_sound("misc/1_kill.wav")
        
precache_sound("misc/2_kill.wav")
        
precache_sound("misc/3_kill.wav")
        
precache_sound("misc/4_kill.wav")
        
precache_sound("misc/5_kill.wav")
        
precache_sound("misc/6_kill.wav")
        
precache_sound("misc/7_kill.wav")
        
precache_sound("misc/8_kill.wav")
        
precache_sound("misc/firstblood.wav")
        
precache_sound("misc/last_kill.wav")
        
precache_sound("misc/unstoppable.wav")
}

public 
plugin_init()
{
    
register_plugin("Death Sprite Effect","1.5","RaZzoR")
        
register_event("DeathMsg","onDeath","a")
        
register_event("DeathMsg","onDeath_level","a")
        
register_event("TextMsg""eRestart""a""2&#Game_C""2&#Game_w")
    
register_event("SendAudio""eEndRound""a""2&%!MRAD_terwin""2&%!MRAD_ctwin""2&%!MRAD_rounddraw")
    
register_event("RoundTime""eNewRound""bc")
}

public 
eNewRound()
{
    if (
read_data(1) == floatround(get_cvar_float("mp_roundtime") * 60.0,floatround_floor))
    {
        
g_firstblood 1
    
}
}

public 
eRestart()
{
    
eEndRound()
    
g_firstblood 1
}

public 
eEndRound()
{

}

public 
client_disconnect(id)
{
    
level[id]= 0
}
public 
client_putinserver(id)
{
    
level[id]= 0
}

public 
onDeath()
{
        new 
name_attacker[32]
    new 
name_victim[32]
        new 
wpn[3]
        new 
hs read_data(3)
        new 
attacker read_data(1)
        new 
victim read_data(2)

        
get_user_name(attackername_attacker31)
    
get_user_name(victimname_victim31)
        
read_data(4,wpn,2)
    
        if (
wpn[0] != 'k' && wpn[1] != 'r' && !can_see_fm(attackervictim)) 
    {
        if (
hs)
                {
                  
set_dhudmessage(25500, -1.00.2006.03.00.11.5
              
show_dhudmessage(attacker"WALL OVER HS!^n-|YES! :D|-")
                  
client_cmd(attacker,"spk misc/headshot")
                }
        else 
                {
                  
set_dhudmessage(098139, -1.00.2506.03.00.11.5
              
show_dhudmessage(attacker"WALLSHOT!")
                  
client_cmd(attacker,"spk misc/wallshot")
                } 
    }
        else if (
hs && wpn[0] != 'k' && wpn[1] != 'r')
    {
        
show_sprite(victimheadshot)
                
client_cmd(attacker,"spk misc/headshot")   
    }
        else if (
wpn[0] == 'k')
        {
            
show_sprite(victimknife_kill)
                
client_cmd(attacker,"spk misc/knife_kill")
        }
        else if (
wpn[1] == 'r')
        {
            
show_sprite(victimgrenade_kill)
                
client_cmd(attacker,"spk misc/grenade_kill")
        }
        else
        {  
                
show_sprite(victimnormal_kill)
        }

        return 
PLUGIN_CONTINUE
}

public 
onDeath_level()
{
        new 
players_ct[32], players_t[32], ictite
    get_players
(players_ct,ict,"ae","CT")   
    
get_players(players_t,ite,"ae","TERRORIST")
    if (
ict == || ite == 0g_lastkill 1
        
        
new attacker read_data(1)
        new 
victim read_data(2)
        new 
name_attacker[32]
    new 
name_victim[32]

        
level[attacker] += 1
    level
[victim]= 0

        get_user_name
(attackername_attacker31)
    
get_user_name(victimname_victim31)

        if((
victim == attacker) || (get_user_team(attacker) == get_user_team(victim)) || !victim || !attacker)
            return 
PLUGIN_CONTINUE
       


        
if (g_firstblood && attacker!=victim && attacker>0
    {    
                 
g_firstblood 0            
         set_dhudmessage
(255105180, -1.00.3506.03.00.11.5
         
show_dhudmessage(0"FIRST BLOOD: ^n %s KILLED %s!"name_attackername_victim)
         
client_cmd(0"speak misc/firstblood")
    }
        if (
g_lastkill == 1)
    {
        
g_lastkill 0
                set_dhudmessage
(2552150, -1.00.3006.03.00.11.5
        
show_dhudmessage(0"LAST KILL: ^n %s KILLED %s!"name_attackername_victim)
        
client_cmd(0"speak misc/last_kill")
    }  
        if (
level[attacker] == 1)
        {
            
show_sprite(victimone_kill)
                
kills[victim] = true
                client_cmd
(attacker,"spk misc/1_kill")    
        
    }
        if (
level[attacker] == 2)
        {
            
show_sprite(victimtwo_kill)
                
kills[victim] = true
                client_cmd
(attacker,"spk misc/2_kill")        
        
    }
        if (
level[attacker] == 3)
        {
            
show_sprite(victimthree_kill)
                
kills[victim] = true
                client_cmd
(attacker,"spk misc/3_kill")        
        
    }
        if (
level[attacker] == 4)
        {
            
show_sprite(victimfour_kill)
                
kills[victim] = true
                client_cmd
(attacker,"spk misc/4_kill")        
        
    }
        if (
level[attacker] == 5)
        {
            
show_sprite(victimfive_kill)
                
kills[victim] = true
                client_cmd
(attacker,"spk misc/5_kill")         
        
    }
        if (
level[attacker] == 6)
        {
            
show_sprite(victimsix_kill)
                
kills[victim] = true
                client_cmd
(attacker,"spk misc/6_kill")         
        
    }
        if (
level[attacker] == 7)
        {
            
show_sprite(victimseven_kill)
                
kills[victim] = true
                client_cmd
(attacker,"spk misc/7_kill")         
        
    }
        if (
level[attacker] == 8)
        {
            
show_sprite(victimeight_kill)
                
kills[victim] = true
                client_cmd
(attacker,"spk misc/8_kill")        
        
    }
        if (
level[attacker] > 8)
        {
            
show_sprite(victimmore_than_eight_kill)
                
kills[victim] = true
                client_cmd
(attacker,"spk misc/unstoppable")        
        
    }
         
        return 
PLUGIN_CONTINUE
}

public 
show_sprite(attackersprite)
{    
        if(!
is_user_connected(attacker))
        return 
PLUGIN_CONTINUE



    
static origin[3]
    
get_user_origin(attackerorigin)
    
        
message_begin(MSG_PVSSVC_TEMPENTITYorigin)
    
write_byte(TE_SPRITE)
    
write_coord(origin[0])
    
write_coord(origin[1])
    
write_coord(origin[2]+65)
    
write_short(sprite)
    
write_byte(10)
    
write_byte(250)
    
message_end()
        
        return 
PLUGIN_CONTINUE
}

public 
podesi_boolove(id)
{    
    
kills[id] = false
}

bool:can_see_fm(entindex1entindex2)
{
    if (!
entindex1 || !entindex2)
        return 
false

    
if (pev_valid(entindex1) && pev_valid(entindex1))
    {
        new 
flags pev(entindex1pev_flags)
        if (
flags EF_NODRAW || flags FL_NOTARGET)
        {
            return 
false
        
}

        new 
Float:lookerOrig[3]
        new 
Float:targetBaseOrig[3]
        new 
Float:targetOrig[3]
        new 
Float:temp[3]

        
pev(entindex1pev_originlookerOrig)
        
pev(entindex1pev_view_ofstemp)
        
lookerOrig[0] += temp[0]
        
lookerOrig[1] += temp[1]
        
lookerOrig[2] += temp[2]

        
pev(entindex2pev_origintargetBaseOrig)
        
pev(entindex2pev_view_ofstemp)
        
targetOrig[0] = targetBaseOrig [0] + temp[0]
        
targetOrig[1] = targetBaseOrig [1] + temp[1]
        
targetOrig[2] = targetBaseOrig [2] + temp[2]

        
engfunc(EngFunc_TraceLinelookerOrigtargetOrig0entindex10//  checks the had of seen player
        
if (get_tr2(0TraceResult:TR_InOpen) && get_tr2(0TraceResult:TR_InWater))
        {
            return 
false
        

        else 
        {
            new 
Float:flFraction
            get_tr2
(0TraceResult:TR_flFractionflFraction)
            if (
flFraction == 1.0 || (get_tr2(0TraceResult:TR_pHit) == entindex2))
            {
                return 
true
            
}
            else
            {
                
targetOrig[0] = targetBaseOrig [0]
                
targetOrig[1] = targetBaseOrig [1]
                
targetOrig[2] = targetBaseOrig [2]
                
engfunc(EngFunc_TraceLinelookerOrigtargetOrig0entindex10//  checks the body of seen player
                
get_tr2(0TraceResult:TR_flFractionflFraction)
                if (
flFraction == 1.0 || (get_tr2(0TraceResult:TR_pHit) == entindex2))
                {
                    return 
true
                
}
                else
                {
                    
targetOrig[0] = targetBaseOrig [0]
                    
targetOrig[1] = targetBaseOrig [1]
                    
targetOrig[2] = targetBaseOrig [2] - 17.0
                    engfunc
(EngFunc_TraceLinelookerOrigtargetOrig0entindex10//  checks the legs of seen player
                    
get_tr2(0TraceResult:TR_flFractionflFraction)
                    if (
flFraction == 1.0 || (get_tr2(0TraceResult:TR_pHit) == entindex2))
                    {
                        return 
true
                    
}
                }
            }
        }
    }
    return 
false

joblessuser is offline
~Ice*shOt
Veteran Member
Join Date: Mar 2009
Location: Lithuania
Old 09-24-2013 , 09:53   Re: Need scripters help!!
Reply With Quote #2

level[id] = 0 put this in round start
~Ice*shOt is offline
Send a message via Skype™ to ~Ice*shOt
joblessuser
Member
Join Date: May 2013
Old 09-24-2013 , 11:14   Re: Need scripters help!!
Reply With Quote #3

Quote:
Originally Posted by ~Ice*shOt View Post
level[id] = 0 put this in round start
Like This?
PHP Code:
public eNewRound()
{
    if (
read_data(1) == floatround(get_cvar_float("mp_roundtime") * 60.0,floatround_floor))
    {
        
g_firstblood 1
        level
[id]= 0
    
}

i'm getting this compiling error

Quote:
deatheffect.sma(72) : error 017: undefined symbol "id"
deatheffect.sma(72 -- 73) : warning 215 : expression has no effect
I'm newbie please can you be more detailed

Last edited by joblessuser; 09-24-2013 at 11:16.
joblessuser is offline
timmiesgubbe
Member
Join Date: Oct 2012
Location: Sweden
Old 09-24-2013 , 17:21   Re: Need scripters help!!
Reply With Quote #4

Quote:
Originally Posted by joblessuser View Post
Like This?
PHP Code:
public eNewRound()
{
    if (
read_data(1) == floatround(get_cvar_float("mp_roundtime") * 60.0,floatround_floor))
    {
        
g_firstblood 1
        level
[id]= 0
    
}

i'm getting this compiling error



I'm newbie please can you be more detailed
Do like this ;)

Public eNewRound(id)
timmiesgubbe is offline
mottzi
Veteran Member
Join Date: May 2010
Location: Switzerland
Old 09-24-2013 , 17:52   Re: Need scripters help!!
Reply With Quote #5

Wrong.

You have to loop all players. Use get_players().
mottzi is offline
Send a message via MSN to mottzi
joblessuser
Member
Join Date: May 2013
Old 09-24-2013 , 23:43   Re: Need scripters help!!
Reply With Quote #6

Quote:
Originally Posted by timmiesgubbe View Post
Do like this ;)

Public eNewRound(id)
Still same problem
joblessuser is offline
joblessuser
Member
Join Date: May 2013
Old 09-24-2013 , 23:44   Re: Need scripters help!!
Reply With Quote #7

Quote:
Originally Posted by mottzi View Post
Wrong.

You have to loop all players. Use get_players().
mottzi can you post the code please!
joblessuser is offline
devilicioux
Veteran Member
Join Date: Jun 2013
Location: Delhi,India
Old 09-26-2013 , 05:43   Re: Need scripters help!!
Reply With Quote #8

PHP Code:
public eNewRound() 

new 
players[32], playersnum;
get_players(playersplayersnum"c");
if (
read_data(1) == floatround(get_cvar_float("mp_roundtime") * 60.0,floatround_floor))  

g_firstblood 
for( new playersnum i++ )
{
level[id]= 
}      


Untested but Should work.
Do the Identation yourself

Edit: You should post in Suggestions/Requests when you want others to code for you .. Scripting help means you know the coding just need the basic idea/approach to start with
__________________
You keep bringing ANTICHRISTUS down .. He will rise again and kick asses !

#RespectList ANTICHRISTUS fysiks Bugsy

Most Common Errors You Can Encounter Every Now and Then

Last edited by devilicioux; 09-26-2013 at 05:45.
devilicioux is offline
joblessuser
Member
Join Date: May 2013
Old 09-26-2013 , 06:30   Re: Need scripters help!!
Reply With Quote #9

devilicioux Thank You very much... Its working like a beast

Last edited by joblessuser; 09-26-2013 at 06:42.
joblessuser is offline
mottzi
Veteran Member
Join Date: May 2010
Location: Switzerland
Old 09-26-2013 , 08:36   Re: Need scripters help!!
Reply With Quote #10

You could also use arrayset() as it would be more efficient.
Deviliciouxs code is wrong.

Last edited by mottzi; 09-26-2013 at 08:37.
mottzi is offline
Send a message via MSN to mottzi
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 05:54.


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