Raised This Month: $ Target: $400
 0% 

Restrict a player from a team for X amount of time (or permanent)?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
terry0412x
Member
Join Date: Feb 2007
Old 08-28-2009 , 04:05   Restrict a player from a team for X amount of time (or permanent)?
Reply With Quote #1

Restricting a player from a team for X amount of time, or permanenly, by sourcemod. Is it possible? Also, will it be possible to have it write in mysql, so I can run it off a site? (Pretty much, a little like sm_ban but for teams, and global bans.)

I just want to know if it possible, and if you can, please help me out. Please tell me some parts of what I need in the script, and the includes, etc.

Last edited by terry0412x; 08-28-2009 at 04:44.
terry0412x is offline
Timiditas
Senior Member
Join Date: Apr 2009
Old 08-28-2009 , 15:54   Re: Restrict a player from a team for X amount of time (or permanent)?
Reply With Quote #2

Thats possible.
For getting the basics done, I'd say you just PRE-hook the event "player_team".

Look up your DB if he is allowed into it and then return plugin_continue - or return plugin_handled if he is not allowed to.

I'd say the most tedious part of this would be to create a menu for it.

Hook your plugin into the admin menu, into player commands.
Add a menu item like "restrict team change" with current player selection. Add another menu that gets called when you select a player.
While you create it, you check the DB for allowed teams for that steamID, and write the menuitems according to the stored information (or can join all if not present in DB). Like this

Player "]Notorious[Hostagekiller"
Terrorists - Restricted
Counterterrorists - Allowed
Spectators - Allowed

Now when you select an item, just flip its variable in the DB and close the menu.

The only includes you would need are
#include <sourcemod>
#include <sdktools>

On plugin load, you'd also need to check if the database contains your table and, if it doesn't, create it.

Take a look at this plugin for a simple case of storing SteamIDs along various bit of custom data into a database.
__________________


Last edited by Timiditas; 08-28-2009 at 15:57.
Timiditas is offline
terry0412x
Member
Join Date: Feb 2007
Old 08-29-2009 , 00:45   Re: Restrict a player from a team for X amount of time (or permanent)?
Reply With Quote #3

Hmm I might need some more help. Who wants to help me? D: By steam, aim, msn, etc.
terry0412x is offline
Kigen
BANNED
Join Date: Feb 2008
Old 08-30-2009 , 04:00   Re: Restrict a player from a team for X amount of time (or permanent)?
Reply With Quote #4

RegConsoleCmd("jointeam", Cmd_Jointeam);

If you do it there it is full of win, rather than hooking player_team which is full of loss.
Kigen is offline
busy.orange
Member
Join Date: May 2009
Old 08-30-2009 , 05:23   Re: Restrict a player from a team for X amount of time (or permanent)?
Reply With Quote #5

Kigen
but for TF2 it's doesn't works =(
busy.orange is offline
Timiditas
Senior Member
Join Date: Apr 2009
Old 08-30-2009 , 05:26   Re: Restrict a player from a team for X amount of time (or permanent)?
Reply With Quote #6

Quote:
Originally Posted by Kigen View Post
RegConsoleCmd("jointeam", Cmd_Jointeam);

If you do it there it is full of win, rather than hooking player_team which is full of loss.
White man is talking with riddled tongue.
__________________

Timiditas is offline
terry0412x
Member
Join Date: Feb 2007
Old 08-30-2009 , 19:20   Re: Restrict a player from a team for X amount of time (or permanent)?
Reply With Quote #7

Thanks kigen. I don't really have a problem with that. The problem I have is with sourcepawn. I don't get sourcepawn too much D:

Edit: Ok I got a bit of a problem. Take a look at this:

Code:
public Action:cmd_JoinTeam(client, args)
{
    if (g_aPlayers[client][args] == 3)
    {
        PrintToChat(client,"You are restricted from joining that team");
        return Plugin_Handled;
    }
    return Plugin_Continue;
}
If I type jointeam 3 or try to go ct, it lets me. I'm guessing it has to do with Plugin_Continue? I'm not too sure.

Last edited by terry0412x; 08-30-2009 at 21:49.
terry0412x is offline
Kigen
BANNED
Join Date: Feb 2008
Old 08-31-2009 , 04:14   Re: Restrict a player from a team for X amount of time (or permanent)?
Reply With Quote #8

Well, args is just a counter for how many arguments you have, it isn't the team they're trying to join. lol

Code:
if ( args != 1 )
     return Plugin_Handled;
new String:cmd[15], team; // Should only be one.
GetCmdArg(1, cmd, sizeof(cmd));
team = StringToInt(cmd);
Kigen is offline
terry0412x
Member
Join Date: Feb 2007
Old 08-31-2009 , 04:21   Re: Restrict a player from a team for X amount of time (or permanent)?
Reply With Quote #9

Wow thanks kigen. It's good to know you're helping. .

Last edited by terry0412x; 08-31-2009 at 04:23.
terry0412x is offline
terry0412x
Member
Join Date: Feb 2007
Old 09-03-2009 , 15:20   Re: Restrict a player from a team for X amount of time (or permanent)?
Reply With Quote #10

Wow Timiditas thanks for the support. To even tell me your steam user for addition help means a lot to me . Thanks.
terry0412x 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 18:40.


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