Raised This Month: $ Target: $400
 0% 

[Problema] codigo Respawn e InfiniteRound


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
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
 



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:15.


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