giving item not working for csgo

Please post any questions about developing your plugin here. Please use the search function before posting!
8guawong
Senior Member
Posts: 148
Joined: Sat Sep 20, 2014 3:06 am

giving item not working for csgo

Postby 8guawong » Sat Sep 27, 2014 11:36 am

Syntax: Select all

from events import Event
from players.entity import PlayerEntity
from players.helpers import index_from_userid

@Event
def player_jump(game_event):
player = PlayerEntity(index_from_userid(game_event.get_int('userid')))
player.give_named_item('weapon_ak47', 0, True)


Code: Select all


[SP] Caught an Exception:
Traceback (most recent call last):
  File '../addons/source-python/packages/source-python/events/listener.py', line 90, in fire_game_event
    callback(game_event)
  File '../addons/source-python/plugins/test/test.py', line 8, in player_jump
    player.give_named_item('weapon_ak47', 0, True)
  File '../addons/source-python/packages/source-python/entities/entity.py', line 114, in __getattr__
    raise AttributeError('Attribute '{0}' not found'.format(attr))

AttributeError: Attribute 'give_named_item' not found


CSGO
Hedgehog
Member
Posts: 62
Joined: Sun Nov 03, 2013 8:54 pm

Postby Hedgehog » Sat Sep 27, 2014 1:37 pm

8guawong
Senior Member
Posts: 148
Joined: Sat Sep 20, 2014 3:06 am

Postby 8guawong » Sat Sep 27, 2014 3:43 pm

Hedgehog wrote:You should try to use an amazing thing called search :)
http://forums.sourcepython.com/showthread.php?146-Stripping-weapons&p=2537&viewfull=1#post2537


ok thanks
but comments like "You should try to use an amazing thing called search :) " is not really needed since its just rude :rolleyes:
User avatar
L'In20Cible
Project Leader
Posts: 1536
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Postby L'In20Cible » Sat Sep 27, 2014 4:54 pm

Why is that rude?
User avatar
satoon101
Project Leader
Posts: 2703
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Sat Sep 27, 2014 5:58 pm

Also, there is a parameter for that function on CS:GO that we do not currently support. For now, use the method L'In20Cible showed where you create/spawn the weapon and move it to the player's location.
Image

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 130 guests