-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcustom_tank4.nut
60 lines (50 loc) · 1.99 KB
/
custom_tank4.nut
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
local spots = ["will spawn at the beginning. (10% Map Distance)","will spawn in the large barn near the start. (24% Map Distance)","will spawn at the park entrance. (35% Map Distance)","will spawn on the barn rooftops. (58% Map Distance)","will spawn in the generator room. (62% Map Distance)","will spawn at the food court. The event will end instantly after the Tank is spawned. (70% Map Distance)","will spawn at the event turn-off switch. (88% Map Distance)","will spawn at raised veranda area. The event will end instantly after the Tank is spawned. (80% Map Distance)","will spawn at the large barn at the end of the park. (50% Map Distance)","will spawn in the pool table room. (31% Map Distance)"]
local chosen_spot = -1
local chat_prefix = "The Tank "
SayTankSpot <- function(spot_num){
Say(null,chat_prefix + spots[spot_num-1],false)
chosen_spot = spot_num-1
}
local function IsCommand(msg,ent,command){
local message = ""
local found_start = false
local found_end = false
local last_char = 0
foreach(char in msg){
if(char != 32 && char != 10){
if(!found_start){
found_start = true
}
message += char.tochar()
} else if(char == 32){
if(last_char != 32){
found_end = true
}
if(found_start && !found_end){
message += char.tochar()
}
}
}
return message == command
}
function OnGameEvent_player_say(params)
{
local userid = params.userid
local text = params.text
if(IsCommand(text,GetPlayerFromUserID(userid),"!tank")){
SayTankSpot(chosen_spot+1)
}
if(IsCommand(text,GetPlayerFromUserID(userid),"!sm_tank")){
SayTankSpot(chosen_spot+1)
}
if(IsCommand(text,GetPlayerFromUserID(userid),"!boss")){
SayTankSpot(chosen_spot+1)
}
if(IsCommand(text,GetPlayerFromUserID(userid),"!b")){
SayTankSpot(chosen_spot+1)
}
if(IsCommand(text,GetPlayerFromUserID(userid),"!t")){
SayTankSpot(chosen_spot+1)
}
}
__CollectEventCallbacks(this, "OnGameEvent_", "GameEventCallbacks", RegisterScriptGameEventListener)