Giving player a weapon in cs:go
Giving player a weapon in cs:go
How do I spawn a weapon and give it to a player in CS:GO, since Player.give_named_item('weapon_ak47') doesn't work. Should I be looking at Entity.create?
Re: Giving player a weapon in cs:go
Hey, I'm not sure why give_named_item does not work for you but this worked for me:
Alternatively as you said Entity.create will do the trick too:
I'm testing on windows though, maybe the offsets for give_named_item are outdated on Linux (if you are on Linux)?
Syntax: Select all
from players.entity import Player
from events import Event
@Event('player_say')
def _player_say(ev):
player = Player.from_userid(ev['userid'])
player.give_named_item("weapon_ak47")
Alternatively as you said Entity.create will do the trick too:
Syntax: Select all
from players.entity import Player
from events import Event
from entities.entity import Entity
@Event('player_say')
def _player_say(ev):
player = Player.from_userid(ev['userid'])
weapon = Entity.create("weapon_ak47")
weapon.spawn()
weapon.origin = player.origin
I'm testing on windows though, maybe the offsets for give_named_item are outdated on Linux (if you are on Linux)?
Re: Giving player a weapon in cs:go
Okay it works now for some reason :/ meh, keep the thread open, so other people can see how to give a weapon anyways.
Return to “Plugin Development Support”
Who is online
Users browsing this forum: Google [Bot] and 97 guests