AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   3x Respawn Code HELP (https://forums.alliedmods.net/showthread.php?t=86248)

One 02-23-2009 05:13

3x Respawn Code HELP
 
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)

hleV 02-23-2009 07:15

Re: 3x Respawn Code HELP
 
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);

One 02-23-2009 08:09

Re: 3x Respawn Code HELP
 
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 ?:(

Bugsy 02-23-2009 09:47

Re: 3x Respawn Code HELP
 
Quote:

Originally Posted by One (Post 767232)
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)



One 02-23-2009 10:25

Re: 3x Respawn Code HELP
 
TY. working :D


All times are GMT -4. The time now is 17:08.

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