Syntax: Select all
from engines.precache import Model
from events import Event
from players import UserCmd
from players.constants import PlayerButtons, PlayerStates
from players.entity import Player
from weapons.entity import Weapon
from entities.entity import BaseEntity
from engines.precache import Model
from stringtables.downloads import Downloadables
import math
from mathlib import Vector
from messages import SayText2
#=============================================================
#DOWNLOADS
#=============================================================
downloadables = Downloadables()
downloadables.add_directory('models/weapons/ak47-beast')
downloadables.add_directory('materials/models/weapons/v_models/CF_ak47_BEAST')
downloadables.add_directory('materials/models/weapons/w_models/CF_ak47_BEAST')
models = Model("models/weapons/ak47-beast/w_rif_ak47.mdl")
#=============================================================
#FUNCTIONS
#=============================================================
def set_weapon_model(game_event):
player = Player.from_userid(game_event['userid'])
player.set_name('AK47 Beast Test')
weapon = player.get_active_weapon()
if weapon.weapon_name == 'weapon_ak47':
weapon.set_model(models)
#=============================================================
#EVENTS
#=============================================================
@Event('player_jump')
def on_player_jump(game_event):
set_weapon_model(game_event)
Hello, I'm new to SourcePython and testing it for a while. Currently I'm trying to change the model of the AK47 to a Skin.
I can change my character model to the AK47 Skin but not the weapon model.
How do I change the model of a weapon ?