Raised This Month: $32 Target: $400
 8% 

[ZP] ZClass ISLAVE


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
MayroN
Senior Member
Join Date: Aug 2017
Location: Kyiv
Old 07-07-2019 , 12:24   [ZP] ZClass ISLAVE
Reply With Quote #1

The code is credited the killing ability of the electric discharge,but for some reason, frag is added to the scoreboard,but someone killed - not shown ( just the death of a player and all )

Accordingly, the money is not added at all - and this is sad.
Help fix it.

Here is how would it here

PHP Code:
if (targetdied && !targetdead)
    {
        
set_user_frags(casterget_user_frags(caster)+1)
        
set_user_frags(targetidget_user_frags(targetid)+1)
    } 
All Electrical Contractor Code
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <fun>
#include <zombieplague>

#define ULTIMATESEARCHTIME 2
#define CHAINLIGHTNING_COOLDOWN 20.0
#define fm_get_user_button(%1) pev(%1, pev_button)

new const zclass_name[] = { "Ассасин" }
new const 
zclass_info[] = { "Электророзряд" }
new const 
zclass_model[] = { "girl_zaraza" }
new const 
zclass_clawmodel[] = { "mummy_hands.mdl" }
const 
zclass_health 1800 // 
const zclass_speed 260 // 
const Float:zclass_gravity 1.0 // 
const Float:zclass_knockback 1.0 // 

new g_zclass_light
new bool:ultimateused[33]
new 
bool:issearching[33]
new 
bool:lightninghit[33]
new 
lightning

public plugin_init()
{
    
register_plugin("Zombie Class islave""1.0""[Grief.QQ] , Bill=Thailand=[UP]")
    
register_forward(FM_PlayerPreThink,     "fwd_playerprethink")
    
register_logevent("round_start"2"1=Round_Start")
    
register_logevent("round_end"2"1=Round_End")
}

public 
plugin_precache()
{
    
precache_sound("debris/beamstart9.wav")
    
precache_sound("turret/tu_ping.wav")
    
lightning precache_model("sprites/lgtning.spr")
    
g_zclass_light zp_register_zombie_class(zclass_namezclass_infozclass_modelzclass_clawmodelzclass_healthzclass_speedzclass_gravityzclass_knockback)    
}

public 
zp_user_infected_post(idinfector)
{
    if (
zp_get_user_zombie_class(id) == g_zclass_light)
    {
        
print_chatColor(id"\g[ Зомби Чума ]\n \tКлавиша\n \gE\n - \tвыстрел по врагу\n \gЭлектрическим зарядом\n")
    }
}

public 
fwd_playerprethink(id
{
    new 
button fm_get_user_button(id)
    new 
parm[2]
    
parm[0]=id
    parm
[1]=ULTIMATESEARCHTIME
    
if((is_user_alive(id) == 1) && (button IN_USE) && (zp_get_user_zombie_class(id) == g_zclass_light) && !zp_get_user_nemesis(id) && !ultimateused[id] && !issearching[id])
    
lightsearchtarget(parm)

    return 
FMRES_IGNORED
}

public 
lightsearchtarget(parm[2])
{
    new 
id parm[0]
    new 
enemybody
    get_user_aiming
(id,enemy,body)
    if ( 
0<enemy<=32 && !zp_get_user_zombie(enemy))
    {
        
ultimateused[id]=true
        
new linewidth 160
        
new damage 20
        issearching
[id]=false
        lightningeffect
(id,enemy,linewidth,damage,id)
        new 
lightparm[4]
        
lightparm[0]=enemy
        lightparm
[1]=damage
        lightparm
[2]=linewidth
        lightparm
[3]=id
        
new cooldownparm[1]
        
cooldownparm[0]=id
        print_chatColor
(id"\g[ Зомби Чума ]\n \tВосстановление Электрического заряда\n \gчерез 20 секунд\n")
        
set_task(CHAINLIGHTNING_COOLDOWN,"cooldown",5,cooldownparm,1)
    }
    else
    {
        
issearching[id]=true
        
new counter parm[1]
        while (
counter >= 0)
        {
            
counter -= 10
            
if (counter==0)
                
emit_sound(id,CHAN_ITEM"turret/tu_ping.wav"1.0ATTN_NORM0PITCH_NORM)
        }
        --
parm[1]
        if (
parm[1]>&& get_user_health(id)>=0)
            
set_task(0.1,"lightsearchtarget",26,parm,2)
        else
            
issearching[id]=false
    
}
    return 
PLUGIN_CONTINUE
}

public 
lightningeffect(id,targetid,linewidth,damage,caster)
{

    new 
bool:targetdied
    
new bool:targetdead
    lightninghit
[targetid]=true
    targetdead
=false

    
if (is_user_alive(targetid))
        
targetdead=false
    
else
        
targetdead=true

    
if (get_user_health(targetid)-damage<=0)
        
targetdied=true

    set_user_health
(targetid,get_user_health(targetid)-damage)
    if (
get_user_armor(targetid)-damage<=0)
        
set_user_armor(targetid,0)
    else
        
set_user_armor(targetid,get_user_armor(targetid)-damage)

    if (
targetdied && !targetdead)
    {
        
set_user_frags(casterget_user_frags(caster)+1)
        
set_user_frags(targetidget_user_frags(targetid)+1)
    }

    
message_beginMSG_BROADCASTSVC_TEMPENTITY );
    
write_byteTE_BEAMENTS );
    
