Dodałem do zabawy, lecz nie działa.
Znajduje się to w public OnDayStartPre
#include
#include
#include
#include
#include
#include // MUSISZ UŻYC ABY UŻYWAĆ NATYVU "fm_set_user_health"
#include
#include
#include
#define PLUGIN "[JB] Ninja's"
#define VERSION "1.0"
#define AUTHOR "kIImIIz"
#define STR_T 33
#define fm_get_user_button(%1) pev(%1, pev_button)
/* stock fm_get_user_button(index)
return pev(index, pev_button) */
#define fm_get_entity_flags(%1) pev(%1, pev_flags)
/* stock fm_get_entity_flags(index)
return pev(index, pev_flags) */
//End of stuff from fakemeta_util
//new STR_T[32]
new bool:g_WallClimb[33]
new Float:g_wallorigin[32][3]
new id_ninja;
new const maxAmmo[31] = {0,52,0,90,1,31,1,100,90,1,120,100,100,90,90,90,100,120,30,120,200,31,90,120,90,2,35,90,90,0,100};
new bool:blokuj_sklep[33] = false;
new iIloscGraczy = get_playersnum(); //pobieramy ilość graczy (wraz z HLTV)
new iHpBaza = 100; //podstawa do obliczeń
new iHpDocelowe = iHpBaza*iIloscGraczy; //wyznaczenie docelowej ilosci HP
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
id_ninja = jail_register_game("Ninja's")
register_forward(FM_Touch, "fwd_touch")
register_forward(FM_PlayerPreThink, "fwd_playerprethink")
register_clcmd("say","block");
register_clcmd("say_team","block");
}
public plugin_precache()
{
precache_sound("ambience/laugh_dp.wav");
precache_sound("jb_cypis/ninja2.mp3");
}
public block(id)
{
new szCommand[192];
read_args(szCommand,charsmax(szCommand));
if(equali(szCommand, "/sklep") && blokuj_sklep[id] == true){
return PLUGIN_HANDLED;
}
return PLUGIN_CONTINUE;
}
public OnRemoveData(day)
{
if(day == id_ninja)
{
set_lights("#OFF");
client_cmd(0, "mp3 stop");
}
}
public OnLastPrisonerShowWish(day)
{
OnRemoveData(day);
}
public OnDayStartPre(day, szInfo[256], szInfo2[512], setting[10], gTimeRound)
{
static szTime[12];
if(day == id_ninja)
{
format_time(szTime, 11, "%M:%S", gTimeRound-30);
formatex(szInfo2, 511, "Zasady:^n - CT ma zabic wiezniow ktore sa niewidzialne^n - Zakaz kampienia^nOstatni wiezien ma zyczenie", szTime, szTime);
szInfo = "Ninja's Day";
jail_set_prisoners_micro(true, true);
jail_set_ct_hit_tt(false);
jail_set_tt_hit_ct(false);
setting[0] = 2;
setting[1] = 0;
setting[2] = 1;
setting[3] = 1;
setting[4] = 3;
setting[6] = 1;
setting[7] = 2;
for(new i=1; i<=iIloscGraczy; i++)
{
if(!is_user_alive(i) || get_user_team(i) != 2) //sprawdzając, czy gracz żyje, automatycznie sprawdzamy, czy gracz jest połączony
continue;
set_user_health(i, iHpDocelowe);
}
}
}
public OnDayStartPost(day)
{
if(day != id_ninja)
return;
jail_set_game_hud(10, "Rozpoczecie zabawy za");
client_cmd(0, "mp3 play sound/jb_cypis/ninja2.mp3");
set_lights("b");
for(new i=1; i<=MAX; i++)
{
if(!is_user_alive(i) || cs_get_user_team(i) != CS_TEAM_T) // WYGODNIEJ JEST UŻYWAĆ TEGO SPARWDZANIA, SAMO "!=" POKAZUJE ŻE POMIJASZ TEAMCT
continue; // ROWNIEZ MUSI BYC, I NIE UZYWASZ JUZ TUTAJ "{" ORAZ "}", GDYŻ "continue" DZIALA NA ZASADZIE ELSE
blokuj_sklep[i] = true;
if(get_user_flags(i) & ADMIN_LEVEL_G)
fm_set_user_health(i, 150);
else if(get_user_flags(i) & ADMIN_LEVEL_H)
fm_set_user_health(i, 130);
else fm_set_user_health(i, 100);
}
}
public OnGameHudEnd(day)
{
for(new i=1; i<=32; i++)
{
if(!is_user_alive(i) || !is_user_connected(i) )
continue;
if(day != id_ninja)
return;
set_hudmessage(255, 0, 0, -1.0, -1.0, 0, 6.0, 5.0);
show_hudmessage(0, "Fight!");
jail_open_cele();
emit_sound(0, CHAN_AUTO, "ambience/laugh_dp.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);
blokuj_sklep[i] = false;
if(cs_get_user_team(i) != CS_TEAM_T)
{
strip_user_weapons(i);
give_item(i, "weapon_knife");
give_item (i, "weapon_tmp");
cs_set_user_bpammo(i, CSW_TMP, maxAmmo[CSW_TMP]);
set_user_health(i, 100);
set_user_rendering(i, kRenderFxGlowShell, 0, 0, 100, kRenderNormal, 15);
}
else
{
strip_user_weapons(i)
give_item(i, "weapon_knife");
jail_set_user_speed(i, 500.0);
set_user_rendering(i, kRenderFxNone, 0, 0, 0, kRenderTransAlpha, 10);
set_user_footsteps(i, 1);
set_user_maxspeed(i, 500.0);
}
}
for(new i=1; i<=MAX; i++)
{
if(!is_user_alive(i) || cs_get_user_team(i) != CS_TEAM_T) // WYGODNIEJ JEST UŻYWAĆ TEGO SPARWDZANIA, SAMO "!=" POKAZUJE ŻE POMIJASZ TEAMCT
continue; // ROWNIEZ MUSI BYC, I NIE UZYWASZ JUZ TUTAJ "{" ORAZ "}", GDYŻ "continue" DZIALA NA ZASADZIE ELSE
if(get_user_flags(i) & ADMIN_LEVEL_G)
fm_set_user_health(i, 150);
else if(get_user_flags(i) & ADMIN_LEVEL_H)
fm_set_user_health(i, 130);
else fm_set_user_health(i, 100);
}
}
public EventDeathMsg()
{
new id = read_data(2)
g_WallClimb[id] = true
return PLUGIN_HANDLED
}
public client_connect(id) {
g_WallClimb[id] = true
}
public fwd_touch(id, world, day)
{
if(!is_user_alive(id) || !g_WallClimb[id] || day != id_ninja)
return FMRES_IGNORED
new classname[STR_T]
pev(world, pev_classname, classname, (STR_T-1))
if(equal(classname, "worldspawn") || equal(classname, "func_wall") || equal(classname, "func_breakable"))
pev(id, pev_origin, g_wallorigin[id])
return FMRES_IGNORED
}
public wallclimb(id, button)
{
static Float:origin[3]
pev(id, pev_origin, origin)
if(get_distance_f(origin, g_wallorigin[id]) > 25.0)
return FMRES_IGNORED // if not near wall
if(fm_get_entity_flags(id) & FL_ONGROUND)
return FMRES_IGNORED
if(fm_get_entity_flags(id) & FL_FLY )
return PLUGIN_HANDLED
if(button & IN_FORWARD)
{
static Float:velocity[3]
velocity_by_aim(id, 120, velocity)
fm_set_user_velocity(id, velocity)
}
else if(button & IN_BACK)
{
static Float:velocity[3]
velocity_by_aim(id, -120, velocity)
fm_set_user_velocity(id, velocity)
}
return FMRES_IGNORED
}
public fwd_playerprethink(id, day)
{
if(!g_WallClimb[id] || day != id_ninja)
return FMRES_IGNORED
new button = fm_get_user_button(id)
if(button & IN_USE) //Use button = climb
{
static Float:origin[3]
pev(id, pev_origin, origin)
if(get_distance_f(origin, g_wallorigin[id]) > 10.0)
return FMRES_IGNORED // if not near wall
if(fm_get_entity_flags(id) & FL_ONGROUND)
return FMRES_IGNORED
if(button & IN_FORWARD)
{
static Float:velocity[3]
velocity_by_aim(id, 120, velocity)
fm_set_user_velocity(id, velocity)
}
else if(button & IN_BACK)
{
static Float:velocity[3]
velocity_by_aim(id, -120, velocity)
fm_set_user_velocity(id, velocity)
}
}
else if((button & IN_JUMP) && button & IN_DUCK) //Jump + Duck = climb
{
static Float:origin[3]
pev(id, pev_origin, origin)
if(get_distance_f(origin, g_wallorigin[id]) > 10.0)
return FMRES_IGNORED // if not near wall
if(fm_get_entity_flags(id) & FL_ONGROUND)
return FMRES_IGNORED
if(button & IN_FORWARD)
{
static Float:velocity[3]
velocity_by_aim(id, 120, velocity)
fm_set_user_velocity(id, velocity)
}
else if(button & IN_BACK)
{
static Float:velocity[3]
velocity_by_aim(id, -120, velocity)
fm_set_user_velocity(id, velocity)
}
}
return FMRES_IGNORED
}