Raised This Month: $51 Target: $400
 12% 

SourceBans 2.0 Alpha (2013/09/04)


Post New Thread Reply   
 
Thread Tools Display Modes
DJ Tsunami
DJ Post Spammer
Join Date: Feb 2008
Location: The Netherlands
Old 10-20-2013 , 16:55   Re: SourceBans 2.0 Alpha (2013/09/04)
Reply With Quote #221

1) I've already linked you to the documentation, which has some examples, so I'll just link you to the SBAdmin page. Under Public Properties you can see there's an immunity property, which you can access like this:
PHP Code:
// Find by primary key, which for most models is the ID
$admin SBAdmin::model()->findByPk(1);

echo 
$admin->immunity
immunity is actually a magic property, which calls the getImmunity method. If you click show next to Source Code, you can see that it returns the highest immunity level of their groups, or 0 if they don't have any groups.

2) sb_server_groups_immunity is the same as SourceMod's sm_group_immunity table. It defines which groups are immune from other groups. The page to configure this hasn't been built yet though.

3) If I understand you correctly, you want to retrieve a ban, including the admin and their immunity.
PHP Code:
// Find using condition and parameters. Since the admin model also has a "name" attribute,
// we specify the table alias for the main model, which by default is "t".
$ban SBBan::model()->with('admin')->find('t.name = :ban_name', array(':ban_name' => 'ppalex'));

// If $ban->admin is null, it's a CONSOLE ban
if(isset($ban->admin))
{
  echo 
$ban->admin->immunity;

Note that ->with() applies eager loading, joining the sb_admins table to be able to filter on that too in your condition string. Lazy loading also works:
PHP Code:
// Find by attributes. This only works for attributes of the main model,
// so specifying a table alias would throw an error.
$ban SBBan::model()->findByAttributes(array('name' => 'ppalex'));

echo 
$ban->admin->name
But of course it would run two queries.

I'll see if I can post some more examples this week.
__________________
Advertisements | REST in Pawn - HTTP client for JSON REST APIs
Please do not PM me with questions. Post in the plugin thread.
DJ Tsunami is offline
ppalex
Senior Member
Join Date: Nov 2012
Location: Russia, near the Moscow
Old 10-20-2013 , 17:19   Re: SourceBans 2.0 Alpha (2013/09/04)
Reply With Quote #222

Thanks for the detailed answer!

Quote:
immunity is actually a magic property, ... it returns the highest immunity level of their groups, or 0 if they don't have any groups.
This is that I need!

I had to understand on what basis is determined immunity to use it in my plugin. If interested in SQL it looks for me like
Spoiler
looks terrible, but works good.
__________________
ppalex is offline
Automicbomb
AlliedModders Donor
Join Date: Nov 2012
Old 10-23-2013 , 07:19   Re: SourceBans 2.0 Alpha (2013/09/04)
Reply With Quote #223

Hi. So i installed this to my webserver and to my gameserver (TF2) but when i add web ban, it wont kick the client from server. Is this issue only on my end or is this option still getting wrote?
Automicbomb is offline
Rytis
Veteran Member
Join Date: Feb 2012
Location: Germany
Old 10-23-2013 , 10:53   Re: SourceBans 2.0 Alpha (2013/09/04)
Reply With Quote #224

Quote:
Originally Posted by Automicbomb View Post
Hi. So i installed this to my webserver and to my gameserver (TF2) but when i add web ban, it wont kick the client from server. Is this issue only on my end or is this option still getting wrote?
It's not really an issue, it's just not implemented yet
Rytis is offline
ppalex
Senior Member
Join Date: Nov 2012
Location: Russia, near the Moscow
Old 10-28-2013 , 15:09   Re: SourceBans 2.0 Alpha (2013/09/04)
Reply With Quote #225

What mean symbols @@ around phrases @@ in translations files?
__________________
ppalex is offline
DJ Tsunami
DJ Post Spammer
Join Date: Feb 2008
Location: The Netherlands
Old 10-29-2013 , 13:08   Re: SourceBans 2.0 Alpha (2013/09/04)
Reply With Quote #226

It's explained at the top of the file.
__________________
Advertisements | REST in Pawn - HTTP client for JSON REST APIs
Please do not PM me with questions. Post in the plugin thread.
DJ Tsunami is offline
ppalex
Senior Member
Join Date: Nov 2012
Location: Russia, near the Moscow
Old 10-29-2013 , 14:38   Re: SourceBans 2.0 Alpha (2013/09/04)
Reply With Quote #227

Quote:
Originally Posted by DJ Tsunami View Post
It's explained at the top of the file.
oh, thanks.
And what i need to think about it, if i see some phrases as "@@phrase@@" on the web pages? Need I remake translation files by running 'yiic message' command?
__________________

Last edited by ppalex; 10-29-2013 at 14:38.
ppalex is offline
ppalex
Senior Member
Join Date: Nov 2012
Location: Russia, near the Moscow
Old 10-29-2013 , 15:00   Re: SourceBans 2.0 Alpha (2013/09/04)
Reply With Quote #228

for example, even after I ran ./framework/yiic message application/messages/application.php
i have problems with some phrases (look at screenshot). In the same time i have some changes in translations file (part of diff)
Code:
-       'Bans' => 'Баны',
+  'Bans' => '@@Баны@@',
   'By' => '@@От@@',
   'Change' => 'Изменить',
   'Click' => '@@Нажать@@',
+  'Close' => '',
   'Command' => 'Команда',
   'Command executed' => 'Команда выполнена',
   'Comment' => '@@Комментарий@@',
   'Comments' => '@@Комментарии@@',
   'Confirm' => '@@Подтвердить@@',
   'Confirm RCON password' => '@@Подтвердите пароль RCON@@',
-       'Players blocked' => 'Заблокировано игроков',
   'Contact' => '@@Связаться@@',
What's wrong?

Should I manually fix this mistakes and make a pull-request?
Attached Thumbnails
Click image for larger version

Name:	?????? ?????? 2013-10-29 ? 22.57.36.png
Views:	140
Size:	35.4 KB
ID:	127233  
__________________

Last edited by ppalex; 10-29-2013 at 16:37.
ppalex is offline
DJ Tsunami
DJ Post Spammer
Join Date: Feb 2008
Location: The Netherlands
Old 10-29-2013 , 17:00   Re: SourceBans 2.0 Alpha (2013/09/04)
Reply With Quote #229

When you see @@ on web pages and the translation between them is correct, you can just remove the @@ and make a pull request. yiic message only adds the @@ when the message is not used anymore, it does not remove them when the message is used again.

You can see this with
Code:
    'Comments' => '@@Комментарии@@',
Comments were implemented recently, and it looks like I forgot to remove the @@ for Czech and Russian.
__________________
Advertisements | REST in Pawn - HTTP client for JSON REST APIs
Please do not PM me with questions. Post in the plugin thread.
DJ Tsunami is offline
ppalex
Senior Member
Join Date: Nov 2012
Location: Russia, near the Moscow
Old 10-30-2013 , 00:57   Re: SourceBans 2.0 Alpha (2013/09/04)
Reply With Quote #230

Quote:
Originally Posted by DJ Tsunami View Post
yiic message only adds the @@ when the message is not used anymore, it does not remove them when the message is used again.
Thanks for the explanation.
__________________
ppalex is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 23:34.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode