DarkRed
05-05-2014, 10:22 PM
Salut .
De curand am facut un server de deathrun ... e FAKE ( Il tin doar pentru "antrenament" , dueluri ) ,Dar vreau neaparat sa fie aproape perfect :))
Am gasit si eu un plugin ... totul merge perfect ... pana cand intru pe server si scriu "/knife" dupa daca vreau sa aleg un knife (adika apas pe un numar ex: 3 ) Imi apare urmatoarea eroare
<b>You have to register to ba able to see this link</b> (<b>You have to register to ba able to see this link</b>)
#include < amxmodx >
#include < fakemeta >
#include < hamsandwich >
#include < engine >
#include < cstrike >
#include < fun >
/* Credite : wouter ( pluginul de camouflage ) */
#define IsPlayer(%0) ( 1 <= %0 <= g_iMaxPlayers )
enum Color
{
NORMAL = 1, // clients scr_concolor cvar color
GREEN, // Green Color
TEAM_COLOR, // Red, grey, blue
GREY, // grey
RED, // Red
BLUE, // Blue
}
new const TeamName[][] =
{
"",
"TERRORIST",
"CT",
"SPECTATOR"
}
new bool: HasKnife [ 33 ] [ 8 ]
new bool: HasUltimate [ 33 ]
new const szKnifes [ ] [ ] = {
"models/UltimateKnife/knife1.mdl",
"models/UltimateKnife/knife2.mdl",
"models/UltimateKnife/knife3.mdl",
"models/UltimateKnife/knife4.mdl",
"models/UltimateKnife/knife5.mdl",
"models/UltimateKnife/knife6.mdl",
"models/UltimateKnife/all_in_one_knife.mdl"
}
new const g_szMessage [ ] [ ] = {
"Ai Maceta ( DMG mai mare / Speed mai mic)",
"Ai Bak Knife ( Silent FootSteps )",
"Ai Pocket Knife ( Viteza mai mare )",
"Ai Butcher Knife ( Gravitatie scazuta )",
"Ai Default Knife ( Hp Regen )",
"Ai Ninja Knife ( Deghizare )",
"Ai All-In-One Knife",
"Nu ai nici un knife. Scrie /knife pentru a deschide meniul"
}
new g_iMaxPlayers;
new cvar_knifes [ 6 ]
new gravity_value, gravity_pointer
#define MAX_PLAYERS 32
new bool:HasCamo[33]
new CTModels[] =
{
"urban", "gsg9",
"gign", "sas"
}
new TModels[] =
{
"terror", "leet",
"artic", "guerilla"
}
public plugin_init()
{
register_plugin("Ultimate Knife Menu", "0.1", "HamletEagle")
register_clcmd("say /knife", "ShowMenu")
register_event("CurWeapon", "Event_CurWeapon", "be", "1=1")
RegisterHam(Ham_Spawn, "player", "fwHamPlayerSpawnPost", 1)
RegisterHam ( Ham_TakeDamage, "player", "Player_TakeDamage" );
g_iMaxPlayers = get_maxplayers ( )
cvar_knifes [ 1 ] = register_cvar ( "knife1_damage" , "2" )
cvar_knifes [ 2 ] = register_cvar ( "knife1_speed" , "2" )
cvar_knifes [ 3 ] = register_cvar ( "knife3_speed" , "2" )
cvar_knifes [ 4 ] = register_cvar ( "knife4_gravity" , "2" )
cvar_knifes [ 5 ] = register_cvar ( "knife5_regen" , "2" )
gravity_value = get_cvar_pointer ( "sv_gravity" )
gravity_pointer = get_pcvar_num ( gravity_value )
register_event("DeathMsg", "DeathEvent", "a")
register_event("ResetHUD", "ResetHud", "a")
register_event("StatusValue", "statusvalue", "be", "1=2")
}
public plugin_precache ( ) {
for ( new i ; i < sizeof ( szKnifes ) ; i ++ )
precache_model ( szKnifes [ i ] )
}
public statusvalue(id) {
new target = read_data(2)
if (!target)
return PLUGIN_HANDLED
new name1[32], name2[32]
get_user_name(id, name1, 31) // aimer
get_user_name(target, name2, 31) // aimed
if (get_user_team(id) != get_user_team(target))
{
// ENEMY
}
else
{
//TEAM MATE
if(HasCamo[target] == true)
{
set_hudmessage(255, 0, 0, -1.0, -1.0, 0, 6.0, 12.0)
show_hudmessage(id, "DON't SHOOT %s", name2)
}
}
return PLUGIN_HANDLED
}
public DeathEvent() {
new id = read_data(2)
if ( HasCamo[id] == true ) {
set_task( 1.0, "reset_model", id )
}
return PLUGIN_HANDLED
}
public ResetHud(id) {
new CsTeams:team = cs_get_user_team(id)
if ( HasCamo[id] == true ) {
if (team == CS_TEAM_CT) {
cs_set_user_model(id, TModels)
}
else if (team == CS_TEAM_T) {
cs_set_user_model(id, CTModels)
}
}
return PLUGIN_HANDLED
}
public reset_model(id) {
cs_reset_user_model(id)
HasCamo[id] = false
}
public fwHamPlayerSpawnPost ( id ) {
if ( HasKnife [ id ] [ 1 ] )
ColorChat ( id , GREEN , "%s" , g_szMessage [ 0 ] )
else if ( HasKnife [ id ] [ 2 ] )
ColorChat ( id , GREEN , "%s" , g_szMessage [ 1 ] )
else if ( HasKnife [ id ] [ 3 ] )
ColorChat ( id , GREEN , "%s" , g_szMessage [ 2 ] )
else if ( HasKnife [ id ] [ 4 ] )
ColorChat ( id , GREEN , "%s" , g_szMessage [ 3 ] )
else if ( HasKnife [ id ] [ 5 ] )
ColorChat ( id , GREEN , "%s" , g_szMessage [ 4 ] )
else if ( HasKnife [ id ] [ 6 ] )
ColorChat ( id , GREEN , "%s" , g_szMessage [ 5 ] )
else if ( HasKnife [ id ] [ 7 ] )
ColorChat ( id , GREEN , "%s" , g_szMessage [ 6 ] )
else
ColorChat ( id , GREEN , "%s" , g_szMessage [ 7 ] )
if ( ! HasUltimate [ id ] ) {
if ( ! HasKnife [ id ] [ 2 ] )
set_user_footsteps ( id , 0 )
if ( ! HasKnife [ id ] [ 4 ] )
entity_set_float ( id , EV_FL_gravity , float ( gravity_pointer ) )
if ( ! HasKnife [ id ] [ 6 ] )
HasCamo [ id ] = false
}
}
public Event_CurWeapon ( id ) {
if ( HasKnife [ id ] [ 1 ] ) {
set_pev ( id, pev_viewmodel2, szKnifes [ id ] [ 0 ] );
entity_set_float ( id , EV_FL_speed , float ( get_pcvar_num ( cvar_knifes [ 1 ] ) ) )
}
if ( HasKnife [ id ] [ 2 ] ) {
set_pev ( id, pev_viewmodel2, szKnifes [ id ] [ 1 ] );
}
if ( HasKnife [ id ] [ 3 ] ) {
set_pev ( id, pev_viewmodel2, szKnifes [ id ] [ 2 ] );
entity_set_float ( id , EV_FL_speed , float ( get_pcvar_num ( cvar_knifes [ 3 ] ) ) )
}
if ( HasKnife [ id ] [ 4 ] ) {
//set_pev ( id, pev_viewmodel2, szKnifes [ id ] [ 3 ] );
}
if ( HasKnife [ id ] [ 5 ] ) {
set_pev ( id, pev_viewmodel2, szKnifes [ id ] [ 4 ] );
}
if ( HasKnife [ id ] [ 6 ] ) {
set_pev ( id, pev_viewmodel2, szKnifes [ id ] [ 5 ] );
}
if ( HasKnife [ id ] [ 7 ] ) {
set_pev ( id, pev_viewmodel2, szKnifes [ id ] [ 6 ] );
}
if ( HasUltimate [ id ] ) {
entity_set_float ( id , EV_FL_speed , float ( get_pcvar_num ( cvar_knifes [ 3 ] ) ) )
set_user_footsteps ( id , 1 )
entity_set_float ( id , EV_FL_gravity , float ( get_pcvar_num ( cvar_knifes [ 4 ] ) ) )
}
}
public ShowMenu(id)
{
new menu = menu_create("Titlu", "knife_handler");
menu_additem(menu, "Machete (mai multe daune / viteza mica)", "", 0); // case 0
menu_additem(menu, "Bak Knife (Fara pasi)", "", 0); // case 1
menu_additem(menu, "Pocket Knife (Viteza mare)", "", 0); // case 2
menu_additem(menu, "Butcher Knife (Gravitatie scazuta)", "", 0); // case 3
menu_additem(menu, "Default Knife (Viata regenerata)", "", 0); // case 4
menu_additem(menu, "Ninja Knife (Deghizare Abilitate)", "", 0); // case 5
menu_additem(menu, "Admins/Vips Knife (All In One)", "", 0); // case 6
menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
menu_display(id, menu, 0);
return PLUGIN_HANDLED;
}
public knife_handler(id, menu, item)
{
if(item == MENU_EXIT)
{
menu_cancel(id);
return PLUGIN_HANDLED;
}
new command[6], name[64], access, callback;
menu_item_getinfo(menu, item, access, command, sizeof command - 1, name, sizeof name - 1, callback);
switch(item)
{
case 0: {
HasKnife [ id ] [ 1 ] = true
HasKnife [ id ] [ 2 ] = false
HasKnife [ id ] [ 3 ] = false
HasKnife [ id ] [ 4 ] = false
HasKnife [ id ] [ 5 ] = false
HasKnife [ id ] [ 6 ] = false
HasKnife [ id ] [ 7 ] = false
set_pev ( id, pev_viewmodel2, szKnifes [ id ] [ 0 ] );
entity_set_float ( id , EV_FL_speed , float ( get_pcvar_num ( cvar_knifes [ 3 ] ) ) )
}
case 1: {
HasKnife [ id ] [ 1 ] = false
HasKnife [ id ] [ 2 ] = true
HasKnife [ id ] [ 3 ] = false
HasKnife [ id ] [ 4 ] = false
HasKnife [ id ] [ 5 ] = false
HasKnife [ id ] [ 6 ] = false
HasKnife [ id ] [ 7 ] = false
set_pev ( id, pev_viewmodel2, szKnifes [ id ] [ 1 ] );
set_user_footsteps ( id , 1 )
}
case 2: {
HasKnife [ id ] [ 1 ] = false
HasKnife [ id ] [ 2 ] = false
HasKnife [ id ] [ 3 ] = true
HasKnife [ id ] [ 4 ] = false
HasKnife [ id ] [ 5 ] = false
HasKnife [ id ] [ 6 ] = false
HasKnife [ id ] [ 7 ] = false
set_pev ( id, pev_viewmodel2, szKnifes [ id ] [ 2 ] );
entity_set_float ( id , EV_FL_speed , float ( get_pcvar_num ( cvar_knifes [ 3 ] ) ) )
}
case 3: {
HasKnife [ id ] [ 1 ] = false
HasKnife [ id ] [ 2 ] = false
HasKnife [ id ] [ 3 ] = false
HasKnife [ id ] [ 4 ] = true
HasKnife [ id ] [ 5 ] = false
HasKnife [ id ] [ 6 ] = false
HasKnife [ id ] [ 7 ] = false
set_pev ( id, pev_viewmodel2, szKnifes [ id ] [ 3 ] );
entity_set_float ( id , EV_FL_gravity , float ( get_pcvar_num ( cvar_knifes [ 4 ] ) ) )
}
case 4: {
HasKnife [ id ] [ 1 ] = false
HasKnife [ id ] [ 2 ] = false
HasKnife [ id ] [ 3 ] = false
HasKnife [ id ] [ 4 ] = false
HasKnife [ id ] [ 5 ] = true
HasKnife [ id ] [ 6 ] = false
HasKnife [ id ] [ 7 ] = false
//set_pev ( id, pev_viewmodel2, szKnifes [ id ] [ 4 ] );
set_task ( 0.1 , "RegenHp" )
}
case 5: {
HasKnife [ id ] [ 1 ] = false
HasKnife [ id ] [ 2 ] = false
HasKnife [ id ] [ 3 ] = false
HasKnife [ id ] [ 4 ] = false
HasKnife [ id ] [ 5 ] = false
HasKnife [ id ] [ 6 ] = true
HasKnife [ id ] [ 7 ] = false
set_pev ( id, pev_viewmodel2, szKnifes [ id ] [ 5 ] );
HasCamo[ id ] = true
}
case 6: {
HasKnife [ id ] [ 1 ] = false
HasKnife [ id ] [ 2 ] = false
HasKnife [ id ] [ 3 ] = false
HasKnife [ id ] [ 4 ] = false
HasKnife [ id ] [ 5 ] = false
HasKnife [ id ] [ 6 ] = false
HasKnife [ id ] [ 7 ] = true
set_pev ( id, pev_viewmodel2, szKnifes [ id ] [ 6 ] );
HasUltimate [ id ] = true
HasCamo[ id ] = true
}
}
menu_destroy(menu);
return PLUGIN_HANDLED;
}
public Player_TakeDamage ( iVictim, iInflictor, iAttacker, Float:fDamage ) {
if ( iInflictor == iAttacker && IsPlayer ( iAttacker ) && get_user_weapon ( iAttacker ) == CSW_KNIFE ) {
if ( HasKnife [ iAttacker ] [ 1 ] || HasUltimate [ iAttacker ] ) {
SetHamParamFloat ( 4, fDamage * float ( get_pcvar_num ( cvar_knifes [ 1 ] ) ) );
return HAM_HANDLED;
}
}
return HAM_IGNORED;
}
public RegenHp ( id ) {
if ( HasKnife [ id ] [ 5 ] || HasUltimate [ id ] ) {
if ( entity_get_float ( id , EV_FL_health ) < float ( 100 ) ) {
entity_set_float ( id , EV_FL_health , entity_get_float ( id , EV_FL_health ) + float ( get_pcvar_num ( cvar_knifes [ 5 ] ) ) )
}
}
}
ColorChat(id, Color:type, const msg[], any:...)
{
new message[256];
switch(type)
{
case NORMAL: // clients scr_concolor cvar color
{
message[0] = 0x01;
}
case GREEN: // Green
{
message[0] = 0x04;
}
default: // White, Red, Blue
{
message[0] = 0x03;
}
}
vformat(message[1], 251, msg, 4);
// Make sure message is not longer than 192 character. Will crash the server.
message[192] = '^0';
new team, ColorChange, index, MSG_Type;
if(id)
{
MSG_Type = MSG_ONE_UNRELIABLE;
index = id;
} else {
index = FindPlayer();
MSG_Type = MSG_BROADCAST;
}
team = get_user_team(index);
ColorChange = ColorSelection(index, MSG_Type, type);
ShowColorMessage(index, MSG_Type, message);
if(ColorChange)
{
Team_Info(index, MSG_Type, TeamName[team]);
}
}
ShowColorMessage(id, type, message[])
{
static msgSayText;
if(!msgSayText)
{
msgSayText = get_user_msgid("SayText");
}
message_begin(type, msgSayText, _, id);
write_byte(id)
write_string(message);
message_end();
}
Team_Info(id, type, team[])
{
static msgTeamInfo;
if(!msgTeamInfo)
{
msgTeamInfo = get_user_msgid("TeamInfo");
}
message_begin(type, msgTeamInfo, _, id);
write_byte(id);
write_string(team);
message_end();
return 1;
}
ColorSelection(index, type, Color:Type)
{
switch(Type)
{
case RED:
{
return Team_Info(index, type, TeamName[1]);
}
case BLUE:
{
return Team_Info(index, type, TeamName[2]);
}
case GREY:
{
return Team_Info(index, type, TeamName[0]);
}
}
return 0;
}
FindPlayer()
{
new i = -1;
while(i <= get_maxplayers())
{
if(is_user_connected(++i))
return i;
}
return -1;
}
De curand am facut un server de deathrun ... e FAKE ( Il tin doar pentru "antrenament" , dueluri ) ,Dar vreau neaparat sa fie aproape perfect :))
Am gasit si eu un plugin ... totul merge perfect ... pana cand intru pe server si scriu "/knife" dupa daca vreau sa aleg un knife (adika apas pe un numar ex: 3 ) Imi apare urmatoarea eroare
<b>You have to register to ba able to see this link</b> (<b>You have to register to ba able to see this link</b>)
#include < amxmodx >
#include < fakemeta >
#include < hamsandwich >
#include < engine >
#include < cstrike >
#include < fun >
/* Credite : wouter ( pluginul de camouflage ) */
#define IsPlayer(%0) ( 1 <= %0 <= g_iMaxPlayers )
enum Color
{
NORMAL = 1, // clients scr_concolor cvar color
GREEN, // Green Color
TEAM_COLOR, // Red, grey, blue
GREY, // grey
RED, // Red
BLUE, // Blue
}
new const TeamName[][] =
{
"",
"TERRORIST",
"CT",
"SPECTATOR"
}
new bool: HasKnife [ 33 ] [ 8 ]
new bool: HasUltimate [ 33 ]
new const szKnifes [ ] [ ] = {
"models/UltimateKnife/knife1.mdl",
"models/UltimateKnife/knife2.mdl",
"models/UltimateKnife/knife3.mdl",
"models/UltimateKnife/knife4.mdl",
"models/UltimateKnife/knife5.mdl",
"models/UltimateKnife/knife6.mdl",
"models/UltimateKnife/all_in_one_knife.mdl"
}
new const g_szMessage [ ] [ ] = {
"Ai Maceta ( DMG mai mare / Speed mai mic)",
"Ai Bak Knife ( Silent FootSteps )",
"Ai Pocket Knife ( Viteza mai mare )",
"Ai Butcher Knife ( Gravitatie scazuta )",
"Ai Default Knife ( Hp Regen )",
"Ai Ninja Knife ( Deghizare )",
"Ai All-In-One Knife",
"Nu ai nici un knife. Scrie /knife pentru a deschide meniul"
}
new g_iMaxPlayers;
new cvar_knifes [ 6 ]
new gravity_value, gravity_pointer
#define MAX_PLAYERS 32
new bool:HasCamo[33]
new CTModels[] =
{
"urban", "gsg9",
"gign", "sas"
}
new TModels[] =
{
"terror", "leet",
"artic", "guerilla"
}
public plugin_init()
{
register_plugin("Ultimate Knife Menu", "0.1", "HamletEagle")
register_clcmd("say /knife", "ShowMenu")
register_event("CurWeapon", "Event_CurWeapon", "be", "1=1")
RegisterHam(Ham_Spawn, "player", "fwHamPlayerSpawnPost", 1)
RegisterHam ( Ham_TakeDamage, "player", "Player_TakeDamage" );
g_iMaxPlayers = get_maxplayers ( )
cvar_knifes [ 1 ] = register_cvar ( "knife1_damage" , "2" )
cvar_knifes [ 2 ] = register_cvar ( "knife1_speed" , "2" )
cvar_knifes [ 3 ] = register_cvar ( "knife3_speed" , "2" )
cvar_knifes [ 4 ] = register_cvar ( "knife4_gravity" , "2" )
cvar_knifes [ 5 ] = register_cvar ( "knife5_regen" , "2" )
gravity_value = get_cvar_pointer ( "sv_gravity" )
gravity_pointer = get_pcvar_num ( gravity_value )
register_event("DeathMsg", "DeathEvent", "a")
register_event("ResetHUD", "ResetHud", "a")
register_event("StatusValue", "statusvalue", "be", "1=2")
}
public plugin_precache ( ) {
for ( new i ; i < sizeof ( szKnifes ) ; i ++ )
precache_model ( szKnifes [ i ] )
}
public statusvalue(id) {
new target = read_data(2)
if (!target)
return PLUGIN_HANDLED
new name1[32], name2[32]
get_user_name(id, name1, 31) // aimer
get_user_name(target, name2, 31) // aimed
if (get_user_team(id) != get_user_team(target))
{
// ENEMY
}
else
{
//TEAM MATE
if(HasCamo[target] == true)
{
set_hudmessage(255, 0, 0, -1.0, -1.0, 0, 6.0, 12.0)
show_hudmessage(id, "DON't SHOOT %s", name2)
}
}
return PLUGIN_HANDLED
}
public DeathEvent() {
new id = read_data(2)
if ( HasCamo[id] == true ) {
set_task( 1.0, "reset_model", id )
}
return PLUGIN_HANDLED
}
public ResetHud(id) {
new CsTeams:team = cs_get_user_team(id)
if ( HasCamo[id] == true ) {
if (team == CS_TEAM_CT) {
cs_set_user_model(id, TModels)
}
else if (team == CS_TEAM_T) {
cs_set_user_model(id, CTModels)
}
}
return PLUGIN_HANDLED
}
public reset_model(id) {
cs_reset_user_model(id)
HasCamo[id] = false
}
public fwHamPlayerSpawnPost ( id ) {
if ( HasKnife [ id ] [ 1 ] )
ColorChat ( id , GREEN , "%s" , g_szMessage [ 0 ] )
else if ( HasKnife [ id ] [ 2 ] )
ColorChat ( id , GREEN , "%s" , g_szMessage [ 1 ] )
else if ( HasKnife [ id ] [ 3 ] )
ColorChat ( id , GREEN , "%s" , g_szMessage [ 2 ] )
else if ( HasKnife [ id ] [ 4 ] )
ColorChat ( id , GREEN , "%s" , g_szMessage [ 3 ] )
else if ( HasKnife [ id ] [ 5 ] )
ColorChat ( id , GREEN , "%s" , g_szMessage [ 4 ] )
else if ( HasKnife [ id ] [ 6 ] )
ColorChat ( id , GREEN , "%s" , g_szMessage [ 5 ] )
else if ( HasKnife [ id ] [ 7 ] )
ColorChat ( id , GREEN , "%s" , g_szMessage [ 6 ] )
else
ColorChat ( id , GREEN , "%s" , g_szMessage [ 7 ] )
if ( ! HasUltimate [ id ] ) {
if ( ! HasKnife [ id ] [ 2 ] )
set_user_footsteps ( id , 0 )
if ( ! HasKnife [ id ] [ 4 ] )
entity_set_float ( id , EV_FL_gravity , float ( gravity_pointer ) )
if ( ! HasKnife [ id ] [ 6 ] )
HasCamo [ id ] = false
}
}
public Event_CurWeapon ( id ) {
if ( HasKnife [ id ] [ 1 ] ) {
set_pev ( id, pev_viewmodel2, szKnifes [ id ] [ 0 ] );
entity_set_float ( id , EV_FL_speed , float ( get_pcvar_num ( cvar_knifes [ 1 ] ) ) )
}
if ( HasKnife [ id ] [ 2 ] ) {
set_pev ( id, pev_viewmodel2, szKnifes [ id ] [ 1 ] );
}
if ( HasKnife [ id ] [ 3 ] ) {
set_pev ( id, pev_viewmodel2, szKnifes [ id ] [ 2 ] );
entity_set_float ( id , EV_FL_speed , float ( get_pcvar_num ( cvar_knifes [ 3 ] ) ) )
}
if ( HasKnife [ id ] [ 4 ] ) {
//set_pev ( id, pev_viewmodel2, szKnifes [ id ] [ 3 ] );
}
if ( HasKnife [ id ] [ 5 ] ) {
set_pev ( id, pev_viewmodel2, szKnifes [ id ] [ 4 ] );
}
if ( HasKnife [ id ] [ 6 ] ) {
set_pev ( id, pev_viewmodel2, szKnifes [ id ] [ 5 ] );
}
if ( HasKnife [ id ] [ 7 ] ) {
set_pev ( id, pev_viewmodel2, szKnifes [ id ] [ 6 ] );
}
if ( HasUltimate [ id ] ) {
entity_set_float ( id , EV_FL_speed , float ( get_pcvar_num ( cvar_knifes [ 3 ] ) ) )
set_user_footsteps ( id , 1 )
entity_set_float ( id , EV_FL_gravity , float ( get_pcvar_num ( cvar_knifes [ 4 ] ) ) )
}
}
public ShowMenu(id)
{
new menu = menu_create("Titlu", "knife_handler");
menu_additem(menu, "Machete (mai multe daune / viteza mica)", "", 0); // case 0
menu_additem(menu, "Bak Knife (Fara pasi)", "", 0); // case 1
menu_additem(menu, "Pocket Knife (Viteza mare)", "", 0); // case 2
menu_additem(menu, "Butcher Knife (Gravitatie scazuta)", "", 0); // case 3
menu_additem(menu, "Default Knife (Viata regenerata)", "", 0); // case 4
menu_additem(menu, "Ninja Knife (Deghizare Abilitate)", "", 0); // case 5
menu_additem(menu, "Admins/Vips Knife (All In One)", "", 0); // case 6
menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
menu_display(id, menu, 0);
return PLUGIN_HANDLED;
}
public knife_handler(id, menu, item)
{
if(item == MENU_EXIT)
{
menu_cancel(id);
return PLUGIN_HANDLED;
}
new command[6], name[64], access, callback;
menu_item_getinfo(menu, item, access, command, sizeof command - 1, name, sizeof name - 1, callback);
switch(item)
{
case 0: {
HasKnife [ id ] [ 1 ] = true
HasKnife [ id ] [ 2 ] = false
HasKnife [ id ] [ 3 ] = false
HasKnife [ id ] [ 4 ] = false
HasKnife [ id ] [ 5 ] = false
HasKnife [ id ] [ 6 ] = false
HasKnife [ id ] [ 7 ] = false
set_pev ( id, pev_viewmodel2, szKnifes [ id ] [ 0 ] );
entity_set_float ( id , EV_FL_speed , float ( get_pcvar_num ( cvar_knifes [ 3 ] ) ) )
}
case 1: {
HasKnife [ id ] [ 1 ] = false
HasKnife [ id ] [ 2 ] = true
HasKnife [ id ] [ 3 ] = false
HasKnife [ id ] [ 4 ] = false
HasKnife [ id ] [ 5 ] = false
HasKnife [ id ] [ 6 ] = false
HasKnife [ id ] [ 7 ] = false
set_pev ( id, pev_viewmodel2, szKnifes [ id ] [ 1 ] );
set_user_footsteps ( id , 1 )
}
case 2: {
HasKnife [ id ] [ 1 ] = false
HasKnife [ id ] [ 2 ] = false
HasKnife [ id ] [ 3 ] = true
HasKnife [ id ] [ 4 ] = false
HasKnife [ id ] [ 5 ] = false
HasKnife [ id ] [ 6 ] = false
HasKnife [ id ] [ 7 ] = false
set_pev ( id, pev_viewmodel2, szKnifes [ id ] [ 2 ] );
entity_set_float ( id , EV_FL_speed , float ( get_pcvar_num ( cvar_knifes [ 3 ] ) ) )
}
case 3: {
HasKnife [ id ] [ 1 ] = false
HasKnife [ id ] [ 2 ] = false
HasKnife [ id ] [ 3 ] = false
HasKnife [ id ] [ 4 ] = true
HasKnife [ id ] [ 5 ] = false
HasKnife [ id ] [ 6 ] = false
HasKnife [ id ] [ 7 ] = false
set_pev ( id, pev_viewmodel2, szKnifes [ id ] [ 3 ] );
entity_set_float ( id , EV_FL_gravity , float ( get_pcvar_num ( cvar_knifes [ 4 ] ) ) )
}
case 4: {
HasKnife [ id ] [ 1 ] = false
HasKnife [ id ] [ 2 ] = false
HasKnife [ id ] [ 3 ] = false
HasKnife [ id ] [ 4 ] = false
HasKnife [ id ] [ 5 ] = true
HasKnife [ id ] [ 6 ] = false
HasKnife [ id ] [ 7 ] = false
//set_pev ( id, pev_viewmodel2, szKnifes [ id ] [ 4 ] );
set_task ( 0.1 , "RegenHp" )
}
case 5: {
HasKnife [ id ] [ 1 ] = false
HasKnife [ id ] [ 2 ] = false
HasKnife [ id ] [ 3 ] = false
HasKnife [ id ] [ 4 ] = false
HasKnife [ id ] [ 5 ] = false
HasKnife [ id ] [ 6 ] = true
HasKnife [ id ] [ 7 ] = false
set_pev ( id, pev_viewmodel2, szKnifes [ id ] [ 5 ] );
HasCamo[ id ] = true
}
case 6: {
HasKnife [ id ] [ 1 ] = false
HasKnife [ id ] [ 2 ] = false
HasKnife [ id ] [ 3 ] = false
HasKnife [ id ] [ 4 ] = false
HasKnife [ id ] [ 5 ] = false
HasKnife [ id ] [ 6 ] = false
HasKnife [ id ] [ 7 ] = true
set_pev ( id, pev_viewmodel2, szKnifes [ id ] [ 6 ] );
HasUltimate [ id ] = true
HasCamo[ id ] = true
}
}
menu_destroy(menu);
return PLUGIN_HANDLED;
}
public Player_TakeDamage ( iVictim, iInflictor, iAttacker, Float:fDamage ) {
if ( iInflictor == iAttacker && IsPlayer ( iAttacker ) && get_user_weapon ( iAttacker ) == CSW_KNIFE ) {
if ( HasKnife [ iAttacker ] [ 1 ] || HasUltimate [ iAttacker ] ) {
SetHamParamFloat ( 4, fDamage * float ( get_pcvar_num ( cvar_knifes [ 1 ] ) ) );
return HAM_HANDLED;
}
}
return HAM_IGNORED;
}
public RegenHp ( id ) {
if ( HasKnife [ id ] [ 5 ] || HasUltimate [ id ] ) {
if ( entity_get_float ( id , EV_FL_health ) < float ( 100 ) ) {
entity_set_float ( id , EV_FL_health , entity_get_float ( id , EV_FL_health ) + float ( get_pcvar_num ( cvar_knifes [ 5 ] ) ) )
}
}
}
ColorChat(id, Color:type, const msg[], any:...)
{
new message[256];
switch(type)
{
case NORMAL: // clients scr_concolor cvar color
{
message[0] = 0x01;
}
case GREEN: // Green
{
message[0] = 0x04;
}
default: // White, Red, Blue
{
message[0] = 0x03;
}
}
vformat(message[1], 251, msg, 4);
// Make sure message is not longer than 192 character. Will crash the server.
message[192] = '^0';
new team, ColorChange, index, MSG_Type;
if(id)
{
MSG_Type = MSG_ONE_UNRELIABLE;
index = id;
} else {
index = FindPlayer();
MSG_Type = MSG_BROADCAST;
}
team = get_user_team(index);
ColorChange = ColorSelection(index, MSG_Type, type);
ShowColorMessage(index, MSG_Type, message);
if(ColorChange)
{
Team_Info(index, MSG_Type, TeamName[team]);
}
}
ShowColorMessage(id, type, message[])
{
static msgSayText;
if(!msgSayText)
{
msgSayText = get_user_msgid("SayText");
}
message_begin(type, msgSayText, _, id);
write_byte(id)
write_string(message);
message_end();
}
Team_Info(id, type, team[])
{
static msgTeamInfo;
if(!msgTeamInfo)
{
msgTeamInfo = get_user_msgid("TeamInfo");
}
message_begin(type, msgTeamInfo, _, id);
write_byte(id);
write_string(team);
message_end();
return 1;
}
ColorSelection(index, type, Color:Type)
{
switch(Type)
{
case RED:
{
return Team_Info(index, type, TeamName[1]);
}
case BLUE:
{
return Team_Info(index, type, TeamName[2]);
}
case GREY:
{
return Team_Info(index, type, TeamName[0]);
}
}
return 0;
}
FindPlayer()
{
new i = -1;
while(i <= get_maxplayers())
{
if(is_user_connected(++i))
return i;
}
return -1;
}