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

Simple Player Teleport (GoTo)


Post New Thread Reply   
 
Thread Tools Display Modes
Author
htcarnage
Senior Member
Join Date: Oct 2009
Plugin ID:
3808
Plugin Version:
1.4.0
Plugin Category:
General Purpose
Plugin Game:
Any
Plugin Dependencies:
    Servers with this Plugin:
    37 
    Plugin Description:
    Old 08-02-2013 , 15:59   Simple Player Teleport (GoTo)
    Reply With Quote #1

    Description:
    This plugin provides a convenient way for players to teleport to one another. When a teleport request is made, a menu is displayed to the target player that will allow them to:

    Accept
    Deny
    Block the individual player
    Block ALL players
    Accept all future requests


    After a request is made, a client enters a cool down period in which they can not request any more teleports until the period has passed.

    The plugin makes use of admin overrides that will allow admins with a certain flags to bypass client authorization and bypass the cool down period. Admins are able to forcefully bring a player to them, and players can teleport themselves back to their previous location.

    As of version 1.3.6, admins with ADMFLAG_KICK authorization can ban players from making goto requests.

    How is this different from other teleport plugins?
    This plugin offers simple teleport access for non-admins, and also implements an authorization system to prevent unwanted teleports. Has translation support. Allows admins to ban players from using the plugin.

    Requirements:
    SDKTools
    A noblock plugin of your choice



    PLAYER COMMANDS:
    sm_goto <player>
    sm_unblock <player|all>
    sm_tpb
    sm_goback

    ADMIN COMMANDS:
    By default, these commands are tied to ADMFLAG_KICK.
    sm_bring <player>
    sm_goto_ban <player>
    sm_goto_unban <player>
    sm_goto_listbans



    Database Setup
    GoTo bans are stored using SQLITE.
    Add the following to addons/sourcemod/configs/databases.cfg
    Code:
    	"goto_bans"
    	{
    		"driver"			"sqlite"
    		"host"				"localhost"
    		"database"			"goto_bans"
    	}


    CVars:
    gt_cooldowntime 60.0 ||| Time between a player's use of the goto command.
    gt_target_opposite_team 1 ||| Allow clients to target players of the opposite team.
    gt_teleport_back_limit 0 ||| Prevent users from teleporting back to their saved location multiple times.

    The plugin auto-creates a config in cfg/sourcemod/goto.cfg with the above cvars for easy access.



    This plugin uses Sourcemod's built in admin override system to change command access:

    How to change command access:
    Example addons/sourcemod/configs/admin_overrides.cfg
    Code:
    Overrides
    {
        "sm_goto_cooldown_bypass"    "c"
        "sm_goto_auth_bypass"        "z"
        "sm_tpb"                ""
        "sm_goback"            ""
        "sm_bring"                ""
        "sm_goto"                ""
    }
    The above would restrict the cooldown period bypass to admins with "c" flag, and would allow admins with "z" flag to bypass authorization completely. All other commands would be available to regular players. To restrict them, simply add a flag between the quotes.


    Changelog:
    Spoiler

    Credits:
    johan123jo for helping me with the teleport authorization menu
    11530 for his advice on code cleanup

    Servers using this plugin


    766
    Attached Files
    File Type: zip Simple GoTo.zip (17.5 KB, 635 views)
    __________________

    Last edited by htcarnage; 02-14-2017 at 15:13.
    htcarnage is offline
    captaindeterprimary
    AlliedModders Donor
    Join Date: Sep 2012
    Old 08-02-2013 , 17:42   Re: Simple GoTo Command
    Reply With Quote #2

    Could be useful as a achevment server command.
    __________________
    Last edited by ; Today at 08:20 AM. Reason: Get rid of s
    captaindeterprimary is offline
    MrSkullbeef
    Junior Member
    Join Date: May 2013
    Location: Sweden
    Old 08-03-2013 , 17:24   Re: Simple GoTo Command
    Reply With Quote #3

    This is awesome.

    Any chance you could implement an option to block a user from requesting teleports to you? Preferably in the accept/deny menu as a third option.

    EDIT: Would also be great if you could add an option to teleport a user to yourself instead of only vice versa.

    Last edited by MrSkullbeef; 08-03-2013 at 17:29.
    MrSkullbeef is offline
    htcarnage
    Senior Member
    Join Date: Oct 2009
    Old 08-03-2013 , 18:35   Re: Simple GoTo Command
    Reply With Quote #4

    Sure ill work on those suggestions
    __________________
    htcarnage is offline
    htcarnage
    Senior Member
    Join Date: Oct 2009
    Old 08-03-2013 , 21:37   Re: Simple GoTo Command
    Reply With Quote #5

    Updated with MORE FEATURES!

    Check OP
    __________________
    htcarnage is offline
    htcarnage
    Senior Member
    Join Date: Oct 2009
    Old 08-04-2013 , 14:12   Re: Simple GoTo Command
    Reply With Quote #6

    1.2.0 Released. See changelog.
    1.3.0: Added teleport back commands
    __________________

    Last edited by htcarnage; 08-04-2013 at 16:57.
    htcarnage is offline
    htcarnage
    Senior Member
    Join Date: Oct 2009
    Old 08-05-2013 , 16:54   Re: Simple GoTo Command
    Reply With Quote #7

    Updated. See changelog.
    __________________
    htcarnage is offline
    11530
    Veteran Member
    Join Date: Sep 2011
    Location: Underworld
    Old 08-06-2013 , 06:38   Re: Simple GoTo Command
    Reply With Quote #8

    Looking through this plugin, there are a few things you'd need to update:
    • Remove the ConVars which define flags and code employing GetUserFlagBits etc. in favor of overrides. That is what the system is there for.
    • Your IsClientInGame check upon client disconnect should not be required and the checks for certain values are not needed either. Just set to false and 0 regardless of what the values may be. With the exception of the ClearTimer - you'd still need to check the handle is valid first, as you already do.
    • Handle RCON within your commands appropriately.
    • new numargs = GetCmdArgs(); is not needed when the args parameter already holds the same value.
    • You can simplify !(PlayerStatus[player] == DenyAll) to !=
    • Use GetConVarInt instead of GetConVarFloat for your cooldown. Anything more specific than an integer will not be used anyway.
    • A string of length 255 is not needed to hold an integer, nor should Format be used on this asker variable. Using StringToInt on a string of size 12 should be sufficient. Additionally, convert it to a UserID in case the client disconnects before the callback is fired.
    • You do not use the name variable at all in your asker callback.
    • As a minor matter of style, do not use Timer as your parameter name in ClearTimer as this is a SourceMod funcenum.
    • It'd be more efficient to store GetTime() rather than start timers for each client's cooldown.
    • In your ResetCooldown (see above) change client < MaxClients to client <= MaxClients, or preferably leave it out entirely.
    __________________
    11530 is offline
    htcarnage
    Senior Member
    Join Date: Oct 2009
    Old 08-06-2013 , 13:06   Re: Simple GoTo Command
    Reply With Quote #9

    Ok, I think I've addressed all of the above except a couple I need clarification on.

    Also, I am using the system of GetUserFlagBits as opposed to the override system because I intended the plugin to be used for regular non-admin players. However, I still want admins to be able to use the plugin a little more efficiently. The override system would effectively make the plugin admin-only, or completely open for use by all players. Using the GetUserFlagBits system I can access the middle ground where normal players can use the plugin, and admins can access it a bit more efficiently.

    For clarification on some of your suggestions, I am not sure how to implement the GetTime() over using timers for each client.

    When you recommended using StringToInt on the asker, I assume you meant IntToString?

    Thanks for the feedback by the way
    Attached Files
    File Type: sp Get Plugin or Get Source (goto.sp - 961 views - 12.5 KB)
    __________________

    Last edited by htcarnage; 08-06-2013 at 13:17.
    htcarnage is offline
    11530
    Veteran Member
    Join Date: Sep 2011
    Location: Underworld
    Old 08-06-2013 , 17:47   Re: Simple GoTo Command
    Reply With Quote #10

    You could still use the override system. Just set the general commands to public by default, and employ two overrides such as sm_goto_cooldown and sm_goto_auth which are set to ADMFLAG_KICK and ADMFLAG_ROOT respectively and the server operator can easily override that should the need arise. You'd check whether the client has the privileges necessary using CheckCommandAccess then taking the necessary steps should they have one or both of the overrides.

    As for the cooldown, a simple implementation would look like this, though personally I prefer global variables over GetConVarInts etc.

    PHP Code:
    new g_iLastUsed[MAXPLAYERS+1];

    public 
    OnClientPutInServer(client)
    {
        
    g_iLastUsed[client] = 0;
    }

    SomeFunction()
    {
        new 
    iNow GetTime(), iTimeLeft = (g_iLastUsed[client] + GetConVarInt(CooldownTime) - iNow);
        if (
    iTimeLeft 0)
        {
            
    PrintToChat(client"You must wait another %d second(s)."iTimeLeft);
            return 
    Plugin_Handled;
        }
        
    g_iLastUsed[client] = iNow;
        
    //...

    And yes, IntToString.
    __________________

    Last edited by 11530; 08-06-2013 at 17:49.
    11530 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 04:11.


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