osmanbnm
2 Beğeni
Spr dosyasına gerek yok eklenti ile yapabilirsin. Ama spr uzantılı dosya olursa daha temiz görüntü alırsın.
Örnek eklenti ;
Fakat bu şekilde önermem. Class sınıfların ana eklentileri düzenlersen daha verimli olur.
Örnek eklenti ;
PHP Kod:
#include <amxmodx>
#include <reapi>
#include <zombieplague>
#define PLUGIN_NAME "ZP Zombi Yetenek Ekran Efekti"
#define PLUGIN_VERSION "1.0"
#define PLUGIN_AUTHOR "osmanbnm"
#define FADE_DURATION 8
#define FADE_HOLD 4
#define FADE_IN_FLAG 0x0000
#define FX_COOLDOWN 0.5
#define RING_HEIGHT 250
#define RING_WIDTH 50
#define RING_LIFE 8
#define RING_FRAMERATE 10
#define RING_BRIGHTNESS 220
#define DLIGHT_RADIUS 20
#define DLIGHT_LIFE 8
#define DLIGHT_DECAY 50
#define MAX_BIND_KEYS 5
enum FxType {
FX_INFECT = 0,
FX_ABILITY,
FX_LEAP,
FX_NEMESIS
}
static const g_iRGB[FxType][3] = {
{ 220, 20, 10 },
{ 240, 200, 15 },
{ 255, 130, 10 },
{ 180, 0, 0 }
}
static const g_iFadeAlpha[FxType] = { 140, 115, 95, 165 }
static const g_iKeyBits[MAX_BIND_KEYS] = {
IN_DUCK,
IN_USE,
IN_RELOAD,
IN_FORWARD,
IN_RUN
}
static g_msgScreenFade
static g_iSprRing
static Float:g_flLastEffect[33]
static bool:g_bIsZombie[33]
static bool:g_bIsNemesis[33]
static bool:g_bIsAlive[33]
static bool:g_bIsConnected[33]
static g_iAbilityKey
static g_pCvarKey
public plugin_precache()
g_iSprRing = precache_model("sprites/shockwave.spr")
public plugin_init() {
register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)
g_msgScreenFade = get_user_msgid("ScreenFade")
g_pCvarKey = register_cvar("zp_ability_fx_key", "1")
RegisterHookChain(RG_CBasePlayer_Spawn, "OnPlayerSpawn_Post", true)
RegisterHookChain(RG_CBasePlayer_Killed, "OnPlayerKilled_Post", true)
RegisterHookChain(RG_CSGameRules_RestartRound, "OnRoundRestart_Post", true)
RegisterHookChain(RG_PM_Move, "OnPM_Move", false)
SyncKeyConfig()
}
public plugin_cfg()
SyncKeyConfig()
static SyncKeyConfig() {
new iVal = clamp(get_pcvar_num(g_pCvarKey), 0, MAX_BIND_KEYS - 1)
g_iAbilityKey = g_iKeyBits[iVal]
}
public client_putinserver(id) {
g_bIsConnected[id] = true
ResetPlayerData(id)
}
public client_disconnected(id) {
g_bIsConnected[id] = false
ResetPlayerData(id)
}
static ResetPlayerData(id) {
g_bIsAlive[id] = false
g_bIsZombie[id] = false
g_bIsNemesis[id] = false
g_flLastEffect[id] = 0.0
}
public OnPlayerSpawn_Post(id) {
if (!is_user_alive(id))
return
g_bIsAlive[id] = true
g_bIsZombie[id] = false
g_bIsNemesis[id] = false
}
public OnPlayerKilled_Post(id) {
g_bIsAlive[id] = false
}
public OnPM_Move(id) {
if (!g_bIsAlive[id] || !g_bIsZombie[id])
return
static iButtons
iButtons = get_entvar(id, var_button)
static iOldButtons
iOldButtons = get_entvar(id, var_oldbuttons)
if (!(iButtons & g_iAbilityKey) || (iOldButtons & g_iAbilityKey))
return
if (iButtons & IN_JUMP) {
if (!(get_entvar(id, var_flags) & FL_ONGROUND))
return
if (!CheckCooldown(id))
return
ApplyEffect(id, g_bIsNemesis[id] ? FX_NEMESIS : FX_LEAP)
return
}
if (!CheckCooldown(id))
return
ApplyEffect(id, g_bIsNemesis[id] ? FX_NEMESIS : FX_ABILITY)
}
public OnRoundRestart_Post() {
SyncKeyConfig()
for (new i = 1; i <= MaxClients; i++) {
g_bIsZombie[i] = false
g_bIsNemesis[i] = false
g_flLastEffect[i] = 0.0
}
}
public zp_user_infected_post(id, infector, nemesis) {
if (!g_bIsConnected[id])
return
g_bIsZombie[id] = true
g_bIsNemesis[id] = bool:nemesis
g_bIsAlive[id] = true
ApplyEffect(id, nemesis ? FX_NEMESIS : FX_INFECT)
if (infector > 0 && infector <= MaxClients) {
if (g_bIsConnected[infector] && g_bIsAlive[infector])
ApplyEffect(infector, FX_ABILITY)
}
}
public zp_user_humanized_post(id) {
if (!g_bIsConnected[id])
return
g_bIsZombie[id] = false
g_bIsNemesis[id] = false
}
public zp_extra_item_selected(id, itemid) {
if (!g_bIsAlive[id] || !g_bIsZombie[id])
return
if (!CheckCooldown(id))
return
ApplyEffect(id, FX_ABILITY)
}
static ApplyEffect(id, FxType:type) {
if (!g_bIsConnected[id])
return
g_flLastEffect[id] = get_gametime()
SendScreenFade(id, type)
SendBeamCylinder(id, type)
SendDynamicLight(id, type)
}
static SendScreenFade(id, FxType:type) {
message_begin(MSG_ONE_UNRELIABLE, g_msgScreenFade, {0,0,0}, id)
write_short((1 << 12) * FADE_DURATION)
write_short((1 << 12) * FADE_HOLD)
write_short(FADE_IN_FLAG)
write_byte(g_iRGB[type][0])
write_byte(g_iRGB[type][1])
write_byte(g_iRGB[type][2])
write_byte(g_iFadeAlpha[type])
message_end()
}
static SendBeamCylinder(id, FxType:type) {
static Float:vOrigin[3]
get_entvar(id, var_origin, vOrigin)
message_begin(MSG_ONE_UNRELIABLE, SVC_TEMPENTITY, {0,0,0}, id)
write_byte(TE_BEAMCYLINDER)
write_coord_f(vOrigin[0])
write_coord_f(vOrigin[1])
write_coord_f(vOrigin[2] - 36.0)
write_coord_f(vOrigin[0])
write_coord_f(vOrigin[1])
write_coord_f(vOrigin[2] + float(RING_HEIGHT))
write_short(g_iSprRing)
write_byte(0)
write_byte(RING_FRAMERATE)
write_byte(RING_LIFE)
write_byte(RING_WIDTH)
write_byte(0)
write_byte(g_iRGB[type][0])
write_byte(g_iRGB[type][1])
write_byte(g_iRGB[type][2])
write_byte(RING_BRIGHTNESS)
write_byte(0)
message_end()
}
static SendDynamicLight(id, FxType:type) {
static Float:vOrigin[3]
get_entvar(id, var_origin, vOrigin)
message_begin(MSG_ONE_UNRELIABLE, SVC_TEMPENTITY, {0,0,0}, id)
write_byte(TE_DLIGHT)
write_coord_f(vOrigin[0])
write_coord_f(vOrigin[1])
write_coord_f(vOrigin[2])
write_byte(DLIGHT_RADIUS)
write_byte(g_iRGB[type][0])
write_byte(g_iRGB[type][1])
write_byte(g_iRGB[type][2])
write_byte(DLIGHT_LIFE)
write_byte(DLIGHT_DECAY)
message_end()
}
static bool:CheckCooldown(id) {
if (get_gametime() - g_flLastEffect[id] < FX_COOLDOWN)
return false
return true
}
)


