Quote:
Originally Posted by E1_531G
Take a look on Objective Reset by HamletEagle.
|
Can it be done without orpheu?
HTML Code:
case Obj_ResetVip:
{
new Players[32], Num
get_players(Players, Num, "ae", "CT")
if(Num > 1)
{
new OldVip = get_gamerules_data("m_pVIP")
if(is_user_alive(OldVip) && !get_pdata_bool(OldVip, m_bEscaped))
{
//RemoveCurrentVIP does not fix the score attrib and armor
message_begin(SendReliableMessages ? MSG_ALL : MSG_BROADCAST, gmsgScoreAttrib)
{
write_byte(OldVip)
write_byte(0)
message_end()
}
cs_set_user_armor(OldVip, 100, CS_ARMOR_KEVLAR)
cs_set_user_bpammo(OldVip, CSW_USP, 24)
cs_set_weapon_ammo(find_ent_by_owner(-1, "weapon_usp", OldVip), 12)
/*
| The function will choose the next vip and reset the current one if this offset is above 2.
| We force that by altering the offset.
| I don't like much that, but there is no other way. Also, I believe it won't fuck up something
| The offset is immediately resetted to 0 and increased. This is default game behaviour.
*/
set_gamerules_data("m_iConsecutiveVip", 3)
SendHookableCalls ?
OrpheuCallSuper(HandleHooks[PickNextVip], g_pGameRules) :
OrpheuCall(HandleHooks[PickNextVip], g_pGameRules)
set_gamerules_data("m_iConsecutiveVip", get_gamerules_data("m_iConsecutiveVip") + 1)
new NewVip = get_gamerules_data("m_pVIP")
if(1 <= NewVip <= MaxPlayers)
{
SendHookableCalls ?
ExecuteHamB(Ham_CS_RoundRespawn, NewVip) :
ExecuteHam(Ham_CS_RoundRespawn, NewVip)
SuccesfullReset = true
}
}
}
}
__________________