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

[Problema] codigo Respawn e InfiniteRound


  
 
 
Thread Tools Display Modes
Author Message
sniejder
Member
Join Date: Feb 2011
Old 03-01-2011 , 20:20   [Problema] codigo Respawn e InfiniteRound
#1

tengo un problema cuando pongo en funcionamiento ambos codigos
el Respawn y el infiniteround por que ellos inician junto con el servidor todo a la perfeccion cuando entra el primer jugador al servidor todo va bien pero es aki cuando viene el problema como ya ah entrado ese jugador inicia la ronda infinita entonces cuando entran al servidor los demas jugadores entran pero de manera DEAD osea "Muerto" y como la ronda nunk acaba no juegan la unica manera de que jueguen seria aplicando sv_restart 1 restando la partida y estos salen de la forma DEAD podrian ayudarme a solucionar este problema
sniejder is offline
gladius
Veteran Member
Join Date: Jul 2008
Location: Santiago, Chile
Old 03-01-2011 , 23:34   Re: [Problema] codigo Respawn e InfiniteRound
#2

puedes hookear el teaminfo, chequear cuando entra a CT o T y un task de 1 segundo y lo respawneas.
__________________
Proyects
Kreedz Chile Mod [100%] (Fixing some details).

gladius is offline
Send a message via MSN to gladius Send a message via Skype™ to gladius
sniejder
Member
Join Date: Feb 2011
Old 03-02-2011 , 00:30   Re: [Problema] codigo Respawn e InfiniteRound
#3

Quote:
Originally Posted by gladius View Post
puedes hookear el teaminfo, chequear cuando entra a CT o T y un task de 1 segundo y lo respawneas.
ese es el problema no respawn no hace nada la unica manera es restaurando la ronda :/
sniejder is offline
gladius
Veteran Member
Join Date: Jul 2008
Location: Santiago, Chile
Old 03-02-2011 , 00:35   Re: [Problema] codigo Respawn e InfiniteRound
#4

a mi me funciona
__________________
Proyects
Kreedz Chile Mod [100%] (Fixing some details).

gladius is offline
Send a message via MSN to gladius Send a message via Skype™ to gladius
sniejder
Member
Join Date: Feb 2011
Old 03-02-2011 , 00:38   Re: [Problema] codigo Respawn e InfiniteRound
#5

quieres echarle un vistazo a los codigo que poseeo? esto lo hago para un mode Yap Pug para el pregame.
sniejder is offline
gladius
Veteran Member
Join Date: Jul 2008
Location: Santiago, Chile
Old 03-02-2011 , 00:43   Re: [Problema] codigo Respawn e InfiniteRound
#6

PHP Code:
register_event("TeamInfo""Event_TeamInfo""a");

public 
Event_TeamInfo() 
{
    static 
userteam[2];
    
user read_data(1);
    
read_data(2team1);
    
    switch (
team[0]) 
    {
        case 
'C''T'
        {
            
set_task(1.0"PlayerRespawn_Task"user);
        }
    }
}

