Postby v1k1r » Mon Jul 06, 2020 6:40 pm
Syntax: Select all
from messages import SayText2
from events import Event
from colors import Color
from players.entity import Player
from players.helpers import index_from_userid
from entities.constants import EntityEffects
def load():
SayText2('Plugin Predator has been loaded successfully!').send()
def unload():
SayText2('Plugin Predator has been unloaded successfully!').send()
INVISIBLE = Color(255, 255, 255, 0)
FLASHED = Color(128, 255, 128, 255)
@Event('player_team')
def on_player_team(game_event):
# Retrieve the user ID of the victim
userid = game_event['userid']
index = index_from_userid(userid)
player = Player(index)
# Retrieve the user ID of the attacker
team = game_event['team']
if team == 3: # CT
SayText2(f'{player.name} Is now Hunter!').send()
player.cash = 16000
else: # T
SayText2(f'{player.name} Is now Predator!').send()
@Event('player_spawn')
def player_spawn(event):
player = Player.from_userid(event['userid'])
# Is this a terrorist?
if player.team == 2:
player.color = INVISIBLE
player.effects |= EntityEffects.NODRAW
SayText2(f'{player.name} Is now Invisible!').send()
elif player.team == 3: # CT Player
player.cash = 16000
@Event('player_death')
def player_died(event):
player = Player.from_userid(event['userid'])
attacker = Player.from_userid(event['attacker'])
if attacker.team == 3 and player.team == 2:
player.team = 3
attacker.team = 2
@Event('player_blind')
def player_blinded(event):
player = Player.from_userid(event['userid'])
attacker = Player.from_userid(event['attacker'])
duration = event['blind_duration']
if player.team == 2 and attacker.team == 3:
SayText2(f'{player.name} Is now Flashed by {attacker.name}!').send()
player.color = FLASHED
player.effects = EntityEffects.ITEM_BLINK
while duration > 0.1:
duration -= 0.05
if duration < 0.2 and player.team == 2 and attacker.team == 3:
break
if player.team == 2 and attacker.team == 3:
SayText2(f'{duration}').send()
if player.team == 2 and attacker.team == 3:
SayText2(f'Broke OUT!').send()
player.color = INVISIBLE
player.effects |= EntityEffects.NODRAW
Well problem with last part, is that it's not showing player model while player is flashed, what am trying to do is While player is flashed hes model is visible, and when blind over it's invisible again
My English is not perfect, but i try :D