отвязать от плагина Orpheu

Сообщения
108
Реакции
109
Нужно переписать плагин без round_terminator

Исходник :
Код:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#include <fakemeta>
#include <hamsandwich>
#include <engine>
#include <round_terminator>

#define PLUGIN "Zombie Escape V2: Core"
#define VERSION "2.0.4"
#define AUTHOR "Kia"

#define MAX_SKINS 13 // how many skins
// ===============================================================================
// Editing begins here
// ===============================================================================



// Sound File for Countdown
#define SOUND_READY "sound/ZombieEscapeV2/ZE_Ready.mp3"
// Sound File for Ambience Music
#define SOUND_AMBIENCE "sound/ZombieEscapeV2/ZE_Ambience.mp3"

// Sound File for Origin Zombie Unleash
#define SOUND_UNLEASH "ZombieEscapeV2/zombi_coming_1.wav"

// Player Model for Origin Zombie
#define MODEL_PLAYER_ORIGIN "models/player/ZEV2_Origin/ZEV2_Origin.mdl"

// Player Model Name
#define MODEL_PLAYER_ORIGIN_NAME "ZEV2_Origin"

// Player Model for normal Zombies
#define MODEL_PLAYER_ZOMBIE "models/player/ZEV2_Normal/ZEV2_Normal.mdl"

// Player Model Name
#define MODEL_PLAYER_ZOMBIE_NAME "ZEV2_Normal"

// Knife Model for Zombies
#define MODEL_KNIFE_V "models/ZombieEscapeV2/v_knife.mdl"

// Length in Seconds of the Ambience Music
#define SOUND_AMBIENCE_LENGTH 138.089

// Time in Seconds to run for Humans after Zombie was chosen
#define TIME_RUN 10.0

// Knockback Power
#define KNOCKBACK_POWER 346.0

// Health for new Host Zombies
#define HEALTH_HOST_ZOMBIE 4500

// Time in Seconds how long Zombies need to respawn
#define TIME_HOST_RESPAWN 10.0



// ===============================================================================
// and stops here. DO NOT MODIFY BELOW UNLESS YOU KNOW WHAT YOU'RE DOING
// ===============================================================================

// ===============================================================================
// Variables
// ===============================================================================

/* Ressources */

// Enter all names here
new g_CTSkins[MAX_SKINS][] = {
"archer",
"crash",
"daffy_duck",
"donald",
"goofy",
"kirito_ggo",
"kopatel",
"mikkye",
"purple_heart_fix",
"rei_ryghts",
"rock_shooter_fix",
"wundrunner",
"yoshino_fix"
}

new g_szOldKnifeHitSounds[][] = {
"weapons/knife_hit1.wav",
"weapons/knife_hit2.wav",
"weapons/knife_hit3.wav",
"weapons/knife_hit4.wav"
}

new g_szOldKnifeHitWallSounds[][] = {
"weapons/knife_hitwall1.wav"
}

new g_szOldKnifeSlashSounds[][] = {
"weapons/knife_slash1.wav",
"weapons/knife_slash2.wav"
}

new g_szOldKnifeStabSounds[][] = {
"weapons/knife_stab.wav"
}


new g_szNewKnifeHitSounds[][] = {
"ZombieEscapeV2/zombi_attack_1.wav",
"ZombieEscapeV2/zombi_attack_2.wav",
"ZombieEscapeV2/zombi_attack_3.wav",
"ZombieEscapeV2/zombi_attack_4.wav"
}

new g_szNewKnifeHitWallSounds[][] = {
"ZombieEscapeV2/zombi_wall_1.wav",
"ZombieEscapeV2/zombi_wall_2.wav",
"ZombieEscapeV2/zombi_wall_3.wav"
}

new g_szNewKnifeSlashSounds[][] = {
"ZombieEscapeV2/zombi_swing_1.wav",
"ZombieEscapeV2/zombi_swing_2.wav",
"ZombieEscapeV2/zombi_swing_3.wav"
}

new g_szNewKnifeStabSounds[][] = {
"ZombieEscapeV2/zombi_attack_3.wav"
}

/* Tries */

new Trie:g_tHit
new Trie:g_tWall
new Trie:g_tSlash
new Trie:g_tStab

