Raised This Month: $ Target: $400
 0% 

3x Respawn Code HELP


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 02-23-2009 , 05:13   3x Respawn Code HELP
Reply With Quote #1

So, i oppend a new TH cuz its a code question :

PHP Code:
new const VERSION[] =    "1.1"

#include <amxmodx>
#include <fun>
#include <cstrike>

#define DISABLE_CS 0

// team ids 
#define UNASSIGNED 0 
#define TS 0 
#define CTS 2 
#define AUTO_TEAM 5 

new bool:g_PistolsDisabled false

public plugin_init(){

    
register_plugin("Respawn Forever"VERSION"Pimp Daddy (OoTOAoO)")

    
register_event("DeathMsg","on_Death","a")
    
    
register_cvar("sv_checkpistols""1")
    
register_cvar("sv_respawn""1")
    
register_cvar("respawn_forever_version"VERSIONFCVAR_SERVER)

    
register_clcmd("say","on_Chat")
    
register_clcmd("say_team","on_Chat")
}



public 
check_pistols()
{
    
/* Determine if we should give players a pistol or not */
    
if ( get_cvar_num("sv_checkpistols") )
    {
        
set_task(1.0"check_pistols")
        new 
mapname[32]
        
get_mapname(mapname,31
        if ( 
containi(mapname,"ka_")!=-|| containi(mapname,"scoutzknivez")!=-)
                
g_PistolsDisabled true
    
}
}

public 
spawn_func(id)
{
    new 
parm[1]
    
parm[0]=id
    
    
/* Spawn the player twice to avoid the HL engine bug */
    
set_task(0.5,"player_spawn",72,parm,1)
    
set_task(0.7,"player_spawn",72,parm,1)

    
/* Then give them a suit and a knife */
    
set_task(0.9,"player_giveitems",72,parm,1)
}

public 
on_Death()
{
    if ( !
get_cvar_num("sv_respawn") )
        return 
PLUGIN_CONTINUE
    
    
new victim_id read_data(2)
    
    
spawn_func1victim_id )

    return 
PLUGIN_CONTINUE
}

public 
spawn_func1(id)
{
    new 
parm[1]
    
parm[0]=id
    
    
/* Spawn the player twice to avoid the HL engine bug */
    
set_task(0.5,"player_spawn",72,parm,1)
    
set_task(0.7,"player_spawn",72,parm,1)

    
/* Then give them a suit and a knife */
    
set_task(0.9,"player_giveitems",72,parm,1)
}

