Skocz do zawartości

Witamy w Nieoficjalnym polskim support'cie AMX Mod X

Witamy w Nieoficjalnym polskim support'cie AMX Mod X, jak w większości społeczności internetowych musisz się zarejestrować aby móc odpowiadać lub zakładać nowe tematy, ale nie bój się to jest prosty proces w którym wymagamy minimalnych informacji.
  • Rozpoczynaj nowe tematy i odpowiedaj na inne
  • Zapisz się do tematów i for, aby otrzymywać automatyczne uaktualnienia
  • Dodawaj wydarzenia do kalendarza społecznościowego
  • Stwórz swój własny profil i zdobywaj nowych znajomych
  • Zdobywaj nowe doświadczenia

Dołączona grafika Dołączona grafika

Guest Message by DevFuse
 

Zdjęcie
Modyfikacja

przerobienie pluginu z nożami

Modyfikacja

  • Zamknięty Temat jest zamknięty
Brak odpowiedzi do tego tematu

#1 toxic

    Pomocny

  • Użytkownik

Reputacja: 0
Nowy

  • Postów:45
Offline

Napisano 27.08.2011 22:56

Cześć
mam taki problem, chciałem przerobić ten plugin, tak żeby zamiast noża było m4, ak47, awp, deagle, usp i he, najpierw przerobiłem go tak tylko żeby było tylko m4 i działał, potem chciałem dodać inne bronie, pierwsza runda mogę korzystać ze wszystkich broni, potem kiedy wpisałem kill jest respawn w tej samej rundzie (bo ustawiłem km_respawn1) i tutaj pojawia się problem bo cały serwer pada, jest coś w pluginie co go ogranicza, czy to wina innego pluginu, czy ja źle dopisałem bornie chociaż jak weszli za pierwszym razem, każdy miał do wyboru daną broń

plugin działał normalnie z botami, jak sprawdzałem u siebie w domu, były wszystkie bronie i po wpisaniu kill albo ginięciu, następował respawn bez żadnych błędów

#include <amxmodx>
#include <hamsandwich>
#include <cstrike>
#include <engine>
#include <fun>
 
#define PLUGIN "Knife Management"
#define VERSION "3.3"
#define AUTHOR "Jon"
 
#define InTeam(%1) ( CS_TEAM_UNASSIGNED < cs_get_user_team(%1) < CS_TEAM_SPECTATOR )
 
// - // - // - // - // - // - // - //
 
enum _:MapTypes ( <<= 1 )
{
    TYPE_1HP = 1, TYPE_35HP, TYPE_ACER, TYPE_WIRE
}
 
enum _:Timers
{
    Float:RESPAWN, Float:NEXTUSE, Float:LASTUSE
}
 
const g_iKeysFreeHitMenu = MENU_KEY_1 | MENU_KEY_2;
const TASK_CHECKMENU = 3491;
const TASK_CHECKHEALTH = 3488;
 
new g_pRespawn;
new g_pFreeHits;
new g_pCamera;
new g_pRemoveBomb;
new g_pStabAcerMaps;
new g_pGhostChat;
 
new g_iMapType;
new g_iMsgSayText;
new g_iButtonCount[ 33 ];
new g_iFreeHitCount[ 33 ];
new g_iRequester[ 33 ];
new g_szFreeHitMenu[ 128 ];
 
new Float:g_fTimers[ 33 ][ Timers ];
 
new bool:g_bSpawned[ 33 ];
new bool:g_bCamera[ 33 ];
 
// - // - // - // - // - // - // - //
 
public plugin_precache()
{
    precache_model( "models/rpgrocket.mdl" );
    
    new iEnt = create_entity( "info_map_parameters" );
    DispatchKeyValue( iEnt, "buying", "3" );
    DispatchSpawn( iEnt );
    
    RegisterHam( Ham_Spawn, "armoury_entity", "FwdArmouryEntitySpawn" );
}
 