/* Consts */

new const iTaskID_EnableCountdown = 1021
new const iTaskID_Countdown = 6125
new const iTaskID_FirstZombie = 9129
new const iTaskID_PlayAmbienceMusic = 1281
new const iTaskID_ReplayAmbienceMusic = 1921
new const iTaskID_FreezeHostZombie = 8712
new const iTaskID_FrozenCountdown = 7172
new const iTaskID_RespawnZombie = 4123

/* Integer */

new g_iTimeRemaining
new g_iTimeFrozenRemaining
new g_iHostZombie

/* Boolean */

new bool:g_bIsZombie[33]
new bool:g_bIsFrozen[33]

/* Forwards */

new g_fwFirstZombieChosen
new g_fwOriginZombieUnleashed
new g_fwHumanInfected
new g_fwHumanHealed
new g_fwHumansWon
new g_fwZombiesWon
new g_fwReturn

// ===============================================================================
// plugin_natives
// ===============================================================================

public plugin_natives()
{
register_library("zev2_core")

register_native("ZEV2_GetOriginZombie", "Native_GetOriginZombie")
register_native("ZEV2_SetOriginZombie", "Native_SetOriginZombie")
register_native("ZEV2_InfectPlayer", "Native_InfectPlayer")
register_native("ZEV2_HealPlayer","Native_HealPlayer")
register_native("ZEV2_IsUserZombie", "Native_IsUserZombie")
}

// ===============================================================================
// Natives
// ===============================================================================

public Native_GetOriginZombie()
return g_iHostZombie

public Native_SetOriginZombie(id)
{
g_iHostZombie = get_param(1)
PrepareOriginZombie()
}

public Native_InfectPlayer(id)
{
g_bIsZombie[get_param(1)] = true
PrepareNormalZombie(get_param(1))
CheckWinConditions()
}

public Native_HealPlayer(id)
{
g_bIsZombie[get_param(1)] = false
PrepareHuman(get_param(1))
CheckWinConditions()
ExecuteForward(g_fwHumanHealed, g_fwReturn, get_param(1))
}

public Native_IsUserZombie(id)
{
return g_bIsZombie[get_param(1)]
}

// ===============================================================================
// plugin_precache
// ===============================================================================

public plugin_precache()
{
new szFileName[64]

for(new i = 1; i <= 10; i++)
{
formatex(szFileName, charsmax(szFileName), "ZombieEscapeV2/Countdown/%i.wav", i)
precache_sound(szFileName)
}

precache_generic(SOUND_READY)
precache_generic(SOUND_AMBIENCE)

precache_sound(SOUND_UNLEASH)

precache_model(MODEL_PLAYER_ORIGIN)
precache_model(MODEL_PLAYER_ZOMBIE)
precache_model(MODEL_KNIFE_V)

g_tHit = TrieCreate()
g_tWall = TrieCreate()
g_tSlash = TrieCreate()
g_tStab = TrieCreate()

static szModel[75]
for(new i=0;i<MAX_SKINS;i++)
{
formatex(szModel,sizeof szModel,"models/player/%s/%s.mdl",g_CTSkins,g_CTSkins)
precache_model(szModel);
}

for( new i = 0; i < sizeof(g_szNewKnifeHitSounds); i++ )
{
if(!TrieKeyExists(g_tHit, g_szNewKnifeHitSounds))
{
precache_sound(g_szNewKnifeHitSounds)
TrieSetCell(g_tHit, g_szNewKnifeHitSounds, 1)
}
}

for( new i = 0; i < sizeof(g_szOldKnifeHitSounds ); i++ )
{
TrieSetString(g_tHit, g_szOldKnifeHitSounds, g_szNewKnifeHitSounds[ i ] );
}

/**/

for( new i = 0; i < sizeof(g_szNewKnifeHitWallSounds); i++ )
{
if(!TrieKeyExists(g_tWall, g_szNewKnifeHitWallSounds))
{
precache_sound(g_szNewKnifeHitWallSounds)
TrieSetCell(g_tWall, g_szNewKnifeHitWallSounds, 1)
}
}

for( new i = 0; i < sizeof(g_szNewKnifeHitWallSounds ); i++ )
{
TrieSetString(g_tHit, g_szOldKnifeHitWallSounds, g_szNewKnifeHitWallSounds[ i ] );
}

/**/

for( new i = 0; i < sizeof(g_szNewKnifeSlashSounds); i++ )
{
if(!TrieKeyExists(g_tSlash, g_szNewKnifeSlashSounds))
{
precache_sound(g_szNewKnifeSlashSounds)
TrieSetCell(g_tSlash, g_szNewKnifeSlashSounds, 1)
}
}

for( new i = 0; i < sizeof(g_szNewKnifeSlashSounds ); i++ )
{
TrieSetString(g_tHit, g_szOldKnifeSlashSounds, g_szNewKnifeSlashSounds[ i ] );
}

/**/

for( new i = 0; i < sizeof(g_szNewKnifeStabSounds); i++ )
{
if(!TrieKeyExists(g_tStab, g_szNewKnifeStabSounds))
{
precache_sound(g_szNewKnifeStabSounds)
TrieSetCell(g_tStab, g_szNewKnifeStabSounds, 1)
}
}

for( new i = 0; i < sizeof(g_szNewKnifeStabSounds ); i++ )
{
TrieSetString(g_tHit, g_szOldKnifeStabSounds, g_szNewKnifeStabSounds[ i ] );
}
}

