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

ExecuteHamB(Ham_CS_RoundRespawn, victim)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
FlyingHorse
Senior Member
Join Date: Apr 2010
Location: Under your bed.
Old 05-25-2010 , 13:41   ExecuteHamB(Ham_CS_RoundRespawn, victim)
Reply With Quote #1

Why doesn't the respawn on my plugin work? When i die nothing happens..

PHP Code:
#include <amxmodx>
#include <fun>
#include <engine>
#include <hamsandwich>
#include <cstrike>
#include <csx>
#include <colorchat>

new g_szVictimSound[100], g_szKillerSound[100], g_szPlayersSound[100]
new 
g_iMaxPlayers
new const PLUGIN[ ] = "Rambo mod"
new const VERSION[ ] = "1.2"
new const AUTHOR[ ] = "FlyingHorse"

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
RegisterHam(Ham_Spawn"player""Event_Player_Spawn"1)
    
RegisterHam(Ham_Killed"player""Event_Ham_Killed")
    
register_event("DeathMsg""eDeathMsg_HeadShot""a""1>0""3=1")
}

public 
client_putinserver(id)
{
    
set_task(15.0"advertisement"id)
}

public 
advertisement(id)
{
    
ColorChat(idRED"^x04[Rambo Mod]^x01 This server is using^x03 Rambo mod^x04 v%s^x01 by^x04 FlyingHorse^x01."VERSION)
}
public 
plugin_precache()
{
    
precache_sound("fvox/blip.wav")
    new 
szFile[64]
    
get_localinfo("amxx_configsdir"szFile63)
    
format(szFile63"%s/headshots.ini"szFile)

    new 
File fopen(szFile"rt")
    if(!
File)
    {
        
pause("ad")
        return
    }

    new 
Text[128], Witch[8], Sound[100]
    while(!
feof(File))
    {
        
fgets(FileText127)
        
trimText )
        if(!
Text[0] || Text[0] == ';' || (Text[0] == '/' && Text[1] == '/'))
        continue

        
parse(TextWitch7Sound99)
        if(!
g_szVictimSound[0] && equal(Witch"victim"))
        {
            
copy(g_szVictimSound99Sound)
            
precache_sound(g_szVictimSound)
        }
        else if(!
g_szKillerSound[0] && equal(Witch"killer"))
        {
            
copy(g_szKillerSound99Sound)
            
precache_sound(g_szKillerSound)
        }
        else if(!
g_szPlayersSound[0] && equal(Witch"players"))
        {
            
copy(g_szPlayersSound99Sound)
            
precache_sound(g_szPlayersSound)
        }
    }
    
fclose(File)
}


