Hello source-python,
I would like to request a free for all plugin like this one from sourcemod, https://forums.alliedmods.net/showthread.php?p=1465985%20
free for all
-
- Junior Member
- Posts: 6
- Joined: Tue May 16, 2023 4:30 pm
Re: free for all
I don't have much time right now, but all you would need to do is remove the GunGame specific code from GG-FFA:
https://github.com/GunGame-Dev-Team/Gun ... /gg_ffa.py
https://github.com/GunGame-Dev-Team/Gun ... /gg_ffa.py
-
- Junior Member
- Posts: 6
- Joined: Tue May 16, 2023 4:30 pm
Re: free for all
satoon101 wrote:I don't have much time right now, but all you would need to do is remove the GunGame specific code from GG-FFA:
https://github.com/GunGame-Dev-Team/Gun ... /gg_ffa.py
i'm sorry i have no idea what you mean,
Re: free for all
Sorry, it was more for if someone wanted to write it up for you really quick, since I did not have the time. But, I have a few minutes now, so try this:
Syntax: Select all
# =============================================================================
# >> IMPORTS
# =============================================================================
# Source.Python
from entities import TakeDamageInfo
from entities.entity import Entity
from entities.hooks import EntityCondition, EntityPostHook, EntityPreHook
from memory import make_object
from memory.hooks import use_pre_registers
# =============================================================================
# >> GLOBAL VARIABLES
# =============================================================================
# Store a variable to know whether to revert the team or not
_take_damage_dict = {}
# =============================================================================
# >> HOOKED FUNCTIONS
# =============================================================================
@EntityPreHook(EntityCondition.is_bot_player, 'on_take_damage')
@EntityPreHook(EntityCondition.is_human_player, 'on_take_damage')
def _pre_take_damage(stack_data):
"""Change the victim's team if they are on the attacker's team."""
take_damage_info = make_object(TakeDamageInfo, stack_data[1])
attacker = Entity(take_damage_info.attacker)
if attacker.classname != 'player':
return
victim = make_object(Entity, stack_data[0])
if victim.team_index != attacker.team_index:
return
address = stack_data[0].address
if address in _take_damage_dict:
return
_take_damage_dict[address] = (victim.index, victim.team_index)
# Change the player's team by using the m_iTeamNum property
victim.team_index = 5 - victim.team_index
@EntityPostHook(EntityCondition.is_bot_player, 'on_take_damage')
@EntityPostHook(EntityCondition.is_human_player, 'on_take_damage')
def _post_take_damage(stack_data, return_value):
"""Revert the victim's team if necessary."""
with use_pre_registers(stack_data):
address = stack_data[0].address
if address not in _take_damage_dict:
return
index, team = _take_damage_dict.pop(address)
Entity(index).team_index = team
-
- Junior Member
- Posts: 6
- Joined: Tue May 16, 2023 4:30 pm
Re: free for all
Oh okay,
it works
it works
Who is online
Users browsing this forum: No registered users and 3 guests