Post by macxz2 on Mar 24, 2023 22:03:13 GMT
Hello, I've did task for my Lock. There is a problem the unlock getting impacted so VIP will need to wait until 20 seconds for unlock, tried to do something but didn'work
Unlock should be at any times
Lock codes
Unlock should be at any times
new bool:Lockround
// Log Event Round Start (This is AFTER freeze time)
public logevent_round_start()
{
set_pev(g_iEntBarrier,pev_solid,SOLID_BSP)
set_pev(g_iEntBarrier,pev_rendermode,1)
DispatchKeyValue(g_iEntBarrier, "renderamt", "255");
set_hudmessage(255, 255, 255, -1.0, 0.45, 0, 1.0, 10.0, 0.1, 0.2, 1)
new nLen, szMsg[128]
nLen += format( szMsg[nLen], 127-nLen, "%L", LANG_SERVER, "WELCOME_MSG", VERSION);
nLen += format( szMsg[nLen], 127-nLen, "%L", LANG_SERVER, "BIND_KEY");
show_hudmessage(0, szMsg);
print_color(0, "%s %s ^x04- ^x01%L", formatmodname, VERSION, LANG_SERVER, "ROUND_MSG")
print_color(0, "%s Round: %d of %d", formatmodname, (g_RoundNum+1), g_pcvar_maxrounds)
remove_task(TASK_ROUND)
remove_task(30000)
remove_task(TASK_ID)
new iBuildTime = get_pcvar_num( g_pcvar_buildtime );
set_task(1.0, "CountDown", 30000, "", 0, "a", iBuildTime);
count_down = (iBuildTime-1);
set_task(float(iBuildTime), "Release_Zombies", TASK_ROUND)
if (get_pcvar_num(g_pcvar_basecalc) == 1)
set_task(5.0, "Base_Calc")
set_task(5.0, "Fix_Spawns")
g_CanBuild = true
Lockround = true
arrayset(g_MovingEnt, false, MAXENTS)
arrayset(g_EntOwner, 0, MAXENTS)
arrayset(g_OwnedEnts, 0, g_MaxPlayers+1)
set_task((get_cvar_float("mp_roundtime") * 60) - 21, "Lock_round", TASK_ID)
}
public Lock_round()
{
Lockround = false
}
Lock codes
public cmdLockBlock(id)
{
new ent, bodypart
get_user_aiming (id,ent,bodypart)
new tname[7], cname[10];
entity_get_string(ent, EV_SZ_targetname, tname, 6);
entity_get_string(ent, EV_SZ_classname, cname, 9);
if ((Lockround || !access(id, ADMIN_VOTE)) && !access(id, LOCK_BLOCKS))
{
if (access(id, ADMIN_VOTE))
{
client_print(id, print_chat, "[X-BB] You can only lock base at last 20 seconds before the round end!");
}
return PLUGIN_HANDLED;
}
if (!ent || !is_valid_ent(ent) || is_user_alive(ent) || ent == g_iEntBarrier || !equal(cname, "func_wall") || equal(tname, "ignore")) return PLUGIN_HANDLED
if (!IsBlockLocked(ent) && !g_MovingEnt[ent])
{
LockBlock(ent)
DispatchKeyValue(ent, "rendermode", "1");
DispatchKeyValue(ent, "rendercolor", "125.0 0.0 0.0");
g_OwnedEnts[g_EntOwner[ent]]--
g_EntOwner[ent] = 0
}
else if (IsBlockLocked(ent))
{
UnlockBlock(ent)
DispatchKeyValue(ent, "rendermode", "0");
}
return PLUGIN_HANDLED
}