Raised This Month: $32 Target: $400
 8% 

[CSS] TeamCommands 2.0


Post New Thread Reply   
 
Thread Tools Display Modes
Author
RaT3D
Junior Member
Join Date: Jan 2014
Plugin ID:
4094
Plugin Version:
2.0
Plugin Category:
General Purpose
Plugin Game:
Counter-Strike: Source
Plugin Dependencies:
    Servers with this Plugin:
    2 
    Plugin Description:
    A simple plugin which lets a client join / change teams by typing a command in chat.
    Old 02-11-2014 , 17:07   [CSS] TeamCommands 2.0
    Reply With Quote #1


    Description:
    TeamCommands is a simple plugin which lets a client join / change teams by typing a command in chat. I originally created the plugin under the name NineTyNine, I called it QuickJoin. But I've decided to update the name, and I've changed a bit in the coding.

    Commands:
    There's quite a few commands to choose between.
    Spectator Mode / AFK:
    • !spec
    • !spectate
    • !away
    • !afk

    Counter-Terrorist
    • !ct
    • !counterterrorist

    Terrorist
    • !t
    • !terrorist


    ConVars:
    There's one ConVar, which shows the version of the plugin.
    • sm_qj_version


    This plugin is similar to:
    - https://forums.alliedmods.net/showthread.php?p=1130434
    But this one works for CSS. Thanks for the inspiration!
    Attached Files
    File Type: sp Get Plugin or Get Source (teamcommands.sp - 1270 views - 2.0 KB)
    RaT3D is offline
    Drixevel
    AlliedModders Donor
    Join Date: Sep 2009
    Location: Somewhere headbangin'
    Old 02-12-2014 , 01:48   Re: [CSS] TeamCommands 2.0
    Reply With Quote #2

    Looks good! Only thing I would recommend you do is check if the client is valid, alive, etc when they use the commands.
    Drixevel is offline
    RaT3D
    Junior Member
    Join Date: Jan 2014
    Old 02-12-2014 , 08:15   Re: [CSS] TeamCommands 2.0
    Reply With Quote #3

    Quote:
    Originally Posted by r3dw3r3w0lf View Post
    Looks good! Only thing I would recommend you do is check if the client is valid, alive, etc when they use the commands.
    But the client do not have to be alive to change team?
    RaT3D is offline
    TnTSCS
    AlliedModders Donor
    Join Date: Oct 2010
    Location: Undisclosed...
    Old 02-12-2014 , 11:33   Re: [CSS] TeamCommands 2.0
    Reply With Quote #4

    He was throwing things out there that you should consider...

    if the command "sm_ct" is issued by a console user (someone from HLSW for example), then the following error would be thrown:
    Code:
    L 02/12/2014 - 08:23:27: Info (map "de_dust2_only_b") (file "errors_20140212.log")
    L 02/12/2014 - 08:23:27: [SM] Native "ClientCommand" reported: Client index 0 is invalid
    L 02/12/2014 - 08:23:27: [SM] Displaying call stack trace for plugin "teamcommands.smx":
    L 02/12/2014 - 08:23:27: [SM]   [0]  Line 49, /home/groups/alliedmodders/forums/files/2/4/4/4/7/0/130517.attach::TCTurnClientToCounterTerrorist()
    Using something like this should help:
    PHP Code:
    YourCommandCallback(clientargs)
    {
        if (!
    IsValidPlayer(client))
        {
            return 
    Plugin_Handled;
        }
        
        
    // Rest of your code here
    }

    bool:IsValidPlayer(client)
    {
        if (!(
    <= client <= MaxClients) || !IsClientConnected(client))
        {
            return 
    false;
        }
        
        return 
    IsClientInGame(client);

    Also, you have semicolons on all but 1 line - using #pragma semicolon 1 might be a good idea to help you a tad
    __________________
    View my Plugins | Donate
    TnTSCS 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:07.


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