Участник
Пользователь
- Сообщения
- 317
- Реакции
- 131
- Помог
- 4 раз(а)
fox, короче хз ваще, пробуй этот https://dev-cs.ru/threads/7141/page-3#post-63997
Через Notepad++malniata,
Код:// C:\Users\skynet\Desktop\cs\ъюьяшы ЄюЁ√ amxx\amx 1.9.0\last_players.sma(126) : error 029: invalid expression, assumed zero // C:\Users\skynet\Desktop\cs\ъюьяшы ЄюЁ√ amxx\amx 1.9.0\last_players.sma(126) : warning 215: expression has no effect // C:\Users\skynet\Desktop\cs\ъюьяшы ЄюЁ√ amxx\amx 1.9.0\last_players.sma(126) : warning 215: expression has no effect // C:\Users\skynet\Desktop\cs\ъюьяшы ЄюЁ√ amxx\amx 1.9.0\last_players.sma(126) : error 001: expected token: ";", but found ")" // C:\Users\skynet\Desktop\cs\ъюьяшы ЄюЁ√ amxx\amx 1.9.0\last_players.sma(126) : error 029: invalid expression, assumed zero // C:\Users\skynet\Desktop\cs\ъюьяшы ЄюЁ√ amxx\amx 1.9.0\last_players.sma(126) : fatal error 107: too many error messages on one line
rg_send_audio([play
rg_send_audio(play
#include <amxmodx>
#include <reapi>
#if AMXX_VERSION_NUM < 183
new MaxClients;
#endif
// to /cstrike/sound
new const MUSIC_FILE[] = "lasthuman.wav"; // sound .wav
new bool: g_alreadyPlayed[3];
public plugin_precache()
{
precache_sound(MUSIC_FILE);
}
public plugin_init()
{
register_plugin("Last Players","0.2","alabamaster1337 & dev-cs");
RegisterHookChain(RG_CBasePlayer_Killed, "HC_CBasePlayer_Killed_Post", true);
RegisterHookChain(RH_SV_DropClient, "HookDropClient", .post=true);
RegisterHookChain(RG_CSGameRules_RestartRound, "GameRules_RestartRound", .post=true);
#if AMXX_VERSION_NUM < 183
MaxClients = get_maxplayers();
#endif
}
public GameRules_RestartRound()
for (new i; i < 3; i++)
g_alreadyPlayed[i] = false;
public HookDropClient()
check_last_players();
// amx-x.ru
public HC_CBasePlayer_Killed_Post()
check_last_players();
check_last_players() {
new players[TeamName], playerId[TeamName];
for (new id = 1; id <= MaxClients; id++)
{
if (is_user_alive(id) && (TEAM_UNASSIGNED < get_member(id, m_iTeam) < TEAM_SPECTATOR))
{
players[get_member(id, m_iTeam)]++;
playerId[get_member(id, m_iTeam)] = id;
}
}
new untitled = -1;
if (!g_alreadyPlayed[0] && (players[TEAM_CT] < 2 > players[TEAM_TERRORIST]))
{
rg_send_audio(playerId[TEAM_CT], MUSIC_FILE);
rg_send_audio(playerId[TEAM_TERRORIST], MUSIC_FILE);
untitled = 0;
}
else if (!g_alreadyPlayed[1] && players[TEAM_CT] == 1 && players[TEAM_TERRORIST] > 1)
{
rg_send_audio(playerId[TEAM_CT], MUSIC_FILE);
untitled = 1;
}
else if (!g_alreadyPlayed[2] && players[TEAM_TERRORIST] == 1 && players[TEAM_CT] > 1)
{
rg_send_audio(playerId[TEAM_TERRORIST], MUSIC_FILE);
untitled = 2;
}
if (untitled == -1)
return;
g_alreadyPlayed[untitled] = true;
}
for (new i; i < 3; i++)
g_alreadyPlayed[i] = false;
Теперь буду знать такой метод, спасибо. в чем умысел char? до этого я использовал такой способ обнуления, но не использовал char в создании переменнойСразу видно не шарите за оптимизацию.
Надо так:
Обнуление:Код:new bool:g_alreadyPlayed[3 char];
Код:g_alreadyPlayed{0} = g_alreadyPlayed{1} = g_alreadyPlayed{2} = false;
Сами вы щизанутый.
#include <amxmodx>
#include <reapi>
enum ( <<=1 ) {
CT_PLAYED = 1,
TT_PLAYED
}
new played;
new HookChain:HookKilled;
new const MUSIC_FILE[] = "lasthuman.wav";
public plugin_precache()
{
precache_sound(MUSIC_FILE);
}
public plugin_init()
{
register_plugin("Last Man Standing", "1.0", "Garey");
HookKilled = RegisterHookChain(RG_CBasePlayer_Killed, "HC_CBasePlayer_Killed_Post", true);
RegisterHookChain(RG_CSGameRules_RestartRound, "HC_RoundStarted", true);
DisableHookChain(HookKilled);
}
public HC_RoundStarted()
{
played = 0;
EnableHookChain(HookKilled);
}
public HC_CBasePlayer_Killed_Post()
{
new players_ct[32], players_t[32], ict, ite;
get_players(players_ct,ict,"ae","CT")
get_players(players_t,ite,"ae","TERRORIST")
if(ict == 1 && ~played & CT_PLAYED)
{
rg_send_audio(players_ct[0], MUSIC_FILE);
played |= CT_PLAYED;
}
if(ite == 1 && ~played & TT_PLAYED)
{
rg_send_audio(players_t[0], MUSIC_FILE);
played |= TT_PLAYED;
}
if(played & CT_PLAYED && played & TT_PLAYED)
{
DisableHookChain(HookKilled);
}
}
Если я правильно понимаю, эта функция так же использует цикл. arrayset Githubalabamaster1337,
я конечно не скриптор, но можно сделать через arraysetКод:for (new i; i < 3; i++) g_alreadyPlayed[i] = false;