Witam.
Dziś edytując silnik PaintBall z tego tematu natknąłem się na dziwną dla mnie rzecz.
Jak mam rozumieć ten fragment kodu?
public new_round()
if (get_pcvar_num(onoff) && get_pcvar_num(strip))
{
new ent;
while ((ent = engfunc(EngFunc_FindEntityByString, ent, "classname", "armoury_entity")) != 0)
engfunc(EngFunc_RemoveEntity, ent);
}
public ev_resethud(id)
if (get_pcvar_num(onoff))
if (!task_exists(id))
set_task(0.3, "player_spawn", id);
public player_spawn(id)
if (is_user_alive(id))
{
if (get_pcvar_num(protc))
{
set_pev(id, pev_takedamage, DAMAGE_NO);
set_task(float(get_pcvar_num(protc)), "player_godmodeoff", id+100);
}
if (get_pcvar_num(strip) && !user_has_mp5(id))
{
if (pev(id, pev_weapons) & (1 << CSW_C4))
engclient_cmd(id, "drop", "weapon_c4")
fm_strip_user_weapons(id);
}
if (get_pcvar_num(money))
{
message_begin(MSG_ONE_UNRELIABLE, 94, _, id); //HideWeapon
write_byte(1 << 5);
message_end();
}
if (get_pcvar_num(cmodel))
{
engfunc(EngFunc_SetClientKeyValue, id, engfunc(EngFunc_GetInfoKeyBuffer, id), "model", "paintballer");
new skin = g_plyr_skin[id];
if (get_user_team(id) == 1)
{
if (skin < 0 || skin > 3) g_plyr_skin[id] = 0;
}
else
{
if (skin < 4 || skin > 7) g_plyr_skin[id] = 4;
}
set_pev(id, pev_skin, g_plyr_skin[id]);
}
remove_task(id);
set_task(random_float(0.9, 1.3), "player_weapons", id);
set_task(2.0, "clear_moneyhud", id + 300);
}
public client_command(id)
if (get_pcvar_num(cmodel))
{
new command[10], speech[2];
read_argv(0, command, 9);
read_argv(1, speech, 1);
if (containi(command, "join") != -1)
if (equali(command, "jointeam"))
g_team_select[id] = str_to_num(speech);
else if (equali(command, "joinclass"))
g_plyr_skin[id] = (g_team_select[id] == 1) ? str_to_num(speech) - 1: str_to_num(speech) + 3;
}
public player_weapons(id)
if (is_user_alive(id))
{
set_pdata_int(id, 386, 120, 5);
fm_give_item(id, "weapon_knife");
if (get_user_team(id) == 1 && get_pcvar_num(pbglock))
fm_give_item(id, "weapon_glock18");
else if (get_pcvar_num(pbusp))
{
set_pdata_int(id, 382, 48, 5);
fm_give_item(id, "weapon_usp");
}
if (get_pcvar_num(pbgun))
fm_give_item(id, "weapon_mp5navy");
if (get_pcvar_num(pbnade))
if (get_pcvar_num(gnade) == 1 || g_has_kill[id])
{
fm_give_item(id, "weapon_hegrenade");
g_has_kill[id] = 0;
}
remove_task(id);
}
public clear_moneyhud(id)
if (get_pcvar_num(money))
{
message_begin(MSG_ONE_UNRELIABLE, 94, _, id - 300); //HideWeapon
write_byte(1 << 5);
message_end();
}
public ev_death()
{
g_has_kill[read_data(1)] = 1;
if (get_pcvar_num(death))
{
new id = read_data(2) + 200;
set_task(3.0, "player_spawner", id);
set_task(3.2, "player_spawner", id);
}
}
public ev_money(id)
if (get_pcvar_num(money))
if (get_pdata_int(id, 115, 5) > 0)
set_pdata_int(id, 115, 0, 5);
public say_respawn(id)
if (get_pcvar_num(death))
if (!is_user_alive(id))
if (get_user_team(id) == 1 || get_user_team(id) == 2)
{
set_task(1.5, "player_spawner", id + 200);
set_task(1.7, "player_spawner", id + 200);
}
public player_godmodeoff(id)
set_pev(id-100, pev_takedamage, DAMAGE_AIM);
public player_spawner(id)
if (is_user_connected(id - 200))
if (get_user_team(id - 200) == 1 || get_user_team(id - 200) == 2)
dllfunc(DLLFunc_Spawn, id - 200);
Chodzi mi przede wszystkim o klamerki otwierające i zamykające public'i.
Plugin w praktyce niby działa, ale czy taki zapis jest poprawny (bez klamerek)?


Dodatki SourceMod