public 
player_giveitems(parm[1])
{
    new 
id parm[0]

    
give_item(id"item_suit")
    
give_item(id"weapon_knife")

    
/* Determines if a players should be given a pistol */
    
if ( !g_PistolsDisabled )
    {
        new 
wpnList[32] = 0number 0bool:foundGlock falsebool:foundUSP false 
        get_user_weapons
(id,wpnList,number)
        
        
/* Determine if the player already has a pistol */
        
for (new 0;number;i++)
        { 
            if (
wpnList[i] == CSW_GLOCK18
                
foundGlock true 
            
if (wpnList[i] == CSW_USP
                
foundUSP true 
        
}
        
        
/* Give a T his/her pistol */
        
if ( get_user_team(id)==TS && !foundGlock )
        {
                
give_item(id,"weapon_glock18")
                
give_item(id,"ammo_9mm")
                
give_item(id,"ammo_9mm")
        }
        
/* Give a CT his/her pistol */
        
else if ( get_user_team(id)==CTS && !foundUSP )
        {
                
give_item(id,"weapon_usp")
                
give_item(id,"ammo_45acp")
                
give_item(id,"ammo_45acp")
        }
    }

    return 
PLUGIN_CONTINUE
}

public 
player_spawn(parm[1])
{
    
spawn(parm[0])

how can i add this so????
PHP Code:
public on_Death()
{
    if ( !
get_cvar_num("sv_respawn") )
        return 
PLUGIN_CONTINUE
    
    
new victim_id read_data(2)
    
    
spawn_func1------3victim_id )

    return 
PLUGIN_CONTINUE

spawn_func1------3( victim_id )
i wannt to repeat this 3x.. so spawn_func1 (victim_id)
then spawn_func2 (victim_id)
& spawn_stop3 (victim_id)
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 02-23-2009 , 07:15   Re: 3x Respawn Code HELP
Reply With Quote #2

Maybe this is what you want...
Code:
#include <hamsandwich>   public on_Death() {     if ( !get_cvar_num("sv_respawn") )         return PLUGIN_CONTINUE         new victim_id = read_data(2)         set_task(0.1, "Respawn", victim_id, _, _, "a", 3);       return PLUGIN_CONTINUE }   public Respawn(Client)         ExecuteHamB(Ham_CS_RoundRespawn, Client);
__________________
hleV is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 02-23-2009 , 08:09   Re: 3x Respawn Code HELP
Reply With Quote #3

Ok i have this :

PHP Code:
new const VERSION[] =    "1.1"

#include <amxmodx>
#include <fun>
#include <cstrike>
#include <hamsandwich>
#define DISABLE_CS 0

// team ids 
#define UNASSIGNED 0 
#define TS 0 
#define CTS 3 
#define AUTO_TEAM 5 



public plugin_init(){

    
register_plugin("Respawn Forever"VERSION"Pimp Daddy (OoTOAoO)")

    
register_event("DeathMsg","on_Death","a")
    
    
register_cvar("sv_checkpistols""1")
    
register_cvar("sv_respawn""1")
    
register_cvar("respawn_forever_version"VERSIONFCVAR_SERVER)

    
register_clcmd("say","on_Chat")
    
register_clcmd("say_team","on_Chat")
}



public 
on_Death()
{
    if ( !
get_cvar_num("sv_respawn") )
        return 
PLUGIN_CONTINUE
    
    
new victim_id read_data(2)
    
    
set_task(0.1"Respawn"victim_id__"a"3);
 
    return 
PLUGIN_CONTINUE
}




public 
player_spawn(parm[1])
{
    
spawn(parm[0])
}  
public 
Respawn(Client)
        
ExecuteHamB(Ham_CS_RoundRespawnClient); 
but i can respawn 234234234234234234 times
where am i wrong ?
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 02-23-2009 , 09:47   Re: 3x Respawn Code HELP
Reply With Quote #4

Quote:
Originally Posted by One View Post
Ok i have this :

but i can respawn 234234234234234234 times
where am i wrong ?
How many times do you want to be able to respawn? In the below code you can specify max respawns allowed per round.
PHP Code:
new const VERSION[] =    "1.1"

#include <amxmodx>
#include <fakemeta>
#include <fakemeta_util>

#define DISABLE_CS 0

// team ids 
#define UNASSIGNED 0 
#define TS 0 
#define CTS 3 
#define AUTO_TEAM 5 

#define MAXRESPAWNS    3
new g_Respawns[33]

public 
plugin_init()
{
    
register_plugin("Respawn Forever"VERSION"Pimp Daddy (OoTOAoO)")
    
    
register_event("DeathMsg","on_Death","a")
    
    
register_cvar("sv_checkpistols""1")
    
register_cvar("sv_respawn""1")
    
register_cvar("respawn_forever_version"VERSIONFCVAR_SERVER)
    
register_logevent("RoundEnd"2"1=Round_End")  
    
    
register_clcmd("say","on_Chat")
    
register_clcmd("say_team","on_Chat")
}

public 
RoundEnd()
{
    for( new 
0i<get_maxplayers();i++)
        
g_Respawns[i]=0
}

public 
on_Death()
{
    if ( !
get_cvar_num("sv_respawn") )
        return 
PLUGIN_CONTINUE
    
    
new victim_id read_data(2)
    
    if( 
g_Respawns[victim_id] < MAXRESPAWNS )
    {
        
set_task(0.1"Respawn"victim_id)
        
        
g_Respawns[victim_id]++
    }
    
    return 
PLUGIN_CONTINUE
}

public 
Respawn(id)
{
    
fm_user_spawnid )
}  

public 
fm_user_spawn(id

    
set_pev(idpev_deadflagDEAD_RESPAWNABLE)
    
dllfunc(DLLFunc_Spawnid)
    
set_pev(idpev_iuser10)

__________________

Last edited by Bugsy; 02-23-2009 at 09:51.
Bugsy is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 02-23-2009 , 10:25   Re: 3x Respawn Code HELP
Reply With Quote #5

TY. working
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
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 17:08.


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