public plugin_init()
{
    register_plugin( PLUGIN, VERSION, AUTHOR );
    register_cvar( "km_version", VERSION, FCVAR_SERVER | FCVAR_SPONLY );
    
    g_pRespawn = register_cvar( "km_respawn", "0" );
    g_pFreeHits = register_cvar( "km_freehits", "2" );
    g_pCamera = register_cvar( "km_camera", "1" );
    g_pRemoveBomb = register_cvar( "km_removebomb", "0" );
    g_pStabAcerMaps = register_cvar( "km_stabacer", "0" );
    g_pGhostChat = register_cvar( "km_ghostchat", "1" );
    
    g_iMsgSayText = get_user_msgid( "SayText" );
    
    register_impulse( 201, "FwdSprayImpulse" );
 
    RegisterHam( Ham_Weapon_PrimaryAttack, "weapon_knife", "FwdKnifePrimaryAttack" );
    RegisterHam( Ham_Spawn, "player", "FwdPlayerSpawnPost", 1 );
    RegisterHam( Ham_Killed, "player", "FwdPlayerKilled" );
    RegisterHam( Ham_ObjectCaps, "player", "FwdObjectCaps" );
    
    register_clcmd( "say", "CmdSay" );
    register_clcmd( "say /cam", "CmdCamera" );
    register_clcmd( "say /camera", "CmdCamera" );
    register_clcmd( "say /respawn", "CmdRespawn" );
    
    if( get_pcvar_num( g_pRemoveBomb ) )
    {
        remove_entity_name( "func_bomb_target" );
        remove_entity_name( "info_bomb_target" );
    }
    
    // - Because the block buying method doesn't work the first round
    server_cmd( "sv_restart 1" );
}    
 
public plugin_cfg()
{
    new szMap[ 33 ];
    get_mapname( szMap, 32 );
    
    if( containi( szMap, "1hp" ) != -1 && !equal( szMap, "1hp" ) )
    {
        g_iMapType = TYPE_1HP;
    }
    
    if( containi( szMap, "35hp" ) != -1 )
    {
        g_iMapType |= TYPE_35HP;
    }
    
    if( containi( szMap, "acer" ) != -1 )
    {
        g_iMapType |= TYPE_ACER;
    }
    
    if( containi( szMap, "wire" ) != -1 )
    {
        g_iMapType |= TYPE_WIRE;
    }
        
    new iLen = charsmax( g_szFreeHitMenu );
 
    add( g_szFreeHitMenu, iLen, "\yGive a free hit to \r%s?^n^n" );
    add( g_szFreeHitMenu, iLen, "1. \wYes^n" );
    add( g_szFreeHitMenu, iLen, "\r2. \wNo" );
    
    register_menucmd( register_menuid( "FreeHitMenu" ), g_iKeysFreeHitMenu, "HandleFreeHitMenu" );
}
 
public client_disconnect( iClient )
{
    g_bCamera[ iClient ] = false;
    g_bSpawned[ iClient ] = false;
}
 
public client_PreThink( iClient )
{
    if( !get_pcvar_num( g_pRespawn ) || is_user_alive( iClient ) || !InTeam( iClient ) )
    {
        return PLUGIN_CONTINUE;
    }
    
    if( g_fTimers[ iClient ][ RESPAWN ] <= get_gametime() )
    {
        ExecuteHamB( Ham_CS_RoundRespawn, iClient );
    }
    
    return PLUGIN_CONTINUE;
}
 
public FwdPlayerSpawnPost( iClient )
{
    if( !is_user_alive( iClient ) )
    {
        return HAM_IGNORED;
    }
    
    strip_user_weapons( iClient );
    give_item( iClient, "weapon_knife" );
        
    g_iButtonCount[ iClient ] = 0;
    g_iFreeHitCount[ iClient ] = 0;
        
    if( !g_bSpawned[ iClient ] && get_pcvar_num( g_pFreeHits ) )
    {
        g_bSpawned[ iClient ] = true;
        
        GreenPrint( iClient, "If you want to request a free hit, press your +use key 3 times while aiming at an enemy." );
    }
        
    if( g_bCamera[ iClient ] )
    {
        set_view( iClient, CAMERA_3RDPERSON );
    }
        
    if( g_iMapType & ( TYPE_35HP | TYPE_1HP ) )
    {
        remove_task( iClient + TASK_CHECKHEALTH );
        set_task( 1.0, "TaskCheckHealth", iClient + TASK_CHECKHEALTH );
    }
    
    return HAM_IGNORED;
}
 
