-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add SurfTimer-telefinder #235
Merged
Merged
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
b1bd1af
add ckSurf-telefinder
dPexxIAM 3104532
Add files via upload
dPexxIAM 7365a42
Update and rename ckSurf-telefinder.sp to SurfTimer-telefinder.sp
dPexxIAM 67abc1f
Update SurfTimer-telefinder.sp
dPexxIAM 62d19c4
Closing all handles
Bara File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
#pragma semicolon 1 | ||
|
||
#define DEBUG | ||
|
||
#define PLUGIN_AUTHOR "Elzi" | ||
#define PLUGIN_VERSION "1.00" | ||
|
||
#include <sourcemod> | ||
#include <sdktools> | ||
#include <cstrike> | ||
#include <surftimer> | ||
|
||
EngineVersion g_Game; | ||
|
||
Handle g_hEntity; | ||
int g_iEntIndex[MAXPLAYERS + 1]; | ||
|
||
public Plugin myinfo = | ||
{ | ||
name = "[surftimer] Teleport Destination Finder", | ||
author = PLUGIN_AUTHOR, | ||
description = "Teleports clients using !cktele to info_teleport_destinations", | ||
version = PLUGIN_VERSION, | ||
url = "" | ||
}; | ||
|
||
public void OnPluginStart() | ||
{ | ||
g_Game = GetEngineVersion(); | ||
if(g_Game != Engine_CSGO && g_Game != Engine_CSS) | ||
{ | ||
SetFailState("This plugin is for CSGO/CSS only."); | ||
} | ||
|
||
RegAdminCmd("sm_cktele", TeleToInfo, ADMFLAG_ROOT, "[surftimer] Teleport client to a teleport destination in the map"); | ||
|
||
} | ||
|
||
public void OnMapStart() | ||
{ | ||
for (int i = 0; i < MAXPLAYERS + 1; i++) | ||
g_iEntIndex[i] = 0; | ||
|
||
int iEnt; | ||
g_hEntity = CreateArray(12); | ||
|
||
while ((iEnt = FindEntityByClassname(iEnt, "info_teleport_destination")) != -1) | ||
PushArrayCell(g_hEntity, iEnt); | ||
|
||
} | ||
|
||
public void OnMapEnd() | ||
{ | ||
if (g_hEntity != null) | ||
g_hEntity.Close(); | ||
|
||
g_hEntity = null; | ||
} | ||
|
||
|
||
public Action TeleToInfo(int client, int args) | ||
{ | ||
if (g_hEntity == null) | ||
{ | ||
ReplyToCommand(client, "[CK] g_hEntity was null!"); | ||
Bara marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return Plugin_Handled; | ||
} | ||
|
||
if (GetArraySize(g_hEntity) < 1) | ||
{ | ||
ReplyToCommand(client, "[CK] No info_teleport_destinations found in map!"); | ||
return Plugin_Handled; | ||
} | ||
|
||
if (g_iEntIndex[client] == GetArraySize(g_hEntity)) | ||
{ | ||
ReplyToCommand(client, "[CK] All info_teleport_destinations were looped, back to index 0"); | ||
g_iEntIndex[client] = 0; | ||
} | ||
|
||
int iEnt = GetArrayCell(g_hEntity, g_iEntIndex[client]); | ||
|
||
if (IsValidEntity(iEnt)) | ||
{ | ||
float position[3]; | ||
GetEntPropVector(iEnt, Prop_Send, "m_vecOrigin", position); | ||
|
||
surftimer_SafeTeleport(client, position, NULL_VECTOR, NULL_VECTOR, true); | ||
|
||
ReplyToCommand(client, "[CK] Teleporting to entity at %f, %f, %f", position[0], position[1], position[2]); | ||
} | ||
else | ||
|
||
ReplyToCommand(client, "[CK] Entity was invalid!"); | ||
|
||
|
||
g_iEntIndex[client]++; | ||
return Plugin_Handled; | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps also RegAdminCmd("sm_cktele" ==> sm_telefinder ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated the pr