// ===============================================================================
// client_putinserver
// ===============================================================================

public client_putinserver(id)
g_bIsZombie[id] = false

// ===============================================================================
// client_disconnect
// ===============================================================================

public client_disconnect(id)
{
CheckWinConditions()
CheckHostZombieStatus()
}

// ===============================================================================
// plugin_init
// ===============================================================================

public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)

/* Messages */

register_message(get_user_msgid("StatusIcon"), "Message_StatusIcon")

/* Events */

register_event("HLTV", "Event_HLTVNewRound", "a", "1=0", "2=0")
register_event("TextMsg","Event_GameRestarting","a","2=#Game_Commencing","2=#Game_will_restart_in")

/* Logevents */

register_logevent("Event_GameRestarting", 2, "1=Round_End")

/* Forwards */

register_forward(FM_EmitSound , "Forward_EmitSound")
register_forward( FM_ClientKill, "fw_ClientKill" )

/* Hamsandwich */

RegisterHam(Ham_Item_Deploy, "weapon_knife", "Ham_KnifeDeployPost", 1)
RegisterHam(Ham_Touch, "weaponbox", "Ham_TouchWeapon")
RegisterHam(Ham_Touch, "armoury_entity", "Ham_TouchWeapon")
RegisterHam(Ham_Touch, "weapon_shield", "Ham_TouchWeapon")
RegisterHam(Ham_TakeDamage, "player", "Ham_PlayerTakeDamage")
RegisterHam(Ham_Killed, "player", "Ham_PlayerKilledPost", 1)
RegisterHam(Ham_Spawn, "player", "Ham_PlayerSpawnedPost", 1)

/* Forwards */

g_fwFirstZombieChosen = CreateMultiForward("ZEV2_OnFirstZombieChosen", ET_IGNORE, FP_CELL)
g_fwOriginZombieUnleashed = CreateMultiForward("ZEV2_OnOriginZombieUnleashed", ET_IGNORE)
g_fwHumanInfected = CreateMultiForward("ZEV2_OnHumanInfected", ET_IGNORE, FP_CELL)
g_fwHumanHealed = CreateMultiForward("ZEV2_OnHumanHealed", ET_IGNORE, FP_CELL)
g_fwHumansWon = CreateMultiForward("ZEV2_OnHumanWin", ET_IGNORE)
g_fwZombiesWon = CreateMultiForward("ZEV2_OnZombieWin", ET_IGNORE)

/* Commands */

server_cmd("mp_freezetime 20")
register_cvar("ZEV2_Core", VERSION, FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_SPONLY);
}

// ===============================================================================
// Message_StatusIcon
// ===============================================================================

