Raised This Month: $168 Target: $400
 42% 

SourceForts - addtime and togglephase commands


Post New Thread Reply   
 
Thread Tools Display Modes
Author
MoggieX
Veteran Member
Join Date: Aug 2007
Location: n00bville
Plugin ID:
266
Plugin Version:
1.2
Plugin Category:
Admin Commands
Plugin Game:
SourceForts
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    Add some extra time and toggle phases - Removes the need to give out sm_rcon access
    Old 01-25-2008 , 10:26   SourceForts - addtime and togglephase commands
    Reply With Quote #1

    SourceForts - addtime and togglephase commands

    What does it do?
    It adds time and toggles the phase, thus ommitting the need for giving our sm_rcon access. As requested here: http://forums.alliedmods.net/showthread.php?t=66116 Noting that its UN TESTED as I don't have SourceForts!

    Current Version:
    25 Jan 08 - 1.2 - Addtime should now work
    25 Jan 08 - 1.1 - lol, no comment
    25 Jan 08 - 1.0 - First Release (untested)

    Commands:
    sm_addtime <value> - No error checking on this so coudl be a negative amount of time
    sm_togglephase - Does exactly that! No arguments required

    ConVars:
    sm_add_tog_version - Version Tracking

    How to Install
    1. Pop the compiled .SMX file in your plugins directory
    2. Change the map!

    Matt
    Attached Files
    File Type: sp Get Plugin or Get Source (sm_addtime.sp - 1239 views - 3.6 KB)
    File Type: smx sm_addtime.smx (2.0 KB, 339 views)
    __________________

    Last edited by MoggieX; 01-25-2008 at 11:41.
    MoggieX is offline
    Send a message via Skype™ to MoggieX
    FuzionMonkey
    Junior Member
    Join Date: Jul 2004
    Old 01-25-2008 , 11:07   Re: SourceForts - addtime and togglephase commands
    Reply With Quote #2

    Thank you so much!

    I just tested it and sm_togglephase works perfectly. I tried sm_addtime 1000 but nothing happened. Its not working no matter what number I try to put in.

    Also, don't bother to make it so you can't put in negative numbers, since sometimes that is useful to lower the phase time.
    __________________

    Last edited by FuzionMonkey; 01-25-2008 at 11:09.
    FuzionMonkey is offline
    bl4nk
    SourceMod Developer
    Join Date: Jul 2007
    Old 01-25-2008 , 11:07   Re: SourceForts - addtime and togglephase commands
    Reply With Quote #3

    Some things I noticed were wrong with your plugin.

    1. Line 77: if (args < 1) should be if (args > 0).
    2. If there is only one arg, you can use GetCmdArgString(); Nevermind, you want the first arg, and only the first arg in this case.
    3. Line 87: if (StringToIntEx(arg1, amount) < 0) look at the return for StringToIntEx(); -- it's not what you want right here.
    Try the following code instead:
    Code:
    new amount = StringToInt(arg1);
    if (amount < 0)
    4. You have the check on Line 87 for if the amount is < 0 and it returns Plugin_Handled in that section. That means the check on lines 93-96 are useless. There will never be a positive answer to that if statement.
    5. Line 105: ServerCommand("%s", arg1); should be ServerCommand("addtime %i", amount);
    6. You should probably use LogMessage(); instead of LogAction(); in the two cases you use it.

    Last edited by bl4nk; 01-25-2008 at 11:16.
    bl4nk is offline
    MoggieX
    Veteran Member
    Join Date: Aug 2007
    Location: n00bville
    Old 01-25-2008 , 11:21   Re: SourceForts - addtime and togglephase commands
    Reply With Quote #4

    Yes, wrong version, as that was using a copy of the cahs plugin.

    This time its removed and should work.

    LogAction() was taken from the base sm_rcon function in SM, so seemed most fitting...

    Matt
    __________________
    MoggieX is offline
    Send a message via Skype™ to MoggieX
    bl4nk
    SourceMod Developer
    Join Date: Jul 2007
    Old 01-25-2008 , 11:27   Re: SourceForts - addtime and togglephase commands
    Reply With Quote #5

    The addtime command still won't work. Look at #5 in my first post.
    bl4nk is offline
    MoggieX
    Veteran Member
    Join Date: Aug 2007
    Location: n00bville
    Old 01-25-2008 , 11:44   Re: SourceForts - addtime and togglephase commands
    Reply With Quote #6

    Quote:
    Originally Posted by bl4nk View Post
    The addtime command still won't work. Look at #5 in my first post.
    Thanks, updated.

    BTW while you're checking over my coding, feel free to take a run through:
    http://forums.alliedmods.net/showthread.php?t=65822
    and
    http://forums.alliedmods.net/showthread.php?t=66055 (although I know the returned message is rubish atm in this one)

    Matt
    __________________
    MoggieX is offline
    Send a message via Skype™ to MoggieX
    FuzionMonkey
    Junior Member
    Join Date: Jul 2004
    Old 01-25-2008 , 13:07   Re: SourceForts - addtime and togglephase commands
    Reply With Quote #7

    Alright, cool. Everything is working, thanks.
    __________________
    FuzionMonkey is offline
    pRED*
    Join Date: Dec 2006
    Old 02-20-2008 , 18:11   Re: SourceForts - addtime and togglephase commands
    Reply With Quote #8

    Nice work MoggieX. Lot of useful plugins coming from you, keep it up.

    Approved.
    pRED* is offline
    Reply


    Thread Tools
    Display Modes

    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 02:24.


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