Raised This Month: $344 Target: $400
 86%   Almost there!

I need to add something


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Yeoo
Junior Member
Join Date: Nov 2020
Old 11-24-2020 , 08:25   I need to add something
Reply With Quote #1

  • Hi, I have this plugin that gives the last ct in life a knife with a very large dmg.
  • I wish I could give this knife to any CT alive, but it only works for me.
  • And I don't know why I can't make his dmg bigger.
  • Can anyone do this for me?
  • Thank you in advance.
PHP Code:
#pragma tabsize 0

#include <amxmodx>
#include <fun>
#include <cstrike>
#include < fakemeta >
#include <hamsandwich>

new SurvivorFound=0;
new 
bool:is_last_survivor[33] = false;
new const 
v_lamasurvivor[66] = "models/v_cutitsurvivor.mdl"
new const v_cutitdefault[66] = "models/v_knife.mdl"

public plugin_init() 
{
    
register_plugin("SERVER LAST ALIVE""2.0""LaW")
    
    
set_task 2.0"TASK_RESTRICT"___"b" );
    
register_event("HLTV""NewRound""a""1=0""2=0");
    
register_clcmd("amx_knife","adminknife");
    
RegisterHam(Ham_TakeDamage"player""fw_PlayerTakeDamage");
    
register_event"CurWeapon""CurWeapon""be""1=1" )
}

public 
plugin_precache( )
{
    
precache_model v_lamasurvivor );
}

public 
CurWeapon(id)
{
    new 
Weapon get_user_weapon(id)

    if ( 
Weapon == CSW_KNIFE && is_last_survivor[id]==true)
    {
        
set_pev(idpev_viewmodel2v_lamasurvivor);
    }
}

public 
adminknife(id)
{
    if(
get_user_flags(id) & read_flags("a"))
    {
        if(
get_user_team(id) != 2)
        {
            
client_print(idprint_console"[SERVER] U have to be CT to use this knife")
            return 
PLUGIN_HANDLED;
        }
        
is_last_survivor[id]=true;
        new 
Weapon get_user_weapon(id)

        if ( 
Weapon == CSW_KNIFE)
        {
            
set_pev(idpev_viewmodel2v_lamasurvivor);
        }
        
client_print(idprint_console"[SERVER] %s recieved a super knife")
        return 
PLUGIN_HANDLED;
    }
    else
    {
        
client_print(idprint_console"[SERVER] U dont have acces to this command")
        return 
PLUGIN_HANDLED;
    }
    return 
PLUGIN_CONTINUE;
}
public 
NewRound ( ) {
    
SurvivorFound=0;
    for(new 
id 1id <= get_maxplayers(); id++)
    {
        if(
is_user_connected(id))
        {
            
is_last_survivor[id] = false
            set_pev
(idpev_viewmodel2v_cutitdefault);
        }
    }
}

public 
TASK_RESTRICT ( ) {
    
    static 
id
    
new AliveCount
    
for(id 1id <= get_maxplayers(); id++) {
        if(
is_user_connected(id) && is_user_alive(id) && get_user_team(id) == 2) {
            
AliveCount++;
        }
    }
    
    new 
szName[32];
    for(
id 1id <= get_maxplayers(); id++)
    {
        if(
is_user_connected(id) && is_user_alive(id) && get_user_team(id) == 2)
        {
            if(
AliveCount == && SurvivorFound==0)
            {
                
SurvivorFound=1;
                
is_last_survivor[id] = true
                get_user_name
(idszNamecharsmax(szName));
                new 
Weapon get_user_weapon(id)

                if ( 
Weapon == CSW_KNIFE)
                {
                    
set_pev(idpev_viewmodel2v_lamasurvivor);
                }
                
color_chat 0"!g[SERVER]!team %s received a super knife"szName)
            }
        }
    }
    
AliveCount=0
}

public 
fw_PlayerTakeDamage(victiminflictorattackerFloat:fDamageiDamageType)
{
    if(
iDamageType DMG_GENERIC || victim == attacker || !is_user_alive(victim))
        return 
HAM_IGNORED;
    new 
Weapon get_user_weapon(attacker)
    if(
is_last_survivor[attacker] && is_user_alive(attacker))
    {
        if ( 
Weapon == CSW_KNIFE )
        {
            
fDamage *= 50;
            
//set_pev(attacker, pev_viewmodel2, v_lamasurvivor);
            
SetHamParamFloat(4fDamage);
            return 
HAM_HANDLED;
        }
    }
    return 
HAM_IGNORED;
}

stock color_chat(const id, const input[], any:...)
{
    new 
count 1Jucatori[32]
    static 
msg[191]
    
vformat(msg190input3)
    
    
replace_all(msg190"!g""^4"// Culoarea Verde
    
replace_all(msg190"!y""^1"// Culoarea Normala a Chat-ului (galben)
    
replace_all(msg190"!team""^3"// Culoarea Echipei : CT = Albastru | T = Rosu.
    
    
if (idJucatori[0] = id; else get_players(Jucatoricount"ch")
    {
     for (new 
0countY++)
        {
        if (
is_user_connected(Jucatori[Y]))
               {
            
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("SayText"), _Jucatori[Y])
            
write_byte(Jucatori[Y]);
            
write_string(msg);
            
message_end();
            }
        }

    }

Yeoo is offline
redivcram
Veteran Member
Join Date: Jul 2014
Location: Serbia
Old 11-24-2020 , 13:32   Re: I need to add something
Reply With Quote #2

PHP Code:
public CurWeapon(id

    new 
Weapon get_user_weapon(id

    if ( 
Weapon == CSW_KNIFE
    { 
        
set_pev(idpev_viewmodel2v_lamasurvivor); 
    } 

Remove "is_last_survivor[id] == true", pretty self-explanatory.
redivcram is offline
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 09:57.


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