public Message_StatusIcon(iMsgId, iMsgDest, id)
{
if(!g_bIsZombie[id])
return PLUGIN_CONTINUE

static szIcon[5]; get_msg_arg_string(2, szIcon, charsmax(szIcon))

if(szIcon[0] == 'b' && szIcon[2] == 'y' && szIcon[3] == 'z')
{
if(get_msg_arg_int(1))
{
set_pdata_int(id, 235, get_pdata_int(id, 235) & ~(1<<0))
return PLUGIN_HANDLED
}
}

return PLUGIN_CONTINUE
}

// ===============================================================================
// Event_HLTVNewRound
// ===============================================================================

public Event_HLTVNewRound()
{
arrayset(g_bIsZombie, 0, sizeof(g_bIsZombie))

ResetPlayerModels()
ResetFreezeTimeCounter()
RemoveTasks()
PrepareZombieCountdown()
StartPreparingMusic()
PrepareAmbienceMusic()
ExecuteCountdown()
}

// ===============================================================================
// Event_GameRestarting
// ===============================================================================

public Event_GameRestarting()
{
arrayset(g_bIsZombie, 0, sizeof(g_bIsZombie))
arrayset(g_bIsFrozen, 0, sizeof(g_bIsFrozen))

ResetPlayerModels()
RemoveTasks()
}

// ===============================================================================
// Forward_EmitSound
// ===============================================================================

public Forward_EmitSound(iEnt, iChan, const szSound[], Float:fVol, Float:fAttn, iFlags, iPitch )
{
if(!is_user_alive(iEnt) || !g_bIsZombie[iEnt])
return FMRES_IGNORED

if(TrieKeyExists(g_tHit, szSound))
{
emit_sound(iEnt, iChan, g_szNewKnifeHitSounds[random(sizeof(g_szNewKnifeHitSounds))], fVol, fAttn, iFlags, iPitch);
return FMRES_SUPERCEDE;
}

if(TrieKeyExists(g_tWall, szSound))
{
emit_sound(iEnt, iChan, g_szNewKnifeHitWallSounds[random(sizeof(g_szNewKnifeHitWallSounds))], fVol, fAttn, iFlags, iPitch);
return FMRES_SUPERCEDE;
}

if(TrieKeyExists(g_tSlash, szSound))
{
emit_sound(iEnt, iChan, g_szNewKnifeSlashSounds[random(sizeof(g_szNewKnifeSlashSounds))], fVol, fAttn, iFlags, iPitch);
return FMRES_SUPERCEDE;
}

if(TrieKeyExists(g_tStab, szSound))
{
emit_sound(iEnt, iChan, g_szNewKnifeStabSounds[random(sizeof(g_szNewKnifeStabSounds))], fVol, fAttn, iFlags, iPitch);
return FMRES_SUPERCEDE;
}

return FMRES_IGNORED;
}

// ===============================================================================
// Ham_KnifeDeployPost
// ===============================================================================

public Ham_KnifeDeployPost(iEnt)
{
if(!is_valid_ent(iEnt)) return;

new iPlayer = get_pdata_cbase(iEnt, 41, 4)

if(is_user_alive(iPlayer) && g_bIsZombie[iPlayer])
{
entity_set_string(iPlayer, EV_SZ_viewmodel, MODEL_KNIFE_V)
entity_set_string(iPlayer, EV_SZ_weaponmodel, "")
}


}

// ===============================================================================
// Ham_TouchWeapon
// ===============================================================================

public Ham_TouchWeapon(weapon, id)
{
if (!is_user_connected(id))
return HAM_IGNORED

if (g_bIsZombie[id])
return HAM_SUPERCEDE

return HAM_IGNORED
}

// ===============================================================================
// Ham_PlayerTakeDamage
// ===============================================================================

public Ham_PlayerTakeDamage(iVictim, iInflictor, iAttacker, Float:fDamage, iDamageBits)
{
if((iDamageBits & DMG_FALL))
SetHamParamFloat(4, 0.0)

if(/*iInflictor == iAttacker &&*/ is_user_alive(iAttacker))
{
if(iVictim == g_iHostZombie)
SetHamParamFloat(4, 0.0)

if(!g_bIsZombie[iAttacker] && g_bIsZombie[iVictim])
{
set_pdata_float(iVictim, 108, 1.0, 50)

static Float:flOrigin[3]
pev(iAttacker, pev_origin, flOrigin)

hook_ent2(iVictim, flOrigin, KNOCKBACK_POWER, 2)
}

if(g_bIsZombie[iAttacker] && !g_bIsZombie[iVictim] && !g_bIsFrozen[iAttacker])
{
new players[32], pnum
get_players(players, pnum, "ae", "CT")

if(pnum > 1)
{
g_bIsZombie[iVictim] = true
PrepareNormalZombie(iVictim)
CheckWinConditions()

ExecuteForward(g_fwHumanInfected, g_fwReturn, iVictim)
}
}

}
}

