Заказать игровой сервер Контакты (заказать плагин/исправить ошибки/другое) Пожертвовать Поиск

[ вход ]
[ последние сообщения ]

  • Страница 1 из 1
  • 1
Помощь
котэ Дата: Вторник, 27.08.2013, 10:38:30 | Сообщение # 1
Сообщений: 44
Репутация: -8 [ +/- ]
Здравствуйте,помогите мне пожалуйста правильно написать код где-то я сделал здесь ошибку пожалуйста помогите буду очень рад,благодарен!

#pragma semicolon 1
#include <sourcemod>
#include <sdktools>

/**
* @brief Speed increase for each level when player is damaged.
*/
#define IMPULSE_INC 0.2

/**
* @brief Duration of Impulse's effect.
*/
#define IMPULSE_DURATION 0.8

new Handle:g_hImpulseConfig;

new Handle:g_hImpulseResetSpeed[MAXPLAYERS+1] = {INVALID_HANDLE,...};
new g_iImpulseTrailSprites[MAXPLAYERS+1] = {-1,...};

Item_Impulse_PreInit()
{
g_hImpulseConfig = RegisterItemType("Impulse", "impulse", 10, true, 5, 20, 20, Impulse_Buy, Impulse_Sell);
}

public bool:Impulse_Buy(client)
{
return true;
}

public bool:Impulse_Sell(client)
{
return true;
}

Impulse_ResetClient(client)
{
if(g_hImpulseResetSpeed[client] != INVALID_HANDLE && IsClientInGame(client))
TriggerTimer(g_hImpulseResetSpeed[client]);
ClearHandle(g_hImpulseResetSpeed[client]);
if(g_iImpulseTrailSprites[client] != -1 && IsValidEntity(g_iImpulseTrailSprites[client]))
AcceptEntityInput(g_iImpulseTrailSprites[client], "Kill");
g_iImpulseTrailSprites[client] = -1;
}

stock Impulse_StopEffect(client)
{
if(g_hImpulseResetSpeed[client] != INVALID_HANDLE && IsClientInGame(client))
TriggerTimer(g_hImpulseResetSpeed[client]);
ClearHandle(g_hImpulseResetSpeed[client]);
}

/**
* @brief Reset all invisible entity indexes since the previous round's entities
* were all deleted on round start.
*/
Impulse_OnRoundStart()
{
for(new i=1;i<=MaxClients;i++)
g_iImpulseTrailSprites[i] = -1;
}

Impulse_PlayerDamage(attacker, victim)
{
if(!GetConVarBool(g_hCVEnable) || !GetArrayCell(g_hImpulseConfig, ITEM_ENABLE))
return;

IF_BOT_NENABLED(attacker)
return;

if(GetClientTeam(attacker) == GetClientTeam(victim))
return;

new iLevel = GetPlayerItemLevel(attacker, GetArrayCell(g_hImpulseConfig, ITEM_INDEX));

if(iLevel <= 0)
return;

if(IsFrozenByFrostPistol(victim))
return; //Player has already been tagged with a FrostPistol

if(!(GetEntityFlags(victim) & FL_ONGROUND))
return; //Player is in midair

/* Set player speed */
SetEntPropFloat(victim, Prop_Send, "m_flLaggedMovementValue", 1.0 + float(iLevel) * IMPULSE_INC);

ClearHandle(g_hImpulseResetSpeed[victim]);
g_hImpulseResetSpeed[victim] = CreateTimer(IMPULSE_DURATION, Impulse_Timer_ResetSpeed, GetClientUserId(victim), TIMER_FLAG_NO_MAPCHANGE);

decl Float:vOrigin[3];
GetClientEyePosition(victim, vOrigin);
vOrigin[2] -= 40.0;

new iSprite = g_iImpulseTrailSprites[victim];
if(iSprite == -1)
{
iSprite = CreateEntityByName("env_sprite");
if(iSprite == -1)
return;

SetEntityRenderMode(iSprite, RENDER_NONE);
TeleportEntity(iSprite, vOrigin, Float:{0.0,0.0,0.0}, NULL_VECTOR);
DispatchSpawn(iSprite);

g_iImpulseTrailSprites[victim] = iSprite;
}

SetVariantString("");
AcceptEntityInput(iSprite, "ClearParent");
TeleportEntity(iSprite, vOrigin, NULL_VECTOR, NULL_VECTOR);
SetVariantString("!activator");
AcceptEntityInput(iSprite, "SetParent", victim);

TE_SetupBeamFollow(iSprite, g_iRedTrailSprite, g_iRedTrailSprite, IMPULSE_DURATION, 10.0, 4.0, 2, {255,0,0,255});
TE_SendToAll();
}