write_short(id);    // ????
    
write_short(targetid);    // ????
    
write_short(lightning );    // ????
    
write_byte); // starting frame
    
write_byte20 );  // frame rate
    
write_byte10 );  // life
    
write_bytelinewidth );  // line width
    
write_byte20 );  // ??
    
write_byte);    // r, g, b
    
write_byte255 );    // r, g, b
    
write_byte);    // r, g, b
    
write_byte120 );    // brightness
    
write_byte);    // scroll speed
    
message_end();

    new 
origin[3]
    
get_user_origin(targetid,origin)

    
message_beginMSG_BROADCASTSVC_TEMPENTITY );
    
write_byteTE_ELIGHT );
    
write_short(targetid);    // entity
    
write_coord(origin[0])  // initial position
    
write_coord(origin[1])  // initial position
    
write_coord(origin[2])  // initial position
    
write_coord(150)      // radius
    
write_byte255 );    // r, g, b
    
write_byte255 );    // r, g, b
    
write_byte255 );    // r, g, b
    
write_byte120 );  // life
    
write_coord(0)    // decay rate
    
message_end();

    
emit_sound(id,CHAN_ITEM"debris/beamstart9.wav"1.0ATTN_NORM0PITCH_NORM)

    return 
PLUGIN_CONTINUE
}

public 
cooldown(parm[1])
{
    
ultimateused[parm[0]]=false
    
return PLUGIN_CONTINUE
}

public 
client_connect(id)
{
    
ultimateused[id]=false
    
return PLUGIN_CONTINUE
}

public 
client_disconnect(id)
{
    
ultimateused[id]=false
    
return PLUGIN_CONTINUE
}

public 
round_start(id)
{
    
ultimateused[id]=false
}

public 
round_end(id)
{
    
ultimateused[id]=false
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/

// Color Chat
stock print_chatColor(const id,const input[], any:...)
{
    new 
msg[191], players[32], count 1;
    
vformat(msg,190,input,3);
    
replace_all(msg,190,"\g","^4");// green
    
replace_all(msg,190,"\n","^1");// normal
    
replace_all(msg,190,"\t","^3");// team
    
    
if (idplayers[0] = id; else get_players(players,count,"ch");
    for (new 
i=0;i<count;i++)
        if (
is_user_connected(players[i]))
    {
        
message_begin(MSG_ONE_UNRELIABLE,get_user_msgid("SayText"),_,players[i]);
        
write_byte(players[i]);
        
write_string(msg);
        
message_end();
    }

MayroN is offline
Send a message via ICQ to MayroN Send a message via Skype™ to MayroN
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 07-07-2019 , 12:45   Re: [ZP] ZClass ISLAVE
Reply With Quote #2

"set_user_frags" doesn't update the scoreboard (don't know why it's not fixed yet). You need to manually force the scoreboard to refresh or use "cs_set_user_deaths" afterwards.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
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 17:01.


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