De cand ma chinui sa rezolv aceasta problema si nu pot .. sper ca ma puteti ajuta.
Am luat un shop deathrun de pe net si merge totul perfect , dar gravitatia pe care o da cutitul o da si la arme.
La fel si speed-ul sau oricare abilitate , si chiar nu stiu de ce
Uitati SMA-ul :
Spoiler
/* Credits: Team_Prins <=> Ideea and mdl +testing. */
/* Plugin generated by AMXX-Studio */
/* 0.1.1 - Fixed bugs whit models */
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#include <fakemeta>
#include <hamsandwich>
#include <colorchat>
#define MAX_PLAYERS 33
#define OFFSET_LINUX 4
#define m_pPlayer 41
#pragma semicolon 1
static Author[] = "eNd.";
static Plugin[] = "DR Knife";
static const TAG[] = "*Knife:";
enum _: g_Cvars
{
cvar_speed_amount,
cvar_gravity_amount,
cvar_damage_amount,
cvar_hp_amount
}
new const g_Knife1[][] =
{
"models/p_knife.mdl",
"models/knife/v_knife1.mdl"
};
new const g_Knife2[][] =
{
"models/p_knife.mdl",
"models/knife/v_knife2.mdl"
};
new const g_Knife3[][] =
{
"models/p_knife.mdl",
"models/knife/v_knife3.mdl"
};
new const g_Knife4[][] =
{
"models/p_knife.mdl",
"models/knife/v_knife4.mdl"
};
new const g_Knife5[][] =
{
"models/p_knife.mdl",
"models/knife/v_knife5.mdl"
};
new const g_Knife6[][] =
{
"models/p_knife.mdl",
"models/knife/v_knife6.mdl"
};
new const g_Knife7[][] =
{
"models/p_knife.mdl",
"models/v_knife.mdl"
};
new
g_AllCvars [ g_Cvars ],
g_hKnife[ MAX_PLAYERS + 1 ],
g_ScreenFade;
public plugin_init() {
register_plugin(Plugin, "0.1.1", Author);
register_dictionary("knife.txt");
register_clcmd("say","hook_say");
register_clcmd("say_team","hook_say");
RegisterHam(Ham_TakeDamage, "player", "Player_Damage");
RegisterHam(Ham_Item_Deploy, "weapon_knife", "Knife_Deploy", 1);
register_event("CurWeapon", "CurWeapon", "be", "1=1");
g_ScreenFade = get_user_msgid("ScreenFade");
}
public plugin_precache()
{
g_AllCvars[ cvar_speed_amount ] = register_cvar("knife_speed_amount", "450.0");
g_AllCvars[ cvar_gravity_amount ] = register_cvar("knife_gravity_amount", "0.5");
g_AllCvars[ cvar_damage_amount ] = register_cvar("knife_damage_amount", "50");
g_AllCvars[ cvar_hp_amount ] = register_cvar("knife_hp_amount", "5");
static i;
for(i = 0; i < sizeof(g_Knife1); i++)
precache_model(g_Knife1[i]);
for(i = 0; i < sizeof(g_Knife2); i++)
precache_model(g_Knife2[i]);
for(i = 0; i < sizeof(g_Knife3); i++)
precache_model(g_Knife3[i]);
for(i = 0; i < sizeof(g_Knife4); i++)
precache_model(g_Knife4[i]);
for(i = 0; i < sizeof(g_Knife5); i++)
precache_model(g_Knife5[i]);
for(i = 0; i < sizeof(g_Knife6); i++)
precache_model(g_Knife6[i]);
for(i = 0; i < sizeof(g_Knife7); i++)
precache_model(g_Knife7[i]);
}
public Knife_Deploy(const weapon)
{
// Get the owner of the weapon
new iPlayer = get_pdata_cbase(weapon, m_pPlayer, OFFSET_LINUX);
if(is_user_alive(iPlayer))
{
switch(g_hKnife[iPlayer])
{
case 1:
{
set_pev(iPlayer, pev_viewmodel2, g_Knife1[1]);
set_pev(iPlayer, pev_weaponmodel2, g_Knife1[0]);
}
case 2:
{
set_pev(iPlayer, pev_viewmodel2, g_Knife2[1]);
set_pev(iPlayer, pev_weaponmodel2, g_Knife2[0]);
}
case 3:
{
set_pev(iPlayer, pev_viewmodel2, g_Knife3[1]);
set_pev(iPlayer, pev_weaponmodel2, g_Knife3[0]);
}
case 4:
{
set_pev(iPlayer, pev_viewmodel2, g_Knife4[1]);
set_pev(iPlayer, pev_weaponmodel2, g_Knife4[0]);
}
case 5:
{
set_pev(iPlayer, pev_viewmodel2, g_Knife5[1]);
set_pev(iPlayer, pev_weaponmodel2, g_Knife5[0]);
}
case 6:
{
set_pev(iPlayer, pev_viewmodel2, g_Knife6[1]);
set_pev(iPlayer, pev_weaponmodel2, g_Knife6[0]);
}
case 7:
{
set_pev(iPlayer, pev_viewmodel2, g_Knife7[1]);
set_pev(iPlayer, pev_weaponmodel2, g_Knife7[0]);
}
}
}
}
public CurWeapon(const iPlayer)
{
if(is_user_alive(iPlayer) && get_user_weapon(iPlayer) == CSW_KNIFE)
{
switch(g_hKnife[iPlayer])
{
case 1: set_user_maxspeed( iPlayer , 220.0);
case 3:
{
set_user_maxspeed( iPlayer , get_pcvar_float(g_AllCvars[cvar_speed_amount]));
}
case 4:
{
set_user_gravity(iPlayer , get_pcvar_float(g_AllCvars[cvar_gravity_amount]));
}
case 5:
{
if(get_user_health(iPlayer) <= 99)
set_task(4.0 , "func_regeneration",iPlayer,_,_,"b");
}
case 6:
{
if(get_user_health(iPlayer) <= 99)
set_task(4.0 , "func_regeneration",iPlayer,_,_,"b");
set_user_gravity(iPlayer , get_pcvar_float(g_AllCvars[cvar_gravity_amount]));
set_user_maxspeed( iPlayer , get_pcvar_float(g_AllCvars[cvar_speed_amount]));
}
}
}
}
public func_regeneration(iPlayer)
{
new iPlayers[32], pNum;
get_players(iPlayers, pNum,"");
for (new j = 0; j < pNum; j++)
{
new iCurHealth = get_user_health(iPlayers[j]);
if (iCurHealth <= 99)
{
new iRegen = get_pcvar_num(g_AllCvars[cvar_hp_amount]);
new iHealth = iCurHealth + iRegen;
if (iHealth >= 100)
set_user_health(iPlayers[j], 100);
else
set_user_health(iPlayers[j], iHealth);
message_begin(MSG_ONE_UNRELIABLE, g_ScreenFade, {0, 0, 0}, iPlayers[j]);
write_short(1<<10);
write_short(1<<10);
write_short(0x0000);
write_byte(200);
write_byte(0);
write_byte(0);
write_byte(50);
message_end();
}
}
}
public Player_Damage(iVictim, iInflictor, iAttacker, Float:fDamage, iDamageBits )
{
if(is_user_alive(iAttacker) && iInflictor == iAttacker && get_user_weapon(iAttacker) == CSW_KNIFE)
{
switch(g_hKnife[iAttacker])
{
case 1,6:
{
new iDmg = get_pcvar_num(g_AllCvars[cvar_damage_amount]);
SetHamParamFloat( 4, fDamage + iDmg);
}
}
}
}
public hook_say(iPlayer)
{
static szArg[192];
read_args(szArg, sizeof(szArg) - 1);
remove_quotes(szArg);
if( equal( szArg, "/knife", 5))
{
replace( szArg , sizeof( szArg ) - 1, "/", "." );
set_task( 1.0 , "Knife_Open" , iPlayer );
ColorChat(iPlayer, GREEN, "%s^x03 %s^x01 %L",TAG, szName(iPlayer), LANG_SERVER, "KNIFE_OPEN");
}
return PLUGIN_CONTINUE;
}
#define g_dKnife 7
static const g_iKnife[g_dKnife][] =
{
"KNIFE_MENU_1",
"KNIFE_MENU_2",
"KNIFE_MENU_3",
"KNIFE_MENU_4",
"KNIFE_MENU_5",
"KNIFE_MENU_6",
"KNIFE_MENU_7"
};
public Knife_Open(const iPlayer)
{
new szText[256];
formatex(szText, charsmax(szText), "%L", LANG_SERVER, "KNIFE_TITLE");
new iKnife = menu_create(szText, "Knife_Submenu");
new iNumber[5], szOption[40];
for( new i = 0; i < g_dKnife; i++ ) {
num_to_str(i+1, iNumber, 8);
formatex(szOption, 39, "%L", LANG_SERVER, g_iKnife[i]);
menu_additem(iKnife, szOption, iNumber);
}
menu_setprop(iKnife,MPROP_EXIT, MEXIT_NEVER);
menu_display(iPlayer, iKnife, 0);
return PLUGIN_HANDLED;
}
public Knife_Submenu(iPlayer , iKnife, item)
{
if(item == MENU_EXIT)
{
menu_destroy(iKnife);
return PLUGIN_HANDLED;
}
new szWeapon = get_user_weapon(iPlayer);
new data[7], name[64];
new access, callback;
menu_item_getinfo(iKnife, item, access, data, charsmax(data), name, charsmax(name), callback);
new key = str_to_num(data);
switch(key)
{
case 1:
{
if(szWeapon == CSW_KNIFE)
{
set_pev(iPlayer, pev_viewmodel2, g_Knife1[1]);
set_pev(iPlayer, pev_weaponmodel2, g_Knife1[0]);
}
g_hKnife[iPlayer] = 1;
reset_all(iPlayer);
ColorChat(iPlayer, GREEN, "%s^x03 %s^x01 %L",TAG, szName(iPlayer), LANG_SERVER, "KNIFE_DMG");
}
case 2:
{
if(szWeapon == CSW_KNIFE)
{
set_pev(iPlayer, pev_viewmodel2, g_Knife2[1]);
set_pev(iPlayer, pev_weaponmodel2, g_Knife2[0]);
}
g_hKnife[iPlayer] = 2;
reset_all(iPlayer);
set_user_footsteps(iPlayer, 1);
ColorChat(iPlayer, GREEN, "%s^x03 %s^x01 %L",TAG, szName(iPlayer), LANG_SERVER, "KNIFE_FS");
}
case 3:
{
if(szWeapon == CSW_KNIFE)
{
set_pev(iPlayer, pev_viewmodel2, g_Knife3[1]);
set_pev(iPlayer, pev_weaponmodel2, g_Knife3[0]);
}
g_hKnife[iPlayer] = 3;
reset_all(iPlayer);
set_user_maxspeed( iPlayer , get_pcvar_float(g_AllCvars[cvar_speed_amount]));
ColorChat(iPlayer, GREEN, "%s^x03 %s^x01 %L",TAG, szName(iPlayer), LANG_SERVER, "KNIFE_SPEED");
}
case 4:
{
if(szWeapon == CSW_KNIFE)
{
set_pev(iPlayer, pev_viewmodel2, g_Knife4[1]);
set_pev(iPlayer, pev_weaponmodel2, g_Knife4[0]);
}
g_hKnife[iPlayer] = 4;
reset_all(iPlayer);
set_user_gravity(iPlayer , get_pcvar_float(g_AllCvars[cvar_gravity_amount]));
ColorChat(iPlayer, GREEN, "%s^x03 %s^x01 %L",TAG, szName(iPlayer), LANG_SERVER, "KNIFE_GRAVITY");
}
case 5:
{
if(szWeapon == CSW_KNIFE)
{
set_pev(iPlayer, pev_viewmodel2, g_Knife5[1]);
set_pev(iPlayer, pev_weaponmodel2, g_Knife5[0]);
}
g_hKnife[iPlayer] = 5;
reset_all(iPlayer);
ColorChat(iPlayer, GREEN, "%s^x03 %s^x01 %L",TAG, szName(iPlayer), LANG_SERVER, "KNIFE_REGEN");
}
case 6:
{
if(is_user_admin(iPlayer))
{
if(szWeapon == CSW_KNIFE)
{
set_pev(iPlayer, pev_viewmodel2, g_Knife6[1]);
set_pev(iPlayer, pev_weaponmodel2, g_Knife6[0]);
}
g_hKnife[iPlayer] = 6;
reset_all(iPlayer);
set_user_maxspeed( iPlayer , get_pcvar_float(g_AllCvars[cvar_speed_amount]));
set_user_gravity(iPlayer , get_pcvar_float(g_AllCvars[cvar_gravity_amount]));
ColorChat(iPlayer, GREEN, "%s^x03 %s^x01 %L",TAG, szName(iPlayer), LANG_SERVER, "KNIFE_ADMIN");
}
}
case 7:
{
if(szWeapon == CSW_KNIFE)
{
set_pev(iPlayer, pev_viewmodel2, g_Knife7[1]);
set_pev(iPlayer, pev_weaponmodel2, g_Knife7[0]);
}
g_hKnife[iPlayer] = 7;
reset_all(iPlayer);
ColorChat(iPlayer, GREEN, "%s^x03 %s^x01 %L",TAG, szName(iPlayer), LANG_SERVER, "KNIFE_CLASIC");
}
}
return PLUGIN_CONTINUE;
}
public reset_all(iPlayer)
{
remove_task(iPlayer);
set_user_footsteps(iPlayer, 0);
set_user_gravity(iPlayer, 1.0);
set_user_maxspeed(iPlayer, 250.0);
}
stock szName(id)
{
new sz_Name[33];
get_user_name(id, sz_Name, charsmax(sz_Name));
return sz_Name;
}
Poate ma ajutati voi , multumesc
Edited by xVlad, 02 July 2015 - 09:50 PM.