// ===============================================================================
// Ham_PlayerKilledPost
// ===============================================================================

public Ham_PlayerKilledPost(iVictim, iKiller, bShouldGib)
{
if(g_bIsZombie[iVictim] && iVictim != g_iHostZombie)
{
client_print(iVictim, print_center, "Respawning in %i second(s).", floatround(TIME_HOST_RESPAWN))
CreateLoadingBar(iVictim, TIME_HOST_RESPAWN)

set_task(TIME_HOST_RESPAWN, "RespawnZombie", iVictim + iTaskID_RespawnZombie)
}

CheckWinConditions()
}

// ===============================================================================
// Ham_PlayerSpawnedPost
// ===============================================================================

public Ham_PlayerSpawnedPost(id)
{
if(g_bIsZombie[id] && id != g_iHostZombie)
PrepareNormalZombie(id)
else
PrepareHuman(id)
}

// ===============================================================================
// PrepareZombieCountdown
// ===============================================================================

public PrepareZombieCountdown()
{
set_task(float(g_iTimeRemaining), "SelectFirstZombie", iTaskID_FirstZombie)
}

// ===============================================================================
// SelectFirstZombie
// ===============================================================================

public SelectFirstZombie()
{
new iHostZombie = GetRandomPlayer()
g_bIsZombie[iHostZombie] = true

SetHostZombie(iHostZombie)
ExecuteForward(g_fwFirstZombieChosen, g_fwReturn, g_iHostZombie)
MoveHostZombie()
PrepareOriginZombie()
FreezePlayer(g_iHostZombie, TIME_RUN)
AnnounceZombie()
MoveOtherPlayersToCT()
}

// ===============================================================================
// StartPreparingMusic
// ===============================================================================

public StartPreparingMusic()
PlaySound(0, SOUND_READY)

// ===============================================================================
// PrepareAmbienceMusic
// ===============================================================================

public PrepareAmbienceMusic()
{
set_task(float(g_iTimeRemaining), "PlayAmbienceMusic", iTaskID_PlayAmbienceMusic)
}

// ===============================================================================
// ExecuteCountdown
// ===============================================================================

public ExecuteCountdown()
{
set_task(1.0 ,"PlayCountdownSound", iTaskID_Countdown, _, _, "b")
}

// ===============================================================================
// PlayCountdownSound
// ===============================================================================

public PlayCountdownSound(id)
{
set_hudmessage(0, 255, 0, -1.0, -1.0, 0, 6.0, 1.0)
show_hudmessage(0, "Time remaining until first Infection : %i second(s)", g_iTimeRemaining)

if(g_iTimeRemaining <= 10)
{
new szFileName[64]
formatex(szFileName, charsmax(szFileName), "zombie_escape/count/%i.wav", g_iTimeRemaining)
client_cmd(0, "spk ^"%s^"", szFileName)
}

g_iTimeRemaining--
if(g_iTimeRemaining <= 0) remove_task(iTaskID_Countdown)
}

// ===============================================================================
// PlayAmbienceMusic
// ===============================================================================

public PlayAmbienceMusic()
{
PlaySound(0, SOUND_AMBIENCE)
set_task(SOUND_AMBIENCE_LENGTH, "PlayAmbienceMusic", iTaskID_ReplayAmbienceMusic)
}

// ===============================================================================
// ResetFreezeTimeCounter
// ===============================================================================

public ResetFreezeTimeCounter()
{
g_iTimeRemaining = get_cvar_num("mp_freezetime")
g_iTimeFrozenRemaining = floatround(TIME_RUN)
}

// ===============================================================================
// SetHostZombie
// ===============================================================================

public SetHostZombie(iHostZombie)
g_iHostZombie = iHostZombie