public Action:Impulse_Timer_ResetSpeed(Handle:timer, any:userid)
{
new client = GetClientOfUserId(userid);
if(!client)
return Plugin_Stop;

g_hImpulseResetSpeed[client] = INVALID_HANDLE;

SetEntPropFloat(client, Prop_Send, "m_flLaggedMovementValue", 1.0);


if(g_iImpulseTrailSprites[client] != -1 && IsValidEntity(g_iImpulseTrailSprites[client]))
{
SetVariantString("");
AcceptEntityInput(g_iImpulseTrailSprites[client], "ClearParent"); //unset parent
}

public rpgi_impulse_PlayerHurt(victim, attacker, health, armor, const String:weapon[], dmg_health, dmg_armor, hitgroup)
{
if(AreValidPlayers(victim, attacker))
{
new level = GetPlayerUpgradeLevel(victim, g_moduleimpulse2);
if(level > 0 && GetRandomFloat(0.0, 1.0) <= 0.03*level)
{
new max_ammo = 0;
new Weapon = GetEntPropEnt(victim, Prop_Data, "m_hActiveWeapon");
decl String:weapon_name[64];
GetEntPropString(Weapon, Prop_Data, "m_iClassname", weapon_name, sizeof(weapon_name));
if(StrEqual(weapon_name, "weapon_p90"))
max_ammo=50;
if(StrEqual(weapon_name, "weapon_deagle")||StrEqual(weapon_name, "weapon_xm1014"))
max_ammo=7;
if(StrEqual(weapon_name, "weapon_ak47")||StrEqual(weapon_name, "weapon_m4a1")||StrEqual(weapon_name, "weapon_sg552")||StrEqual(weapon_name, "weapon_aug")||StrEqual(weapon_name, "weapon_sg550")||StrEqual(weapon_name, "weapon_elite")||StrEqual(weapon_name, "weapon_mac10")||StrEqual(weapon_name, "weapon_tmp")||StrEqual(weapon_name, "weapon_mp5navy"))
max_ammo=30;
if(StrEqual(weapon_name, "weapon_galil"))
max_ammo=35;
if(StrEqual(weapon_name, "weapon_scout")||StrEqual(weapon_name, "weapon_awp"))
max_ammo=10;
if(StrEqual(weapon_name, "weapon_g3sg1")||StrEqual(weapon_name, "weapon_glock")||StrEqual(weapon_name, "weapon_fiveseven"))
max_ammo=20;
if(StrEqual(weapon_name, "weapon_famas")||StrEqual(weapon_name, "weapon_ump45"))
max_ammo=25;
if(StrEqual(weapon_name, "weapon_usp"))
max_ammo=12;
if(StrEqual(weapon_name, "weapon_p228"))
max_ammo=13;
if(StrEqual(weapon_name, "weapon_m3"))
max_ammo=8;
if(StrEqual(weapon_name, "weapon_m249"))
max_ammo=100;
if(IsValidEdict(Weapon))
SetEntData(Weapon, g_iWeaponClipOffset, max_ammo, 4, true);
}

return Plugin_Stop;
}
}
}


САМ ПЛАГИН ВНИЗУ!!![color=purple]

Гости не могут скачивать файлы
 
  • Страница 1 из 1
  • 1
Поиск: