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

[SOLVED][CS:GO]TeleportEntity does not Work


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DitaSoft
Junior Member
Join Date: Aug 2014
Location: Germany
Old 08-04-2014 , 14:12   [SOLVED][CS:GO]TeleportEntity does not Work
Reply With Quote #1

Hi all

I wrote this script today and it compiles without Errors but InGame the teleport wont work.
Im new to SourcePawn and searched for Solutions but couldent find anything.

I hope you Guy can help me

PHP Code:
if(StrEqual(cname,KotH))
  {
   
GetEntPropVector(clientProp_Send"m_vecOrigin"ClientPos);
    
vDis GetVectorDistance(KingPosClientPos);
   
   if(
vDis 1000)
   {
   
TeleportEntity(clientKingPosNULL_VECTORNULL_VECTOR);
   
PrintToChat(client,"---You were teleported back to your Hill!---");
   return 
Plugin_Continue;
   }
  } 
The whole code:

PHP Code:

#include sourcemod
#include sdktools

 
new String:KotH[32];
new 
Float:ClientPos[3];
new 
Float:KingPos[3];
new 
Float:vDis;
public 
OnPluginStart()
{   

 
PrintToChatAll("-----------");
 
HookEvent("round_start"start);
 
HookEvent("gg_killed_enemy",killed_enemy );
 
HookEvent("player_footstep",player_move); 
}

 
public 
Action:start(Handle:event, const String:name[], bool:dontBroadcast)
{
 
ServerCommand("mp_teammates_are_enemies 1");
 
ServerCommand("mp_buy_allow_grenades 1");
}

 
public 
Action:killed_enemy(Handle:event, const String:name[], bool:dontBroadcast)
{
  new 
clientID GetEventInt(event,"attackerid");
  new 
attacker GetClientOfUserId(clientID);
  
  new 
clientID2 GetEventInt(event"victimid");
  new 
victim GetClientOfUserId(clientID2);
  
  new 
String:aname[32], String:vname[32];
  
GetClientName(attackeraname32);
  
GetClientName(victimvname32);
  
  if(
StrEqual(anameKotH))
  {
   
PrintToChatAll("--- \x06%s \x01got owned by \x07KING %s \x01---"vnameaname);
   return 
Plugin_Continue;
  }
  
  else if(
StrEqual(vnameKotH) ||StrEqual(KotH""))
  {
   
KotH aname;
   
PrintToChatAll("--- \x07%s \x01is now \x07KING \x01---"aname);
   
GetEntPropVector(attackerProp_Send"m_vecOrigin"KingPos);
   return 
Plugin_Continue;
  }
   else 
   {
   
PrintToChat(attacker"---You killed some random Guy! Go and find \x07KING %s---"KotH);
   return 
Plugin_Continue;
   }
}
public 
Action:player_move(Handle:event ,const String:name[], bool:dontBroadcast)
{  
  new 
clientID GetEventInt(event,"userid");
  new 
client GetClientOfUserId(clientID);
  
  new 
String:cname[32];
  
GetClientName(clientcname32);
  
  
  if(
StrEqual(cname,KotH))
  {
   
GetEntPropVector(clientProp_Send"m_vecOrigin"ClientPos);
    

   
vDis GetVectorDistance(KingPosClientPos);
   
   if(
vDis 1000)
   {
   
TeleportEntity(clientKingPosNULL_VECTORNULL_VECTOR);
   
PrintToChat(client,"---You were teleported back to your Hill!---");
   return 
Plugin_Continue;
   }
  }
  return 
Plugin_Continue;

DitaSoft
DitaSoft is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 08-04-2014 , 14:42   Re: [CS:GO]TeleportEntity does not Work
Reply With Quote #2

vDis should be a float and compared to another float:
Code:
if(vDis > 1000.0)
Mitchell is offline
DitaSoft
Junior Member
Join Date: Aug 2014
Location: Germany
Old 08-04-2014 , 14:50   Re: [CS:GO]TeleportEntity does not Work
Reply With Quote #3

thanks but thats not the Problem. if the vDis > 1000 it still Prints the msg but does not teleport.
DitaSoft is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 08-04-2014 , 15:10   Re: [CS:GO]TeleportEntity does not Work
Reply With Quote #4

weird, have you tried printing the position out?
KingPos[0], 1, 2.
Also, sm version?

Last edited by Mitchell; 08-04-2014 at 15:10.
Mitchell is offline
DitaSoft
Junior Member
Join Date: Aug 2014
Location: Germany
Old 08-04-2014 , 15:15   Re: [CS:GO]TeleportEntity does not Work
Reply With Quote #5

No i didnt try that but i will.
if type meta list in the Server console it says 1.6.0

Last edited by DitaSoft; 08-04-2014 at 15:15.
DitaSoft is offline
DitaSoft
Junior Member
Join Date: Aug 2014
Location: Germany
Old 08-04-2014 , 15:23   Re: [CS:GO]TeleportEntity does not Work
Reply With Quote #6

i printed the Positions

PHP Code:
 
if(vDis 1000.0)
   {
   
TeleportEntity(clientKingPosNULL_VECTORNULL_VECTOR);
   
PrintToChat(client,"- %f - %f - %f -"KingPos[0],KingPos[1],KingPos[2]);
   return 
Plugin_Continue;
   } 
and InGame it printed the values no Problems
DitaSoft is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 08-04-2014 , 15:24   Re: [CS:GO]TeleportEntity does not Work
Reply With Quote #7

I'd also make sure:
Code:
   PrintToChatAll("--- \x07%s \x01is now \x07KING \x01---", aname);
   GetEntPropVector(attacker, Prop_Send, "m_vecOrigin", KingPos);
is firing too before the teleport happens

edit:
so, why not try something like this:
PHP Code:
   ClientPos[2] += 16.0//so you can tell if the player is being teleported.
   
TeleportEntity(clientClientPosNULL_VECTORNULL_VECTOR); 

Last edited by Mitchell; 08-04-2014 at 15:25.
Mitchell is offline
DitaSoft
Junior Member
Join Date: Aug 2014
Location: Germany
Old 08-04-2014 , 15:24   Re: [CS:GO]TeleportEntity does not Work
Reply With Quote #8

Quote:
Originally Posted by Mitchell View Post
I'd also make sure:
Code:
   PrintToChatAll("--- \x07%s \x01is now \x07KING \x01---", aname);
   GetEntPropVector(attacker, Prop_Send, "m_vecOrigin", KingPos);
is firing too before the teleport happens
yes it is
DitaSoft is offline
DitaSoft
Junior Member
Join Date: Aug 2014
Location: Germany
Old 08-04-2014 , 15:51   Re: [CS:GO]TeleportEntity does not Work
Reply With Quote #9

PHP Code:

ClientPos
[2] += 16.0;
   
TeleportEntity(clientClientPosNULL_VECTORNULL_VECTOR); 
tryed it didnt work

Last edited by DitaSoft; 08-04-2014 at 15:55.
DitaSoft is offline
mukunda
Member
Join Date: Sep 2012
Old 08-04-2014 , 16:21   Re: [CS:GO]TeleportEntity does not Work
Reply With Quote #10

You can't teleport players in that event, you should make a short timer and teleport them from there. Also, you should use userids to keep track of who is who, not their names!
__________________
mukunda 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 05:56.


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