// ===============================================================================
// AnnounceZombie
// ===============================================================================

public AnnounceZombie()
{
CheckHostZombieStatus()

new szName[33]
get_user_name(g_iHostZombie, szName, charsmax(szName))

set_hudmessage(42, 255, 0, -1.0, 0.85, 0, 6.0, 6.0)
show_hudmessage(0, "%s is the first Zombie!", szName)
}

// ===============================================================================
// MoveHostZombie
// ===============================================================================

public MoveHostZombie()
{
CheckHostZombieStatus()

if(cs_get_user_team(g_iHostZombie) != CS_TEAM_T) cs_set_user_team(g_iHostZombie, CS_TEAM_T)
}

// ===============================================================================
// CheckHostZombieStatus
// ===============================================================================

public CheckHostZombieStatus()
{
if(!is_user_connected(g_iHostZombie))
{
new iHostZombie = GetRandomPlayer()
SetHostZombie(iHostZombie)
MoveHostZombie()
PrepareOriginZombie()
}
}

// ===============================================================================
// MoveOtherPlayersToCT
// ===============================================================================

public MoveOtherPlayersToCT()
{
new iCount = 0

new players[32], pnum, tempid
get_players(players, pnum, "ae", "TERRORIST")

for( new i = 0; i<pnum; i++ )
{
tempid = players

if(iCount >= 5) set_task(0.5, "MoveOtherPlayersToCT")

if(tempid != g_iHostZombie)
{
PrepareHuman(tempid);
iCount++
}
}
}

// ===============================================================================
// PrepareOriginZombie
// ===============================================================================

public PrepareOriginZombie()
{
set_pdata_int(g_iHostZombie, 235, get_pdata_int(g_iHostZombie, 235) & ~(1<<0))

strip_user_weapons(g_iHostZombie)
give_item(g_iHostZombie, "weapon_knife")
engclient_cmd(g_iHostZombie, "weapon_knife")

cs_set_user_model(g_iHostZombie, MODEL_PLAYER_ORIGIN_NAME)
}

// ===============================================================================
// PrepareNormalZombie()
// ===============================================================================

public PrepareNormalZombie(id)
{
set_pdata_int(id, 235, get_pdata_int(id, 235) & ~(1<<0))

strip_user_weapons(id)
give_item(id, "weapon_knife")
engclient_cmd(id, "weapon_knife")

cs_set_user_team(id, CS_TEAM_T)
cs_set_user_model(id, MODEL_PLAYER_ZOMBIE_NAME)

set_user_health(id, HEALTH_HOST_ZOMBIE)
client_cmd(0, "spk ^"%s^"", SOUND_UNLEASH)
}

// ===============================================================================
// PrepareHuman
// ===============================================================================
public PrepareHuman(id)
{
cs_set_user_team(id, CS_TEAM_CT)
set_task(0.1, "ApplyPlayerModel", id)
}

public ApplyPlayerModel(id)
{
if (is_user_alive(id))
cs_set_user_model(id, g_CTSkins[random_num(0, MAX_SKINS-1)])
}

// ===============================================================================
// RespawnZombie
// ===============================================================================

public RespawnZombie(id)
{
id -= iTaskID_RespawnZombie
ExecuteHamB(Ham_CS_RoundRespawn, id)
}

// ===============================================================================
// RemoveTasks
// ===============================================================================

public RemoveTasks()
{
if(task_exists(iTaskID_EnableCountdown)) remove_task(iTaskID_EnableCountdown)
if(task_exists(iTaskID_Countdown)) remove_task(iTaskID_Countdown)
if(task_exists(iTaskID_FirstZombie)) remove_task(iTaskID_FirstZombie)
if(task_exists(iTaskID_PlayAmbienceMusic)) remove_task(iTaskID_PlayAmbienceMusic)
if(task_exists(iTaskID_ReplayAmbienceMusic)) remove_task(iTaskID_ReplayAmbienceMusic)
if(task_exists(iTaskID_FreezeHostZombie)) remove_task(iTaskID_FreezeHostZombie)

new players[32], pnum, id
get_players(players, pnum)

for( new i; i<pnum; i++ )
{
id = players
if(task_exists(id + iTaskID_RespawnZombie))
remove_task(id + iTaskID_RespawnZombie)
}
}

