You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: scripts/dmodels_command.dsc
+15-32Lines changed: 15 additions & 32 deletions
Original file line number
Diff line number
Diff line change
@@ -23,11 +23,14 @@ dmodels_command:
23
23
data:
24
24
load_example: <&[error]>'path' should be a valid file name, for example if you have <&[emphasis]>data/dmodels/example.bbmodel<&[error]>, you should do: <&[warning]>/dmodels load example
25
25
script:
26
-
- choose<context.args.first||help>:
26
+
- define arg1 <context.args.first||help>
27
+
- if !<[arg1].matches_character_set[<script[dmodels_cmd_data].data_key[valid_chars]>]>:
28
+
- define arg1 help
29
+
- if !<player.has_permission[dmodels.<[arg1]>]>:
30
+
- narrate"<&[error]>You do not have permission for that."
31
+
- stop
32
+
- choose<[arg1]>:
27
33
- case load:
28
-
- if !<player.has_permission[dmodels.load]>:
29
-
- narrate"<&[error]>You do not have permission for that."
30
-
- stop
31
34
- if !<context.args.get[2].exists>:
32
35
- narrate"<&[warning]>/dmodels load [path] <&[error]>- loads a model from file based on filename"
33
36
- narrate<script.parsed_key[load_example]>
@@ -52,19 +55,13 @@ dmodels_command:
52
55
- else:
53
56
- narrate"<&[error]>Unable to load that model."
54
57
- case loadall:
55
-
- if !<player.has_permission[dmodels.loadall]>:
56
-
- narrate"<&[error]>You do not have permission for that."
- debug log "[DModels] <&[emphasis]><player.name||server><&[base]>is loading <[files].size.custom_color[emphasis]> model files: <[files].formatted.custom_color[emphasis]>"
62
62
- ~run dmodels_multi_load def.list:<[files]>
63
63
- narrate<&[base]>Done!
64
64
- case unload:
65
-
- if !<player.has_permission[dmodels.unload]>:
66
-
- narrate"<&[error]>You do not have permission for that."
67
-
- stop
68
65
- if !<context.args.get[2].exists>:
69
66
- narrate"<&[warning]>/dmodels unload [model] <&[error]>- unloads a model's data from memory."
70
67
- stop
@@ -79,15 +76,9 @@ dmodels_command:
79
76
- flag server dmodels_data.animations_<[model]>:!
80
77
- narrate"<&[base]>Removed model <[model].custom_color[emphasis]> from memory."
81
78
- case unloadall:
82
-
- if !<player.has_permission[dmodels.unloadall]>:
83
-
- narrate"<&[error]>You do not have permission for that."
84
-
- stop
85
79
- flag server dmodels_data:!
86
80
- narrate"<&[base]>Removed all DModels data from meory."
87
81
- case spawn:
88
-
- if !<player.has_permission[dmodels.spawn]>:
89
-
- narrate"<&[error]>You do not have permission for that."
90
-
- stop
91
82
- if !<context.args.get[2].exists>:
92
83
- narrate"<&[warning]>/dmodels spawn [model] <&[error]>- spawns a model at your position (must be loaded)"
93
84
- stop
@@ -106,17 +97,11 @@ dmodels_command:
106
97
- flag player spawned_dmodel_<[model]>:<[spawned]>
107
98
- narrate"<&[base]>Spawned model <[model].custom_color[emphasis]> with root entity <[spawned].uuid.custom_color[emphasis]>, stored to player flag '<&[emphasis]>spawned_dmodel_<[model]><&[base]>'"
108
99
- case remove:
109
-
- if !<player.has_permission[dmodels.remove]>:
110
-
- narrate"<&[error]>You do not have permission for that."
111
-
- stop
112
100
- inject dmodels_get_target
113
101
- define model <[target].flag[dmodel_model_id]>
114
102
- run dmodels_delete def.root_entity:<[target]>
115
103
- narrate"<&[base]>Removed a spawned copy of model <[model].custom_color[emphasis]>."
116
104
- case animate:
117
-
- if !<player.has_permission[dmodels.animate]>:
118
-
- narrate"<&[error]>You do not have permission for that."
119
-
- stop
120
105
- if !<context.args.get[2].exists>:
121
106
- narrate"<&[warning]>/dmodels animate [animation] <&[error]>- causes the closest real-spawned model to start playing the given animation"
122
107
- stop
@@ -130,19 +115,13 @@ dmodels_command:
130
115
- run dmodels_animate def.root_entity:<[target]> def.animation:<[animation]>
131
116
- narrate"<&[base]>Model <[target].flag[dmodel_model_id].custom_color[emphasis]> is now playing animation <[animation].custom_color[emphasis]>"
132
117
- case stopanimate:
133
-
- if !<player.has_permission[dmodels.stopanimate]>:
134
-
- narrate"<&[error]>You do not have permission for that."
135
-
- stop
136
118
- inject dmodels_get_target
137
119
- if !<[target].has_flag[dmodels_animation_id]>:
138
120
- narrate"<&[base]>Your nearest model is not animating currently."
139
121
- stop
140
122
- run dmodels_end_animation def.root_entity:<[target]>
141
123
- narrate"<&[base]>Animation stopped."
142
124
- case npcmodel:
143
-
- if !<player.has_permission[dmodels.npcmodel]>:
144
-
- narrate"<&[error]>You do not have permission for that."
145
-
- stop
146
125
- if !<player.selected_npc.exists>:
147
126
- narrate"<&[error]>You do not have any NPC selected."
- if !<[args].first.matches_character_set[<script[dmodels_cmd_data].data_key[valid_chars]>]> || !<player.has_permission[dmodels.<[args].first>]||true>:
200
+
- determine<list>
201
+
- if<[args].first> == load:
221
202
- define path <[args].get[2]||>
222
203
- if !<[path].to_lowercase.matches_character_set[<script[dmodels_cmd_data].data_key[valid_chars]>]>:
0 commit comments