public 
PlayerRespawn_Task(user)
{
        
ExecuteHamB(Ham_CS_RoundRespawnuser);

__________________
Proyects
Kreedz Chile Mod [100%] (Fixing some details).

gladius is offline
Send a message via MSN to gladius Send a message via Skype™ to gladius
sniejder
Member
Join Date: Feb 2011
Old 03-02-2011 , 00:52   Re: [Problema] codigo Respawn e InfiniteRound
#7

Broo ese codigo es muy distinto al mio no se mucho sobre codear asi q no concuerdo nada de donde colocar ese codigo ve acontinuacion te dejare los 2 codigos que uso

Respawn
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fakemeta>
#include <fun>


new g_MONEYg_PRACTICA

public TeamSelect(id)
{
    if (
get_pcvar_num(g_PRACTICA))   {
        new 
sId[2]
        
sId[0] = id
        set_task
(10.0,"respawn",0,sId,2)
    }
    return 
PLUGIN_CONTINUE
}

public 
death_msg() 
{    
    if (
get_pcvar_num(g_PRACTICA))   { 
        new 
vIndex read_data(2
        new 
svIndex[2]
        
svIndex[0] = vIndex
        set_task
(0.5,"respawn",0,svIndex,2
    } 
    return 
PLUGIN_CONTINUE 


public 
respawn(svIndex[]) 

    new 
vIndex svIndex[0
    if(
get_user_team(vIndex) == || is_user_alive(vIndex)) 
        return 
PLUGIN_CONTINUE 
    spawn
(vIndex
    
    return 
PLUGIN_CONTINUE    


public 
event_money(id)
{
    if(
get_pcvar_num(g_PRACTICA))
    {
        
cs_set_user_money(idget_pcvar_num(g_MONEY), 0)
    }
}

 
public 
plugin_init() 

       
register_plugin("Practica","0.2","kung fu"
    
register_event("DeathMsg","death_msg","a"
    
register_event("ShowMenu","TeamSelect","b","4&Team_Select")
    
register_event("VGUIMenu","TeamSelect","b","1=2")
    
register_event("Money""event_money""be")
    
g_PRACTICA register_cvar("amx_practica","0"
    
g_MONEY register_cvar("round_money","16000")
    
    return 
PLUGIN_CONTINUE 

Infinite Round
PHP Code:
#include <amxmodx>
    #include <amxmisc>
    #include <orpheu>
    #include <orpheu_memory>


    /* PLUGIN INFORMATIONS */

        #define PLUGIN_NAME     "Infinite Round"
        #define PLUGIN_VERSION  "1.0.1"
        #define PLUGIN_AUTHOR   "Arkshine"


    /* ORPHEU HOOK HANDLES */

        
new OrpheuHook:handleHookCheckMapConditions;
        new 
OrpheuHook:handleHookCheckWinConditions;
        new 
OrpheuHook:handleHookHasRoundTimeExpired;


    
/* CONSTANTS */

        
new memoryIdentifierRoundTime[] = "roundTimeCheck";

        
enum /* plugin state */
        
{
            
DISABLED 0,
            
ENABLED
        
};


    
/*  VARIABLES */

        
new currentPluginState ENABLED;
        new 
bool:isLinuxServer;


    public 
plugin_init()
    {
        
register_pluginPLUGIN_NAMEPLUGIN_VERSIONPLUGIN_AUTHOR );
        
register_cvar"infiniteround_version"PLUGIN_VERSIONFCVAR_SERVER FCVAR_SPONLY );

        
register_concmd"infiniteround_toggle""ConsoleCommand_TogglePlugin"ADMIN_RCON"<0|1> - Toggle plugin state" );

        
isLinuxServer bool:is_linux_server();

        
state disabled;
        
EnableForwards();
    }


    
/**
     *  Command to toggle the plugin state,
     *  then to enable/disable properly the forwards used.
     */
    
public ConsoleCommand_TogglePlugin ( const player, const level, const cid )
    {
        if ( 
cmd_accessplayerlevelcid) )
        {
            new 
newPluginState];
            
read_argv1newPluginStatecharsmaxnewPluginState ) );

            new 
statePluginWanted clampstr_to_numnewPluginState ), DISABLEDENABLED );

            switch ( 
statePluginWanted )
            {
                case 
DISABLED DisableForwards();
                case 
ENABLED  EnableForwards();
            }

            ( 
currentPluginState == statePluginWanted ) ?

                
console_printplayer"%s"statePluginWanted "Plugin already enabled!" "Plugin already disabled!" ) :
                
console_printplayer"%s"statePluginWanted "Plugin is now enabled!"  "Plugin is now disabled!"  );

            
currentPluginState statePluginWanted;
        }

        return 
PLUGIN_HANDLED;
    }


    
/**
     *  The plugin was disabled. A user has enabled the plugin with the command.
     *  Enable properly all the forwards and patch the memory for windows only.
     */
    
public EnableForwards () <> {}
    public 
EnableForwards () <disabled>
    {
        
handleHookCheckMapConditions OrpheuRegisterHookOrpheuGetFunction"CheckMapConditions" "CHalfLifeMultiplay" ), "CheckConditions" );
        
handleHookCheckWinConditions OrpheuRegisterHookOrpheuGetFunction"CheckWinConditions" "CHalfLifeMultiplay" ), "CheckConditions" );

        if ( 
isLinuxServer )
        {
            
handleHookHasRoundTimeExpired OrpheuRegisterHookOrpheuGetFunction"HasRoundTimeExpired" "CHalfLifeMultiplay" ), "CheckConditions" );
        }
        else
        {
            
/*
                | Windows - CHalfLifeMultiplay::HasRoundTimeExpired() is somehow integrated in CHalfLifeMultiplay::Think(),
                | we must patch some bytes directly into this function to avoid the check. Ugly trick but no choice.
                | 0x90 = NOP = does nothing. Don't modify the values.
            */

            
BytesToReplacememoryIdentifierRoundTime, { 0x900x900x90 } );
        }

        
state enabled;
    }


    
/**
     *  The plugin was enabled. A user has disabled the plugin with the command.
     *  Disable properly all the forwards and patch the memory for windows only.
     */
    
public DisableForwards () <> {}
    public 
DisableForwards () <enabled>
    {
        
OrpheuUnregisterHookhandleHookCheckMapConditions );
        
OrpheuUnregisterHookhandleHookCheckWinConditions );

        if ( 
isLinuxServer )
        {
            
OrpheuUnregisterHookhandleHookHasRoundTimeExpired );
        }
        else
        {
            
/*
                | Windows - We restore the original value.
                | We restart to reinitialize the game.
                | Don't modify the values.
            */

            
BytesToReplacememoryIdentifierRoundTime, { 0xF60xC40x41 } );
        }

        
state disabled;
    }


    
