I need to add something
- 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(id, pev_viewmodel2, v_lamasurvivor);
}
}
public adminknife(id)
{
if(get_user_flags(id) & read_flags("a"))
{
if(get_user_team(id) != 2)
{
client_print(id, print_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(id, pev_viewmodel2, v_lamasurvivor);
}
client_print(id, print_console, "[SERVER] %s recieved a super knife")
return PLUGIN_HANDLED;
}
else
{
client_print(id, print_console, "[SERVER] U dont have acces to this command")
return PLUGIN_HANDLED;
}
return PLUGIN_CONTINUE;
}
public NewRound ( ) {
SurvivorFound=0;
for(new id = 1; id <= get_maxplayers(); id++)
{
if(is_user_connected(id))
{
is_last_survivor[id] = false
set_pev(id, pev_viewmodel2, v_cutitdefault);
}
}
}
public TASK_RESTRICT ( ) {
static id
new AliveCount
for(id = 1; id <= get_maxplayers(); id++) {
if(is_user_connected(id) && is_user_alive(id) && get_user_team(id) == 2) {
AliveCount++;
}
}
new szName[32];
for(id = 1; id <= get_maxplayers(); id++)
{
if(is_user_connected(id) && is_user_alive(id) && get_user_team(id) == 2)
{
if(AliveCount == 1 && SurvivorFound==0)
{
SurvivorFound=1;
is_last_survivor[id] = true
get_user_name(id, szName, charsmax(szName));
new Weapon = get_user_weapon(id)
if ( Weapon == CSW_KNIFE)
{
set_pev(id, pev_viewmodel2, v_lamasurvivor);
}
color_chat ( 0, "!g[SERVER]!team %s received a super knife", szName)
}
}
}
AliveCount=0
}
public fw_PlayerTakeDamage(victim, inflictor, attacker, Float:fDamage, iDamageType)
{
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(4, fDamage);
return HAM_HANDLED;
}
}
return HAM_IGNORED;
}
stock color_chat(const id, const input[], any:...)
{
new count = 1, Jucatori[32]
static msg[191]
vformat(msg, 190, input, 3)
replace_all(msg, 190, "!g", "^4") // Culoarea Verde
replace_all(msg, 190, "!y", "^1") // Culoarea Normala a Chat-ului (galben)
replace_all(msg, 190, "!team", "^3") // Culoarea Echipei : CT = Albastru | T = Rosu.
if (id) Jucatori[0] = id; else get_players(Jucatori, count, "ch")
{
for (new Y = 0; Y < count; Y++)
{
if (is_user_connected(Jucatori[Y]))
{
message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, Jucatori[Y])
write_byte(Jucatori[Y]);
write_string(msg);
message_end();
}
}
}
}
|