public FwdArmouryEntitySpawn( iEnt )
{
    remove_entity( iEnt );
}
 
public FwdPlayerKilled( iClient )
{
    if( is_user_connected( iClient ) )
    {
        if( g_bCamera[ iClient ] )
        {
            set_view( iClient, CAMERA_NONE );
        }
        
        if( get_pcvar_num( g_pRespawn ) )
        {
            g_fTimers[ iClient ][ RESPAWN ] = get_gametime( ) + 1.5;
        }
    }
}
 
public FwdKnifePrimaryAttack( iEnt )
{
    if( get_pcvar_num( g_pStabAcerMaps ) && g_iMapType & TYPE_ACER )
    {
        ExecuteHamB( Ham_Weapon_SecondaryAttack, iEnt );
        
        return HAM_SUPERCEDE;
    }
    
    return HAM_IGNORED;
}
 
public FwdObjectCaps( iClient )
{
    if( !is_user_connected( iClient ) || !( entity_get_int( iClient, EV_INT_button ) & IN_USE ) )
    {
        return HAM_IGNORED;
    }
    
    new iFreeHits = get_pcvar_num( g_pFreeHits );
    
    if( !iFreeHits )
    {
        return HAM_IGNORED;
    }
    
    new iTarget, iBody;
    get_user_aiming( iClient, iTarget, iBody );
            
    if( is_user_connected( iTarget ) && cs_get_user_team( iClient ) != cs_get_user_team( iTarget ) )
    {
        new Float:fTime = get_gametime( );
   	         
        if( g_fTimers[ iClient ][ NEXTUSE ] <= fTime )
        {
            if( g_fTimers[ iClient ][ LASTUSE ] <= fTime - 1.5 )
            {
   	         g_iButtonCount[ iClient ] = 0;
   	         
   	         return HAM_IGNORED;
            }
            
            g_iButtonCount[ iClient ]++;
            g_fTimers[ iClient ][ NEXTUSE ] = fTime + 0.25;
            g_fTimers[ iClient ][ LASTUSE ] = fTime;
   		         
            if( g_iButtonCount[ iClient ] == 3 )
            {
   	         if( g_iFreeHitCount[ iClient ] >= iFreeHits )
   	         {
   		         GreenPrint( iClient, "You can only request free hits %i times per round.", iFreeHits );
   	         }
   			         
   	         else if( g_iRequester[ iTarget ] > 0 )
   	         {
   		         GreenPrint( iClient, "This player is already treating another free hit request." );
   	         }
   			         
   	         else if( get_user_health( iClient ) > 65 )
   	         {
   		         GreenPrint( iClient, "Your health must be below 65 to request a free hit." );
   	         }
   			         
   	         else if( get_user_health( iTarget ) <= 65 )
   	         {
   		         new szName[ 33 ];
   		         get_user_name( iTarget, szName, 32 );
   				         
   		         GreenPrint( iClient, "%s already has 65 HP or less.", szName );
   	         }
   			         
   	         else
   	         {
   		         g_iFreeHitCount[ iClient ]++;
   		         g_iRequester[ iTarget ] = iClient;
   		         
   		         new szMenu[ 128 ], szName[ 33 ];
   		         get_user_name( iClient, szName, 32 );
   		         formatex( szMenu, 127, g_szFreeHitMenu, szName );
        
   		         show_menu( iClient, g_iKeysFreeHitMenu, g_szFreeHitMenu, 5, "FreeHitMenu" );
   		         set_task( 5.0, "TaskCheckMenu", iClient + TASK_CHECKMENU );
   		         
   		         GreenPrint( iClient, "Request sent.." );
   	         }
            }
        }
    }
    
    return HAM_IGNORED;
}
 
public FwdSprayImpulse( iClient )
{
    if( g_iMapType & TYPE_WIRE )
    {
        return PLUGIN_HANDLED;
    }
    
    return PLUGIN_CONTINUE;
}    
 