/**
     *  Block CHalfLifeMultiplay::CheckMapConditions(), CHalfLifeMultiplay::CheckWinConditions()
     *  and CHalfLifeMultiplay::HasRoundTimeExpired() so the round won't stop whatever the situation.
     */
    
public OrpheuHookReturn:CheckConditions () <> { return OrpheuIgnored; }
    public 
OrpheuHookReturn:CheckConditions () <enabled>
    {
        
OrpheuSetReturnfalse );
        return 
OrpheuSupercede;
    }


    
/**
     *  Replace at a specific memory address a value byte by byte.
     *
     *  @param identifier       The name of the block that qualifies memory.
     *  @param bytes            The bytes we want to patch.
     */
    
stock BytesToReplace identifier[], const bytes[], const bytesLength sizeof bytes )
    {
        new 
address;
        
OrpheuMemoryGetidentifieraddress );

        for ( new 
ibytesLengthi++)
        {
            
OrpheuMemorySetAtAddressaddress"roundTimeCheck|dummy"1bytes], address );
            
address++;
        }

        
/*
            | It needs to reiniatiliaze some things.
        */
        
server_cmd"sv_restart 1" );
    } 
si puedes me ayudas mas personal mente para no alarga el post.
sniejder is offline
gladius
Veteran Member
Join Date: Jul 2008
Location: Santiago, Chile
Old 03-02-2011 , 01:09   Re: [Problema] codigo Respawn e InfiniteRound
#8

Reemplaza tu code de respawn por este y prueba

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

#define IsPlayer(%1)    (1 <= %1 <= g_MaxPlayers)

new g_MaxPlayers

public plugin_init() 
{    
    
g_MaxPlayers get_maxplayers()
    
    
register_event("TeamInfo""Event_TeamInfo""a");
    
    
RegisterHam(Ham_Killed"player""Ham_Fwd_Player_Killed_Post"true);
}

public 
Event_TeamInfo() 
{
    static 
userteam[2];
    
user read_data(1);
    
read_data(2team1);
    
    switch (
team[0]) 
    {
        case 
'C''T'
        {
            
set_task(1.0"PlayerRespawn_Task"user);
        }
    }
}

public 
Ham_Fwd_Player_Killed_Post(victimkillerBodyHit)
{            
    if(!(
IsPlayer(killer)))
    {
        return 
HAM_IGNORED;
    }
    
    
set_task(2.0"PlayerRespawn_Task"victim);
    
    return 
HAM_SUPERCEDE;
}

public 
PlayerRespawn_Task(user)
{
    if(!
is_user_alive(user))
    {
        
ExecuteHamB(Ham_CS_RoundRespawnuser);
    }

__________________
Proyects
Kreedz Chile Mod [100%] (Fixing some details).

gladius is offline
Send a message via MSN to gladius Send a message via Skype™ to gladius
sniejder
Member
Join Date: Feb 2011
Old 03-02-2011 , 01:24   Re: [Problema] codigo Respawn e InfiniteRound
#9

Quote:
Originally Posted by gladius View Post
Reemplaza tu code de respawn por este y prueba

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

#define IsPlayer(%1)    (1 <= %1 <= g_MaxPlayers)

new g_MaxPlayers

public plugin_init() 
{    
    
g_MaxPlayers get_maxplayers()
    
    
register_event("TeamInfo""Event_TeamInfo""a");
    
    
RegisterHam(Ham_Killed"player""Ham_Fwd_Player_Killed_Post"true);
}

public 
Event_TeamInfo() 
{
    static 
userteam[2];
    
user read_data(1);
    
read_data(2team1);
    
    switch (
team[0]) 
    {
        case 
'C''T'
        {
            
set_task(1.0"PlayerRespawn_Task"user);
        }
    }
}

public 
Ham_Fwd_Player_Killed_Post(victimkillerBodyHit)
{            
    if(!(
IsPlayer(killer)))
    {
        return 
HAM_IGNORED;
    }
    
    
set_task(2.0"PlayerRespawn_Task"victim);
    
    return 
HAM_SUPERCEDE;
}

public 
PlayerRespawn_Task(user)
{
    if(!
is_user_alive(user))
    {
        
ExecuteHamB(Ham_CS_RoundRespawnuser);
    }

Funciona perfecto tal cual como lo queria, pero podrias agregarle un cvars? y el tiempo de respawn se puede poner menor a 1 seg?
sniejder is offline
sniejder
Member
Join Date: Feb 2011
Old 03-02-2011 , 06:56   Re: [SOLUCIONADO] codigo Respawn e InfiniteRound
#10

Men intente agregarle el cvar lo copila bien pero cuando ejerce el comando no toma ningun efecto help me
__________________
SneijdeR cs 1.6

[IMG]http://img7.**************/img7/9841/basicrepository3dabstra.jpg[/IMG]

[IMG]http://img40.**************/img40/920/fondofinalag6.jpg[/IMG]



I'AM FAN MOD PUG

Last edited by sniejder; 03-02-2011 at 14:38.
sniejder is offline
 



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 09:17.


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