Search found 1256 matches

by L'In20Cible
Sun Oct 05, 2014 8:26 am
Forum: Plugin Development Support
Topic: playeriter to count the number or pending team change
Replies: 5
Views: 4731

Syntax: Select all

for player in get_players_in_or_pending_team(2):
print(player.name, 'is terrorist!')

Syntax: Select all

print('There is', len(set(get_players_in_or_pending_team(3))),
'counter-terrorists!')
by L'In20Cible
Sun Oct 05, 2014 7:35 am
Forum: Plugin Development Support
Topic: playeriter to count the number or pending team change
Replies: 5
Views: 4731

I don't think adding that to PlayerIter is a good idea cause well, while it is pending, you are "still" in your current team... Also, you can always check that yourself. from filters.players import PlayerIter from players.entity import PlayerEntity def get_players_in_or_pending_team(te...
by L'In20Cible
Sun Oct 05, 2014 6:32 am
Forum: Plugin Development Support
Topic: How to emit sound??
Replies: 22
Views: 19237

Alright so, I just spent few hours trying all and everything and found out that any sound which is not in the ../sound/music/ folder is just ignored by the clients...

For those interested, here is my test script.
by L'In20Cible
Sun Oct 05, 2014 5:04 am
Forum: Plugin Development Support
Topic: can't put script with stringtable in autoexec.cfg
Replies: 3
Views: 3556

Fixed. This was happening cause there is no "downloadables" table when there is no map running on the server. Adding a simple check that the table is valid when adding a file to it should be sufficient enough to fix the issue since it will still be called any time soon by the "server_spawn" event.
by L'In20Cible
Sun Oct 05, 2014 4:55 am
Forum: Plugin Development Support
Topic: changing teams
Replies: 3
Views: 3777

They are all the same except for PlayerEntity.switch_team. If you look at the code , you will see that, PlayerEntity.get_team is wrapping PlayerInfo.get_team_index, PlayerEntity.set_team is wrapping PlayerInfo.change_team and that PlayerEntity.team is just a shortcut property that wraps both wrapper...
by L'In20Cible
Sun Oct 05, 2014 1:09 am
Forum: Plugin Development Support
Topic: Why doesn't this work?
Replies: 5
Views: 4935

Well, I didn't reply either since the last time I had read this thread, he was saying it was working. :rolleyes:
by L'In20Cible
Sat Oct 04, 2014 9:08 pm
Forum: Plugin Development Support
Topic: PlayerEntity Attributes (Cash)
Replies: 14
Views: 10608

You are right. I was able to reproduce it and found out why this is happening. Open the file ../addons/source-python/packages/entities/entity.py and at line 228, replace the following lines: # Is the attribute a type description for this entity? if attr in self.datamaps: With the following ones: # I...
by L'In20Cible
Sat Oct 04, 2014 8:15 pm
Forum: Plugin Development Support
Topic: PlayerEntity Attributes (Cash)
Replies: 14
Views: 10608

from events import Event from players.entity import PlayerEntity from players.helpers import index_from_userid _cache = {} class MyPlayerEntity(PlayerEntity): def __new__(cls, userid): index = index_from_userid(userid) if not index: raise ValueError('Invalid userid &...
by L'In20Cible
Sat Oct 04, 2014 7:30 pm
Forum: Plugin Development Support
Topic: PlayerEntity Attributes (Cash)
Replies: 14
Views: 10608

Predz wrote:Didn't realize PlayerEntity needs to be called to update all the attributes again.
False! The value is always retrieved at the time __getattr__ is called. The problem is somewhere else in your code.
by L'In20Cible
Sat Oct 04, 2014 5:30 pm
Forum: Plugin Development Support
Topic: PlayerEntity Attributes (Cash)
Replies: 14
Views: 10608

L'In20Cible wrote:Please, always provide your entire code (including the imports, the classes, etc.) and the content of all related files.

10 characters bleh
by L'In20Cible
Fri Oct 03, 2014 6:34 am
Forum: Plugin Development Support
Topic: Hiding/silent say trigger
Replies: 2
Views: 3215

You are right, it is not like ES since we give you the choice directly in your callback. from commands import CommandReturn from commands.say import SayCommand # Usage: # @SayCommand(<(str or list) names>, [str level], [str permission], [str flag], [callable fail_callback]) # A singl...
by L'In20Cible
Wed Oct 01, 2014 5:16 pm
Forum: General Discussion
Topic: SP logs locations
Replies: 10
Views: 8549

This warning is not from a script/plugin but from SP itself. It tells you the signature for that function is outdated since the pointer is NULL.
by L'In20Cible
Wed Oct 01, 2014 1:36 am
Forum: Plugin Development Support
Topic: "Team is full" message
Replies: 8
Views: 7894

Well, I mean that I have no clue why this variable is not working.
by L'In20Cible
Tue Sep 30, 2014 9:30 pm
Forum: Plugin Development Support
Topic: "Team is full" message
Replies: 8
Views: 7894

Then I have no clue.. This showed up as a valid ConVar when I launched my test server earlier. Maybe some game-mode specific config?
by L'In20Cible
Tue Sep 30, 2014 5:06 pm
Forum: Plugin Development Support
Topic: "Team is full" message
Replies: 8
Views: 7894

Code: Select all

mp_limitteams 0
by L'In20Cible
Mon Sep 29, 2014 7:08 pm
Forum: Plugin Development Support
Topic: getting index from playeriter
Replies: 6
Views: 5410

Maybe, I guess xD
by L'In20Cible
Mon Sep 29, 2014 7:02 pm
Forum: Plugin Development Support
Topic: getting index from playeriter
Replies: 6
Views: 5410

He means, when iterating over a PlayerIter object, player indexes are the default returned values unless otherwise specified on instantiation.
by L'In20Cible
Mon Sep 29, 2014 3:00 pm
Forum: Code examples / Cookbook
Topic: Stripping weapons
Replies: 45
Views: 113916

Probably different games.
by L'In20Cible
Mon Sep 29, 2014 1:14 pm
Forum: Code examples / Cookbook
Topic: Stripping weapons
Replies: 45
Views: 113916

Signature is outdated.

Code: Select all

Unable to add attribute 'drop_weapon'of type 'functions' to entity type 'player'
due to the following:
Could not find signature.
by L'In20Cible
Mon Sep 29, 2014 11:13 am
Forum: Plugin Development Support
Topic: getting index from playeriter
Replies: 6
Views: 5410

Yes, casting the object to a list will works since it will iterate over the generator to build its sequence. Since we recently added __len__, I guess we could add indexing/slicing to the _IterObject class but this means it will iterate over the entire generator every time. A good practice will still...

Go to advanced search