// ===============================================================================
// PlaySound
// ===============================================================================

stock PlaySound(id, const sound[])
{
if (equal(sound[strlen(sound)-4], ".mp3"))
client_cmd(id, "mp3 play ^"%s^"", sound)
else
client_cmd(id, "spk ^"%s^"", sound)
}

// ===============================================================================
// GetRandomPlayer
// ===============================================================================

stock GetRandomPlayer()
{
static player
new players[32], iPnum

get_players(players, iPnum, "a")
if(!iPnum) return 0

player = players[random(iPnum)]

if(!player) GetRandomPlayer()
else return player

return 0

}

// ===============================================================================
// FreezePlayer
// ===============================================================================

stock FreezePlayer(id, Float:flTime)
{
g_bIsFrozen[id] = true
set_user_maxspeed(id, 0.1)
set_task(flTime + 1.0, "UnfreezePlayer", id + iTaskID_FreezeHostZombie)

g_iTimeFrozenRemaining = floatround(TIME_RUN)
set_task(1.0, "FrozenCountdown", iTaskID_FrozenCountdown, _, _, "b")
}

public UnfreezePlayer(id)
{
id -= iTaskID_FreezeHostZombie
g_bIsFrozen[id] = false
set_user_maxspeed(id,270.0)
}

public FrozenCountdown(id)
{
set_hudmessage(255, 0, 0, 0.5, -1.0, 0, 6.0, 1.0)
show_hudmessage(g_iHostZombie, "Time remaining until Unleash : %i second(s)", g_iTimeFrozenRemaining)

if(g_iTimeFrozenRemaining <= 0)
{
client_cmd(0, "spk ^"%s^"", SOUND_UNLEASH)
remove_task(iTaskID_FrozenCountdown)
ExecuteForward(g_fwOriginZombieUnleashed, g_fwReturn)
}

g_iTimeFrozenRemaining--
}


// ===============================================================================
// ResetPlayerModels()
// ===============================================================================

public ResetPlayerModels()
{
new players[32], pnum, tempid
get_players(players, pnum)

for( new i; i<pnum; i++ )
{
tempid = players
cs_reset_user_model(tempid)
}
}

// ===============================================================================
// CheckWinConditions
// ===============================================================================

public CheckWinConditions()
{
new iZombies[32], iZombieNum
new iHumans[32], iHumanNum

get_players(iZombies, iZombieNum, "ae", "TERRORIST")
get_players(iHumans, iHumanNum, "ae", "CT")

if(iHumanNum <= 0)
{
TerminateRound( RoundEndType_TeamExtermination, TeamWinning_Terrorist)
ExecuteForward(g_fwHumansWon, g_fwReturn)
}
else if(iZombieNum <= 0)
{
TerminateRound( RoundEndType_TeamExtermination, TeamWinning_Ct)
ExecuteForward(g_fwZombiesWon, g_fwReturn)
}
}

// ===============================================================================
// hook_ent2
// ===============================================================================

stock hook_ent2(ent, Float:VicOrigin[3], Float:speed, type)
{
static Float:fl_Velocity[3]
static Float:EntOrigin[3]

pev(ent, pev_origin, EntOrigin)
static Float:distance_f
distance_f = get_distance_f(EntOrigin, VicOrigin)

new Float:fl_Time = distance_f / speed

if(type == 1)
{
fl_Velocity[0] = ((VicOrigin[0] - EntOrigin[0]) / fl_Time) * 1.5
fl_Velocity[1] = ((VicOrigin[1] - EntOrigin[1]) / fl_Time) * 1.5
fl_Velocity[2] = (VicOrigin[2] - EntOrigin[2]) / fl_Time
} else if(type == 2) {
fl_Velocity[0] = ((EntOrigin[0] - VicOrigin[0]) / fl_Time) * 1.5
fl_Velocity[1] = ((EntOrigin[1] - VicOrigin[1]) / fl_Time) * 1.5
fl_Velocity[2] = (EntOrigin[2] - VicOrigin[2]) / fl_Time
}

entity_set_vector(ent, EV_VEC_velocity, fl_Velocity)
}