public CmdSay( iClient )
{
    if( get_pcvar_num( g_pGhostChat ) )
    {
        new szMsg[ 192 ];
        read_args( szMsg, 191 );
        remove_quotes( szMsg );
        
        if( szMsg[ 0 ] )
        {
            new szName[ 33 ];
            get_user_name( iClient, szName, 32 );
            format( szMsg, 191, "^x01%s^x03%s^x01 :  %s", is_user_alive( iClient ) ? "" : "*DEAD* ", szName, szMsg );
            UTIL_SayText( 0, iClient, szMsg );
        
            return PLUGIN_HANDLED_MAIN;
        }
    }
    
    return PLUGIN_CONTINUE;
}
        
 
public CmdCamera( iClient )
{
    if( get_pcvar_num( g_pCamera ) )
    {
        if( ( g_bCamera[ iClient ] = !g_bCamera[ iClient ] ) )
        {
            if( is_user_alive( iClient ) )
            {
   	         set_view( iClient, CAMERA_3RDPERSON )
            }
            
            GreenPrint( iClient, "Camera enabled." );
        }
        
        else
        {
            set_view( iClient, CAMERA_NONE );
            GreenPrint( iClient, "Camera disabled." );
        }
    }
}
 
public CmdRespawn( iClient )
{
    if( get_pcvar_num( g_pRespawn ) && !is_user_alive( iClient ) && InTeam( iClient ) )
    {
        set_hudmessage( 0, 255, 0, -1.0, -1.0, 1, 0.0, 4.0, 0.0, 0.0, -1 )
        show_hudmessage( iClient, "Press primary attack button to respawn." );
    }
}    
 
public HandleFreeHitMenu( iClient, iKey )
{
    new szNameTarget[ 33 ], szNameReq[ 33 ];
    get_user_name( iClient, szNameTarget, 32 );
    get_user_name( g_iRequester[ iClient ], szNameReq, 32 );
    
    switch( iKey )
    {
        case 0:
        {
            entity_set_float( iClient, EV_FL_health, entity_get_float( g_iRequester[ iClient ], EV_FL_health ) )
            
            GreenPrint( 0, "%s accepted a free hit request from %s. They now have the same health.", szNameTarget, szNameReq );
        }
        
        case 1:
        {
            GreenPrint( 0, "%s declined a free hit request from %s.", szNameTarget, szNameReq );
        }
    }
    
    g_iRequester[ iClient ] = 0;
    
    remove_task( iClient + TASK_CHECKMENU );
}    
 
public TaskCheckHealth( iClient )
{
    iClient -= TASK_CHECKHEALTH;
    
    new iHealth = get_user_health( iClient );
    
    if( g_iMapType & TYPE_1HP && iHealth != 1 )
    {
        entity_set_float( iClient, EV_FL_health, 1.0 );
    }
    
    else if( g_iMapType & TYPE_35HP && iHealth != 35 )
    {
        entity_set_float( iClient, EV_FL_health, 35.0 );
    }
}
 
public TaskCheckMenu( iClient )
{
    iClient -= TASK_CHECKMENU;
    
    new szNameTarget[ 33 ], szNameReq[ 33 ];
    get_user_name( iClient, szNameTarget, 32 );
    get_user_name( g_iRequester[ iClient ], szNameReq, 32 );
    
    GreenPrint( 0, "%s didn't answer %s's free hit request.", szNameTarget, szNameReq );
    
    g_iRequester[ iClient ] = 0;
}
        
GreenPrint( const iClient, const szText[], any:... )
{
    new szMsg[ 192 ], iLen = formatex( szMsg, 191, "^x04[KM]^x01 " );
    vformat( szMsg[ iLen ], 191 - iLen, szText, 3 );
    UTIL_SayText( iClient, 1, szMsg );
}
 
UTIL_SayText( const iClient, const iSender, const szMsg[] )
{
    message_begin( iClient ? MSG_ONE_UNRELIABLE : MSG_BROADCAST, g_iMsgSayText, _, iClient );
    write_byte( iSender );
    write_string( szMsg );
    message_end();
}

podbijam, w regulaminie chyba nic nie ma że nie można podbijać, chyba że nie zauważyłem

Użytkownik toxic edytował ten post 26.08.2011 21:27

  • +
  • -
  • 0





Również z jednym lub większą ilością słów kluczowych: Modyfikacja

Użytkownicy przeglądający ten temat: 0

0 użytkowników, 0 gości, 0 anonimowych