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

zp_get_user_zombie()


Post New Thread Reply   
 
Thread Tools Display Modes
wangbochiang
Member
Join Date: Aug 2006
Location: Taiwan - Taichung
Old 08-11-2010 , 06:29   Re: zp_get_user_zombie() *Solved*
Reply With Quote #11

Sorry about overwriting solved my post,
I'm new in Scripting Help board..

I've edit my post back to I was have a big problem.

but I cant remember what I was post down there..



here is how I solved the problem.


PHP Code:
public fw_PlayerKilled(victimattackershouldgib)
{
    if(!
zp_get_user_zombie(attacker) && zp_get_user_zombie(victim))

    if(
g_Count 16)
    {
        
g_Count min(g_Count 110 g_morale_lv_up*g_morale_15_lv*1)
        
client_print(0print_center,"[Morale]Human killed %d Zombie~~ Morale up to LV.%d",g_Count,g_Count)
    }
    if(
g_Count == 16)
    {
        
client_print(0print_center,"[Morale] MAX level")
    }

change to


PHP Code:
public fw_PlayerKilled(victimattackershouldgib)
{
    if(
is_user_alive(attacker) && cs_get_user_team(attacker) == CS_TEAM_CT && cs_get_user_team(victim) == CS_TEAM_T)

    if(
g_Count 16)
    {
        
g_Count min(g_Count 110 g_morale_lv_up*g_morale_15_lv*1)
        
client_print(0print_center,"[Morale]Human killed %d Zombie~~ Morale up to LV.%d",g_Count,g_Count)
    }
    if(
g_Count == 16)
    {
        
client_print(0print_center,"[Morale] MAX level")
    }

and problem solved
__________________
Catch me on : @twitter
wangbochiang is offline
Send a message via MSN to wangbochiang Send a message via Yahoo to wangbochiang Send a message via Skype™ to wangbochiang
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 08-11-2010 , 08:53   Re: zp_get_user_zombie() *Solved*
Reply With Quote #12

A player can kill when dead... like, dropping a nade then die, you should only check if attacker is connected.
__________________
Hunter-Digital is offline
DarkGod
SourceMod DarkCrab
Join Date: Jul 2007
Location: Sweden
Old 08-11-2010 , 09:06   Re: zp_get_user_zombie() *Solved*
Reply With Quote #13

Quote:
Originally Posted by Hunter-Digital View Post
A player can kill when dead... like, dropping a nade then die, you should only check if attacker is connected.
That brings up another issue. Die and change team.
__________________
DarkGod is offline
Send a message via AIM to DarkGod Send a message via MSN to DarkGod
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 08-11-2010 , 12:12   Re: zp_get_user_zombie() *Solved*
Reply With Quote #14

Well, if you want morale to increase if a zombie is killed (by a human, another zombie, suicide, anything) you shouldn't check the attacker whatsoever.
You could also friendlyfire check... check if attacker is player and check it's team... if attacker is not a player OR is not zombie, then allow morale to increase.
__________________
Hunter-Digital is offline
wangbochiang
Member
Join Date: Aug 2006
Location: Taiwan - Taichung
Old 08-11-2010 , 16:54   Re: zp_get_user_zombie() *Solved*
Reply With Quote #15

Quote:
Originally Posted by Hunter-Digital View Post
Well, if you want morale to increase if a zombie is killed (by a human, another zombie, suicide, anything) you shouldn't check the attacker whatsoever.
You could also friendlyfire check... check if attacker is player and check it's team... if attacker is not a player OR is not zombie, then allow morale to increase.
I only want morale increase by human kill zombie,
so I only need to check attacker,
if zombie killed by world or something else,
than morale wont increase.


check user connect is necessary when morale increase function?


---
sorry about my bad english
__________________
Catch me on : @twitter
wangbochiang is offline
Send a message via MSN to wangbochiang Send a message via Yahoo to wangbochiang Send a message via Skype™ to wangbochiang
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 08-11-2010 , 19:27   Re: [Solved] zp_get_user_zombie()
Reply With Quote #16

"attacker" can be an entity... if player suicides with world or another entity (trigger_hurt for example) that entity's ID would be there.. and you either want to check is_user_connected() or 1 <= attacker <= maxplayers (variable)



Example:

Code:
//...

new g_iMaxPlayers

public plugin_init()
{
    g_iMaxPlayers = get_maxplayers()

    RegisterHam(Ham_Killed, "player", "player_killed")
}

public player_killed(id, killer)
{
    if(1 <= killer <= g_iMaxPlayers)
    {
         // killer is a player ... use the team checking and other stuff here.
    }
}
Also, you shouldn't print maxlevel every time you kill a zombie... it can be annoying.
__________________
Hunter-Digital is offline
wangbochiang
Member
Join Date: Aug 2006
Location: Taiwan - Taichung
Old 08-12-2010 , 02:24   Re: [Solved] zp_get_user_zombie()
Reply With Quote #17

Quote:
Originally Posted by Hunter-Digital View Post
Also, you shouldn't print maxlevel every time you kill a zombie... it can be annoying.
Just yesterday, I rewrite the whole plugin again,
I have realise print center message is annoying too ,

So I change to print at health bar(by HUD message)
also remove HL default HUD looks like

using ShowSyncHudMsg() update 0.5 pre sec.

player screen in more cleaner after I change to hud.
Attached Thumbnails
Click image for larger version

Name:	Hud.PNG
Views:	248
Size:	54.7 KB
ID:	71523  
__________________
Catch me on : @twitter
wangbochiang is offline
Send a message via MSN to wangbochiang Send a message via Yahoo to wangbochiang Send a message via Skype™ to wangbochiang
wangbochiang
Member
Join Date: Aug 2006
Location: Taiwan - Taichung
Old 09-15-2010 , 01:59   Re: [Solved] zp_get_user_zombie()
Reply With Quote #18

Quote:
Originally Posted by Hunter-Digital View Post
"attacker" can be an entity... if player suicides with world or another entity (trigger_hurt for example) that entity's ID would be there.. and you either want to check is_user_connected() or 1 <= attacker <= maxplayers (variable)



Example:

Code:
//...

new g_iMaxPlayers

public plugin_init()
{
    g_iMaxPlayers = get_maxplayers()

    RegisterHam(Ham_Killed, "player", "player_killed")
}

public player_killed(id, killer)
{
    if(1 <= killer <= g_iMaxPlayers)
    {
         // killer is a player ... use the team checking and other stuff here.
    }
}
Also, you shouldn't print maxlevel every time you kill a zombie... it can be annoying.
If I have to check if player is CT
I have to check it in another way?

like
PHP Code:
if(<= killer <= g_iMaxPlayers && is_user_connected(killer)) 
if I write like this , plugin will still running ?

or morale will still increase if CTs kill it self.. by flame or else. (ff on)


If I want morale increase if zombie is killed by laser mind.
how to I write the code?
__________________
Catch me on : @twitter

Last edited by wangbochiang; 09-15-2010 at 02:15.
wangbochiang is offline
Send a message via MSN to wangbochiang Send a message via Yahoo to wangbochiang Send a message via Skype™ to wangbochiang
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 01:31.


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