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

[EXTENSION] TeleportCheck 1.0


Post New Thread Reply   
 
Thread Tools Display Modes
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 11-02-2012 , 21:36   Re: [EXTENSION] TeleportCheck 1.0
Reply With Quote #21

Quote:
Originally Posted by snelvuur View Post
On the first page there is a plugin called scoutsdontteleport. Referring to that part.
Your best bet would be to port it to SM 1.5's forward and switch.
__________________
asherkin is offline
Dr. McKay
Sir Dr. SourceMod Plugin Approver Esq. Ltd. M.D. PhD
Join Date: Aug 2011
Location: Atlantis
Old 11-03-2012 , 00:58   Re: [EXTENSION] TeleportCheck 1.0
Reply With Quote #22

Yeah, this extension is now redundant because it's built into SourceMod 1.5 (and it's better). I've attached a version of the plugin in the OP that ought to work.
Attached Files
File Type: sp Get Plugin or Get Source (scoutdontteleport.sp - 219 views - 706 Bytes)
__________________
Dr. McKay is offline
snelvuur
Veteran Member
Join Date: Jun 2008
Location: Netherlands
Old 11-03-2012 , 05:23   Re: [EXTENSION] TeleportCheck 1.0
Reply With Quote #23

Thanks McKay
__________________
Arguing with a fool only proves there are two
snelvuur is offline
snelvuur
Veteran Member
Join Date: Jun 2008
Location: Netherlands
Old 11-04-2012 , 09:23   Re: [EXTENSION] TeleportCheck 1.0
Reply With Quote #24

So since scouts are just going "hmm why cant i teleport?" i added

PrintHintText(client, "Scouts cannot use teleports, go run and be usefull");

But this would just trigger non-stop, which is not so nice. Whats the best way to make it only trigger once?
__________________
Arguing with a fool only proves there are two
snelvuur is offline
Dr. McKay
Sir Dr. SourceMod Plugin Approver Esq. Ltd. M.D. PhD
Join Date: Aug 2011
Location: Atlantis
Old 11-04-2012 , 10:44   Re: [EXTENSION] TeleportCheck 1.0
Reply With Quote #25

Quote:
Originally Posted by snelvuur View Post
So since scouts are just going "hmm why cant i teleport?" i added

PrintHintText(client, "Scouts cannot use teleports, go run and be usefull");

But this would just trigger non-stop, which is not so nice. Whats the best way to make it only trigger once?
Create a global array of size MAXPLAYERS + 1 and store the time when you call PrintHintText using GetTime. Then on subsequent calls to the forward, check if GetTime() - myArrayHere[client] <= 5, and if it is, don't do anything.
__________________
Dr. McKay is offline
snelvuur
Veteran Member
Join Date: Jun 2008
Location: Netherlands
Old 11-04-2012 , 14:03   Re: [EXTENSION] TeleportCheck 1.0
Reply With Quote #26

And there i thought i could just do a "wait(10)" or something. I'll look into it if i find some time, its a good learn for me.
__________________
Arguing with a fool only proves there are two
snelvuur is offline
Dr. McKay
Sir Dr. SourceMod Plugin Approver Esq. Ltd. M.D. PhD
Join Date: Aug 2011
Location: Atlantis
Old 11-04-2012 , 15:03   Re: [EXTENSION] TeleportCheck 1.0
Reply With Quote #27

This ought to work, take a look at it for learning:

PHP Code:
#include <sourcemod>
#include <tf2>
#include <tf2_stocks>

new Handle:g_hCvarEnabled;
new 
g_iMsgTime[MAXPLAYERS 1];

public 
Plugin:myinfo 
{
    
name "Scouts Can't Teleport",
    
author "Afronanny + Dr. McKay",
    
description "Scouts cannot take teleporters",
    
version "1.0",
    
url "http://www.afronanny.org/"
}

public 
OnPluginStart()
{
    
CreateConVar("sm_teleportcheck_version""1.0"_FCVAR_NOTIFY);
    
g_hCvarEnabled CreateConVar("sm_teleportcheck_enabled""1");
}

public 
Action:TF2_OnPlayerTeleport(clientteleporter, &bool:result)
{
    if (
TF2_GetPlayerClass(client) == TFClass_Scout && GetConVarBool(g_hCvarEnabled))
    {
        if((
GetTime() - g_iMsgTime[client]) > 5) {
            
g_iMsgTime[client] = GetTime();
            
PrintHintText(client"Scouts cannot use teleports.\nGo run and be useful.");
        }
        
result false;
        return 
Plugin_Changed;
    } else {
        return 
Plugin_Continue;
    }

__________________
Dr. McKay is offline
snelvuur
Veteran Member
Join Date: Jun 2008
Location: Netherlands
Old 11-04-2012 , 15:05   Re: [EXTENSION] TeleportCheck 1.0
Reply With Quote #28

The result looks easier then i thought, basicly you just store the time for the client and match that with the next action. Thanks for the lesson, i'll go try it out.
__________________
Arguing with a fool only proves there are two
snelvuur is offline
CuriousG
Senior Member
Join Date: Feb 2012
Old 11-04-2012 , 16:14   Re: [EXTENSION] TeleportCheck 1.0
Reply With Quote #29

Quote:
Originally Posted by snelvuur View Post
The result looks easier then i thought, basicly you just store the time for the client and match that with the next action. Thanks for the lesson, i'll go try it out.
And he even fixed your spelling mistake.
CuriousG is offline
AjudanteBR
Junior Member
Join Date: Jan 2013
Old 06-09-2013 , 11:59   Re: [EXTENSION] TeleportCheck 1.0
Reply With Quote #30

This plugin works on the "left 4 dead 2"?
AjudanteBR 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 12:45.


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