public 
Event_Player_Spawn(id)
{    
    if(
is_user_alive(id))
    {
        
set_user_maxspeed(id350.0)
        
set_task(0.1"player_glowteam"id)
        
client_cmd(id,"spk ^"fvox/blip^"")
        
ColorChat(idGREEN"^x04[Rambo Mod]^x01 You Respawned!")
        
strip_user_weapons(id)
        
give_item(id"weapon_knife")
        
cs_set_weapon_ammo(give_item(id"weapon_deagle"), 20)
        
cs_set_weapon_ammo(give_item(id"weapon_m249"), 200)
        
cs_set_weapon_ammo(give_item(id"weapon_hegrenade"), 10)
        
cs_set_user_bpammo(idCSW_DEAGLE100)
        
cs_set_user_bpammo(idCSW_M2491000)
    }
}
public 
Event_Ham_Killed(victimattackershouldgib)
{
    new 
attackername[33]
    
get_user_name(attackerattackername32)
    if(
is_user_connected(victim))
    
ColorChat(victimGREEN"^x04[Rambo Mod]^x01 You got owned by^x04 %s"attackername)
    
ExecuteHamB(Ham_CS_RoundRespawnvictim)


public 
player_glowteam(id)
{
    if(
cs_get_user_team(id) == CS_TEAM_CT)
    {
        
set_user_rendering(idkRenderFxGlowShell00255kRenderNormal16)
    }
    else if(
cs_get_user_team(id) == CS_TEAM_T)
    
set_user_rendering(idkRenderFxGlowShell25500kRenderNormal16)
}

public 
plugin_cfg()
{
    
g_iMaxPlayers get_maxplayers()
}

public 
eDeathMsg_HeadShot()
{
    new 
iKiller read_data(1)

    if(
iKiller g_iMaxPlayers)
        return

    new 
iVictim read_data(2)
    if(
iKiller == iVictim)
        return

    if(
g_szKillerSound[0])
        
emit_sound(iKillerCHAN_VOICEg_szKillerSoundVOL_NORMATTN_STATIC0PITCH_NORM)

    if(
g_szVictimSound[0])
        
client_cmd(iVictim"speak %s"g_szVictimSound)

    if(
g_szPlayersSound[0])
    {
        for(new 
id 1id <= g_iMaxPlayersid++)
        {
            if(!
is_user_connected(id))
                continue
            if((
g_szKillerSound[0] && id == iKiller) || (g_szVictimSound[0] && id == iVictim))
                continue
            
client_cmd(id"speak %s"g_szPlayersSound)
        }
    }

FlyingHorse is offline
Send a message via Skype™ to FlyingHorse
grimvh2
Veteran Member
Join Date: Nov 2007
Location: Fishdot Nation
Old 05-25-2010 , 14:02   Re: ExecuteHamB(Ham_CS_RoundRespawn, victim)
Reply With Quote #2

Add a delay.
__________________
I am out of order!
grimvh2 is offline
FlyingHorse
Senior Member
Join Date: Apr 2010
Location: Under your bed.
Old 05-25-2010 , 14:42   Re: ExecuteHamB(Ham_CS_RoundRespawn, victim)
Reply With Quote #3

How? im new at coding ..just been doing it for like a week
FlyingHorse is offline
Send a message via Skype™ to FlyingHorse
KadiR
Unnecessary Member
Join Date: Aug 2008
Location: Zürich / Switzerland
Old 05-25-2010 , 14:44   Re: ExecuteHamB(Ham_CS_RoundRespawn, victim)
Reply With Quote #4

How to make a delay? Search? Anyways:

http://www.amxmodx.org/funcwiki.php?...task&go=search
KadiR is offline
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 05-25-2010 , 14:51   Re: ExecuteHamB(Ham_CS_RoundRespawn, victim)
Reply With Quote #5

Instead of adding delay you can do this:
PHP Code:
RegisterHam(Ham_Killed"player""Event_Ham_Killed"
-->
PHP Code:
RegisterHam(Ham_Killed"player""Event_Ham_Killed"1
__________________
Impossible is Nothing
Sylwester is offline
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 05-25-2010 , 15:48   Re: ExecuteHamB(Ham_CS_RoundRespawn, victim)
Reply With Quote #6

Adding on to Sylwester's fix, the fourth parameter for RegisterHam is the post or pre call. If you have it as 0 (default), it will be called on pre (before the actual event happens). If you make it 1, it will be called on post (after the actual event).

You'd use pre for things like superceding on TakeDamage to prevent damage from happening. If you'd tried to supercede in TakeDamage post, nothing would happen, since the damage was already dealt.

There are different uses for each, but for your method, as Sylwester showed you, you need to use post.
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 05-25-2010 , 15:53   Re: ExecuteHamB(Ham_CS_RoundRespawn, victim)
Reply With Quote #7

Register as post (as already said), or supercede in pre, if you don't want DeathMsg being sent for example.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
FlyingHorse
Senior Member
Join Date: Apr 2010
Location: Under your bed.
Old 05-26-2010 , 08:29   Re: ExecuteHamB(Ham_CS_RoundRespawn, victim)
Reply With Quote #8

Sorry connor.. But could you explain better? .. I'm not a good coder.. im a beginner.. This is the biggest thing ive ever made
FlyingHorse is offline
Send a message via Skype™ to FlyingHorse
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 05-26-2010 , 13:42   Re: ExecuteHamB(Ham_CS_RoundRespawn, victim)
Reply With Quote #9

@ Connor:
Will supercede in pre block the victim from dying to?

Example:

PHP Code:
#include <amxmodx>
#include <hamsandwich>

public plugin_init()
{
    
RegisterHam(Ham_Killed"player""Ham_Killed_Pre"0)        // Player isn't death yet
    
RegisterHam(Ham_Killed"player""Ham_Killed_Post"1)        // Player is death
    // Other stuff
}

public 
Ham_Killed_Pre(victimattackershouldgib)    // Player isn't death, block it
    
return HAM_SUPERCEDE    // Blocks stuff from happening

public Ham_Killed_Post(victimattackershouldgib)    // Player is death, respawn him    
    
ExecuteHamb(Ham_CS_RoundRespawnvictim)    // Respawns the victim 
if you want a bigger delay use set_task like this:
PHP Code:
#include <amxmodx>
#include <hamsandwich>

public plugin_init()
{
    
RegisterHam(Ham_Killed"player""Ham_Killed_Pre"0)        // Player isn't death yet
    
RegisterHam(Ham_Killed"player""Ham_Killed_Post"1)        // Player is death
    // Other stuff
}

public 
Ham_Killed_Pre(victimattackershouldgib)    // Player isn't death, block it
    
return HAM_SUPERCEDE

public Ham_Killed_Post(victimattackershouldgib)    // Player is death, respawn him    
    
set_task(5.0"respawn"victim)
    
public 
respawn(id)
    
ExecuteHamB(Ham_CS_RoundRespawnid
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.

Last edited by drekes; 05-26-2010 at 13:46.
drekes is offline
Send a message via MSN to drekes
FlyingHorse
Senior Member
Join Date: Apr 2010
Location: Under your bed.
Old 05-26-2010 , 13:55   Re: ExecuteHamB(Ham_CS_RoundRespawn, victim)
Reply With Quote #10

solved already .. i made this:
PHP Code:
public Event_Ham_Killed(victimattackershouldgib)
{
    new 
attackername[33]
    
get_user_name(attackerattackername32)
    if(
is_user_connected(victim))
    
set_hudmessage(00255, -1.0, -1.0)
    
show_hudmessage(victim"You got owned by %s"attackername)
    
set_task(1.0"respawn"victim)
}

public 
respawn(victimattackershouldgib)
{
    new 
attackername[33]
    
get_user_name(attackerattackername32)
    
ExecuteHamB(Ham_CS_RoundRespawnvictim)

I added a task to delay with 1 second so u dont respawn instantly when u die.. kinda confusing
FlyingHorse is offline
Send a message via Skype™ to FlyingHorse
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 16:04.


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