// ===============================================================================
// Loading Bar
// ===============================================================================

stock CreateLoadingBar(id, Float:flTime = 0.0)
{
if( flTime < -0.0 )
{
return
}
static BarTime2 = 0
if( !BarTime2 )
{
BarTime2 = get_user_msgid("BarTime2")
}

new iSeconds = floatround(flTime, floatround_ceil)

message_begin(MSG_ONE, BarTime2, .player=id)
write_short(iSeconds)
write_short( 100 - floatround( (flTime/ iSeconds ) * 100 ) )
message_end()
}

stock DestroyLoadingBar(id)
{
static BarTime2 = 0
if( !BarTime2 )
{
BarTime2 = get_user_msgid("BarTime2")
}
message_begin(MSG_ONE, BarTime2, .player=id)
write_short(0)
write_short(0)
message_end()
}
public fw_ClientKill( pPlayer )
return FMRES_SUPERCEDE;
 

Вложения

Последнее редактирование модератором:
Сообщения
2,750
Реакции
3,013
Помог
61 раз(а)
Код:
// ===============================================================================
// CheckWinConditions
// ===============================================================================

public CheckWinConditions()
{
new iZombies[32], iZombieNum
new iHumans[32], iHumanNum

get_players(iZombies, iZombieNum, "ae", "TERRORIST")
get_players(iHumans, iHumanNum, "ae", "CT")

if(iHumanNum <= 0)
{
TerminateRound( RoundEndType_TeamExtermination, TeamWinning_Terrorist)
ExecuteForward(g_fwHumansWon, g_fwReturn)
}
else if(iZombieNum <= 0)
{
TerminateRound( RoundEndType_TeamExtermination, TeamWinning_Ct)
ExecuteForward(g_fwZombiesWon, g_fwReturn)
}
}


TerminateRound( RoundEndType_TeamExtermination, TeamWinning_Ct)
нужно использовать натив от Reapi, который задействует:
Код:
/*
* Complete the round
*
* @param tmDelay Delay before the onset of a new round.
* @param st Which team won
* @param event The event is the end of the round
* @param message The message on round end
* @param sentence The sound at the end of the round
*
* @noreturn
*/
native rg_round_end(const Float:tmDelay, const WinStatus:st, const ScenarioEventEndRound:event = ROUND_NONE, const message[] = "default", const sentence[] = "default");

C++:

enum WinStatus
{
WINSTATUS_CTS = 1,
WINSTATUS_TERRORISTS,
WINSTATUS_DRAW,
};


А вот и строчки, в которых нужно задействовать Reapi
Код:

zombie_escape_v2_core.sma(929) : error 017: undefined symbol "TerminateRound"
zombie_escape_v2_core.sma(934) : error 017: undefined symbol "TerminateRound"
 
Последнее редактирование:
Сообщения
2,750
Реакции
3,013
Помог
61 раз(а)
QuakeR, Держи, переделал под Reapi
Сначала закомментируй сверху:
Код:
// #include <round_terminator>

Код:

// ===============================================================================
// CheckWinConditions
// ===============================================================================

#include <reapi>
public CheckWinConditions()
{
new iZombies[32], iZombieNum
new iHumans[32], iHumanNum

get_players(iZombies, iZombieNum, "ae", "TERRORIST")
get_players(iHumans, iHumanNum, "ae", "CT")

if(iHumanNum <= 0)
{
//TerminateRound( RoundEndType_TeamExtermination, TeamWinning_Terrorist)
rg_round_end(
.tmDelay = 1.0,
.st = WINSTATUS_TERRORISTS,
.message = "Победа за зомби!"
)

ExecuteForward(g_fwHumansWon, g_fwReturn)
}
else if(iZombieNum <= 0)
{
// TerminateRound( RoundEndType_TeamExtermination, TeamWinning_Ct)
rg_round_end(
.tmDelay = 1.0,
.st = WINSTATUS_CTS,
.message = "Победа за людьми!"
)

ExecuteForward(g_fwZombiesWon, g_fwReturn)
}
}


Готовый исходник во вложении.
 

Вложения

Последнее редактирование:

Пользователи, просматривающие эту тему

Сейчас на форуме нет ни одного пользователя.
Сверху Снизу