-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathshavit-kz.sp
82 lines (64 loc) · 1.71 KB
/
shavit-kz.sp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#include <sourcemod>
#include <shavit>
#pragma newdecls required
#pragma semicolon 1
enum
{
TimerAction_None,
TimerAction_OnStart,
TimerAction_OnTeleport
}
public Plugin myinfo =
{
name = "[shavit] KZ Pro <-> TP",
author = "shavit",
description = "Changes styles between Pro and TP.",
version = SHAVIT_VERSION,
url = "https://github.com/shavitush/bhoptimer"
}
public Action Shavit_OnStart(int client, int track)
{
int iStyle = Shavit_GetBhopStyle(client);
int iTargetStyle = iStyle;
if(GetTimerAction(iStyle, iTargetStyle) == TimerAction_OnStart)
{
Shavit_ChangeClientStyle(client, iTargetStyle, true, false, false);
}
return Plugin_Continue;
}
public Action Shavit_OnTeleport(int client)
{
int iStyle = Shavit_GetBhopStyle(client);
int iTargetStyle = iStyle;
if(GetTimerAction(iStyle, iTargetStyle) == TimerAction_OnTeleport)
{
Shavit_ChangeClientStyle(client, iTargetStyle, true, false, false);
}
return Plugin_Continue;
}
int GetTimerAction(int style, int &arg)
{
char sSpecial[128];
Shavit_GetStyleStrings(style, sSpecialString, sSpecial, sizeof(stylestrings_t::sSpecialString));
char sExploded[6][32];
int iSettings = ExplodeString(sSpecial, ";", sExploded, 6, 32, false);
for(int i = 0; i < iSettings; i++)
{
char sExplodedStyle[2][16];
int iExploded = ExplodeString(sExploded[i], "=", sExplodedStyle, 2, 16, false);
if(iExploded != 2)
{
continue;
}
arg = StringToInt(sExplodedStyle[1]);
if(StrContains(sExploded[i], "onstart") != -1)
{
return TimerAction_OnStart;
}
if(StrContains(sExploded[i], "onteleport") != -1)
{
return TimerAction_OnTeleport;
}
}
return TimerAction_None;
}