1- using System ;
2- using System . Linq ;
3- using System . Reflection ;
4- using Rocket . API ;
51using Rocket . Unturned . Player ;
62using UnityEngine ;
73using SDG . Unturned ;
84using Rocket . Core . Plugins ;
9- using Rocket . Core . Logging ;
105using Rocket . API . Collections ;
116using Rocket . Unturned . Chat ;
12- using Rocket . Core ;
13- using System . Collections . Generic ;
14- using Steamworks ;
157using Rocket . Unturned . Events ;
168
179namespace coolpuppy24 . simpledeathmessages
@@ -89,137 +81,50 @@ private void OnPlayerDeath(UnturnedPlayer player, EDeathCause cause, ELimb limb,
8981
9082 string headshot = Translate ( "headshot" ) ;
9183 {
92- if ( cause . ToString ( ) == "GUN" )
93- {
94- if ( limb == ELimb . SKULL )
95- UnturnedChat . Say ( Translate ( "gun_headshot" , killer . DisplayName , player . DisplayName , headshot , Rocket . Unturned . Player . UnturnedPlayer . FromCSteamID ( murderer ) . Player . equipment . asset . itemName . ToString ( ) ) , UnturnedChat . GetColorFromName ( Configuration . Instance . DeathMessagesColor , Color . green ) ) ;
96- else
97- UnturnedChat . Say ( Translate ( "gun" , killer . DisplayName , player . DisplayName , Rocket . Unturned . Player . UnturnedPlayer . FromCSteamID ( murderer ) . Player . equipment . asset . itemName . ToString ( ) ) , UnturnedChat . GetColorFromName ( Configuration . Instance . DeathMessagesColor , Color . green ) ) ;
98- }
99- else if ( cause . ToString ( ) == "MELEE" )
100- {
101- if ( limb == ELimb . SKULL )
102- UnturnedChat . Say ( Translate ( "melee_headshot" , killer . DisplayName , player . DisplayName , headshot , Rocket . Unturned . Player . UnturnedPlayer . FromCSteamID ( murderer ) . Player . equipment . asset . itemName . ToString ( ) ) , UnturnedChat . GetColorFromName ( Configuration . Instance . DeathMessagesColor , Color . green ) ) ;
84+ if ( cause . ToString ( ) == "SHRED" || cause . ToString ( ) == "ZOMBIE" || cause . ToString ( ) == "ANIMAL" || cause . ToString ( ) == "SPARK" || cause . ToString ( ) == "VEHICLE" || cause . ToString ( ) == "FOOD" || cause . ToString ( ) == "WATER" || cause . ToString ( ) == "INFECTION" || cause . ToString ( ) == "BLEEDING" || cause . ToString ( ) == "LANDMINE" || cause . ToString ( ) == "BREATH" || cause . ToString ( ) == "KILL" || cause . ToString ( ) == "FREEZING" || cause . ToString ( ) == "SENTRY" || cause . ToString ( ) == "CHARGE" || cause . ToString ( ) == "MISSILE" || cause . ToString ( ) == "BONES" || cause . ToString ( ) == "SPLASH" || cause . ToString ( ) == "ACID" || cause . ToString ( ) == "SPIT" || cause . ToString ( ) == "BURNING" || cause . ToString ( ) == "BURNER" || cause . ToString ( ) == "BOULDER" || cause . ToString ( ) == "ARENA" || cause . ToString ( ) == "GRENADE" || ( Configuration . Instance . ShowSuicideMSG == true && cause . ToString ( ) == "SUICIDE" ) || cause . ToString ( ) == "ROADKILL" || cause . ToString ( ) == "MELEE" || cause . ToString ( ) == "GUN" || cause . ToString ( ) == "PUNCH" )
85+ {
86+ if ( cause . ToString ( ) != "ROADKILL" && cause . ToString ( ) != "MELEE" && cause . ToString ( ) != "GUN" && cause . ToString ( ) != "PUNCH" )
87+ {
88+ UnturnedChat . Say ( Translate ( cause . ToString ( ) . ToLower ( ) , player . DisplayName ) , UnturnedChat . GetColorFromName ( Configuration . Instance . DeathMessagesColor , Color . green ) ) ;
89+ }
90+ else if ( cause . ToString ( ) == "ROADKILL" )
91+ {
92+ UnturnedChat . Say ( Translate ( "roadkill" , killer . DisplayName , player . DisplayName ) , UnturnedChat . GetColorFromName ( Configuration . Instance . DeathMessagesColor , Color . green ) ) ;
93+ }
94+ else if ( cause . ToString ( ) == "MELEE" || cause . ToString ( ) == "GUN" )
95+ {
96+ if ( limb == ELimb . SKULL )
97+ UnturnedChat . Say ( Translate ( cause . ToString ( ) . ToLower ( ) + "_headshot" , killer . DisplayName , player . DisplayName , headshot , Rocket . Unturned . Player . UnturnedPlayer . FromCSteamID ( murderer ) . Player . equipment . asset . itemName . ToString ( ) ) , UnturnedChat . GetColorFromName ( Configuration . Instance . DeathMessagesColor , Color . green ) ) ;
98+ else
99+ UnturnedChat . Say ( Translate ( cause . ToString ( ) . ToLower ( ) , killer . DisplayName , player . DisplayName , Rocket . Unturned . Player . UnturnedPlayer . FromCSteamID ( murderer ) . Player . equipment . asset . itemName . ToString ( ) ) , UnturnedChat . GetColorFromName ( Configuration . Instance . DeathMessagesColor , Color . green ) ) ;
100+ }
101+ else if ( cause . ToString ( ) == "PUNCH" )
102+ {
103+ if ( limb == ELimb . SKULL )
104+ UnturnedChat . Say ( Translate ( "punch_headshot" , killer . DisplayName , player . DisplayName , headshot ) , UnturnedChat . GetColorFromName ( Configuration . Instance . DeathMessagesColor , Color . green ) ) ;
105+ else
106+ UnturnedChat . Say ( Translate ( "punch" , killer . DisplayName , player . DisplayName ) , UnturnedChat . GetColorFromName ( Configuration . Instance . DeathMessagesColor , Color . green ) ) ;
107+ }
108+ }
109+ else //No need to update the plugin later! (Just add the translation)
110+ {
111+ if ( Translate ( cause . ToString ( ) . ToLower ( ) ) != null )
112+ {
113+ if ( Translate ( cause . ToString ( ) . ToLower ( ) ) . Contains ( "{1}" ) )
114+ {
115+ UnturnedChat . Say ( Translate ( cause . ToString ( ) . ToLower ( ) , player . DisplayName , killer . DisplayName ) , UnturnedChat . GetColorFromName ( Configuration . Instance . DeathMessagesColor , Color . green ) ) ;
116+ }
117+ else
118+ {
119+ UnturnedChat . Say ( Translate ( cause . ToString ( ) . ToLower ( ) , player . DisplayName ) , UnturnedChat . GetColorFromName ( Configuration . Instance . DeathMessagesColor , Color . green ) ) ;
120+ }
121+ }
103122 else
104- UnturnedChat . Say ( Translate ( "melee" , killer . DisplayName , player . DisplayName , Rocket . Unturned . Player . UnturnedPlayer . FromCSteamID ( murderer ) . Player . equipment . asset . itemName . ToString ( ) ) , UnturnedChat . GetColorFromName ( Configuration . Instance . DeathMessagesColor , Color . green ) ) ;
105- }
106- else if ( cause . ToString ( ) == "PUNCH" )
107- {
108- if ( limb == ELimb . SKULL )
109- UnturnedChat . Say ( Translate ( "punch_headshot" , killer . DisplayName , player . DisplayName , headshot ) , UnturnedChat . GetColorFromName ( Configuration . Instance . DeathMessagesColor , Color . green ) ) ;
110- else
111- UnturnedChat . Say ( Translate ( "punch" , killer . DisplayName , player . DisplayName ) , UnturnedChat . GetColorFromName ( Configuration . Instance . DeathMessagesColor , Color . green ) ) ;
112- }
113- else if ( cause . ToString ( ) == "SHRED" )
114- {
115- UnturnedChat . Say ( Translate ( "shred" , player . DisplayName ) , UnturnedChat . GetColorFromName ( Configuration . Instance . DeathMessagesColor , Color . green ) ) ;
116- }
117- else if ( cause . ToString ( ) == "ZOMBIE" )
118- {
119- UnturnedChat . Say ( Translate ( "zombie" , player . DisplayName ) , UnturnedChat . GetColorFromName ( Configuration . Instance . DeathMessagesColor , Color . green ) ) ;
120- }
121- else if ( cause . ToString ( ) == "ANIMAL" )
122- {
123- UnturnedChat . Say ( Translate ( "animal" , player . DisplayName ) , UnturnedChat . GetColorFromName ( Configuration . Instance . DeathMessagesColor , Color . green ) ) ;
124- }
125- else if ( cause . ToString ( ) == "ROADKILL" )
126- {
127- UnturnedChat . Say ( Translate ( "roadkill" , killer . DisplayName , player . DisplayName ) , UnturnedChat . GetColorFromName ( Configuration . Instance . DeathMessagesColor , Color . green ) ) ;
128- }
129- else if ( cause . ToString ( ) == "SPARK" )
130- {
131- UnturnedChat . Say ( Translate ( "spark" , player . DisplayName ) , UnturnedChat . GetColorFromName ( Configuration . Instance . DeathMessagesColor , Color . green ) ) ;
132- }
133- else if ( cause . ToString ( ) == "VEHICLE" )
134- {
135- UnturnedChat . Say ( Translate ( "vehicle" , player . DisplayName ) , UnturnedChat . GetColorFromName ( Configuration . Instance . DeathMessagesColor , Color . green ) ) ;
136- }
137- else if ( cause . ToString ( ) == "FOOD" )
138- {
139- UnturnedChat . Say ( Translate ( "food" , player . DisplayName ) , UnturnedChat . GetColorFromName ( Configuration . Instance . DeathMessagesColor , Color . green ) ) ;
140- }
141- else if ( cause . ToString ( ) == "WATER" )
142- {
143- UnturnedChat . Say ( Translate ( "water" , player . DisplayName ) , UnturnedChat . GetColorFromName ( Configuration . Instance . DeathMessagesColor , Color . green ) ) ;
144- }
145- else if ( cause . ToString ( ) == "INFECTION" )
146- {
147- UnturnedChat . Say ( Translate ( "infection" , player . DisplayName ) , UnturnedChat . GetColorFromName ( Configuration . Instance . DeathMessagesColor , Color . green ) ) ;
148- }
149- else if ( cause . ToString ( ) == "BLEEDING" )
150- {
151- UnturnedChat . Say ( Translate ( "bleeding" , player . DisplayName ) , UnturnedChat . GetColorFromName ( Configuration . Instance . DeathMessagesColor , Color . green ) ) ;
152- }
153- else if ( cause . ToString ( ) == "LANDMINE" )
154- {
155- UnturnedChat . Say ( Translate ( "landmine" , player . DisplayName ) , UnturnedChat . GetColorFromName ( Configuration . Instance . DeathMessagesColor , Color . green ) ) ;
156- }
157- else if ( cause . ToString ( ) == "BREATH" )
158- {
159- UnturnedChat . Say ( Translate ( "breath" , player . DisplayName ) , UnturnedChat . GetColorFromName ( Configuration . Instance . DeathMessagesColor , Color . green ) ) ;
160- }
161- else if ( cause . ToString ( ) == "KILL" )
162- {
163- UnturnedChat . Say ( Translate ( "kill" , player . DisplayName ) , UnturnedChat . GetColorFromName ( Configuration . Instance . DeathMessagesColor , Color . green ) ) ;
164- }
165- else if ( cause . ToString ( ) == "FREEZING" )
166- {
167- UnturnedChat . Say ( Translate ( "freezing" , player . DisplayName ) , UnturnedChat . GetColorFromName ( Configuration . Instance . DeathMessagesColor , Color . green ) ) ;
168- }
169- else if ( cause . ToString ( ) == "SENTRY" )
170- {
171- UnturnedChat . Say ( Translate ( "sentry" , player . DisplayName ) , UnturnedChat . GetColorFromName ( Configuration . Instance . DeathMessagesColor , Color . green ) ) ;
172- }
173- else if ( cause . ToString ( ) == "CHARGE" )
174- {
175- UnturnedChat . Say ( Translate ( "charge" , player . DisplayName ) , UnturnedChat . GetColorFromName ( Configuration . Instance . DeathMessagesColor , Color . green ) ) ;
176- }
177- else if ( cause . ToString ( ) == "MISSILE" )
178- {
179- UnturnedChat . Say ( Translate ( "missile" , player . DisplayName ) , UnturnedChat . GetColorFromName ( Configuration . Instance . DeathMessagesColor , Color . green ) ) ;
180- }
181- else if ( cause . ToString ( ) == "BONES" )
182- {
183- UnturnedChat . Say ( Translate ( "bones" , player . DisplayName ) , UnturnedChat . GetColorFromName ( Configuration . Instance . DeathMessagesColor , Color . green ) ) ;
184- }
185- else if ( cause . ToString ( ) == "SPLASH" )
186- {
187- UnturnedChat . Say ( Translate ( "splash" , player . DisplayName ) , UnturnedChat . GetColorFromName ( Configuration . Instance . DeathMessagesColor , Color . green ) ) ;
188- }
189- else if ( cause . ToString ( ) == "ACID" )
190- {
191- UnturnedChat . Say ( Translate ( "acid" , player . DisplayName ) , UnturnedChat . GetColorFromName ( Configuration . Instance . DeathMessagesColor , Color . green ) ) ;
192- }
193- else if ( cause . ToString ( ) == "SPIT" )
194- {
195- UnturnedChat . Say ( Translate ( "spit" , player . DisplayName ) , UnturnedChat . GetColorFromName ( Configuration . Instance . DeathMessagesColor , Color . green ) ) ;
196- }
197- else if ( cause . ToString ( ) == "BURNING" )
198- {
199- UnturnedChat . Say ( Translate ( "burning" , player . DisplayName ) , UnturnedChat . GetColorFromName ( Configuration . Instance . DeathMessagesColor , Color . green ) ) ;
200- }
201- else if ( cause . ToString ( ) == "BURNER" )
202- {
203- UnturnedChat . Say ( Translate ( "burner" , player . DisplayName ) , UnturnedChat . GetColorFromName ( Configuration . Instance . DeathMessagesColor , Color . green ) ) ;
204- }
205- else if ( cause . ToString ( ) == "BOULDER" )
206- {
207- UnturnedChat . Say ( Translate ( "boulder" , player . DisplayName ) , UnturnedChat . GetColorFromName ( Configuration . Instance . DeathMessagesColor , Color . green ) ) ;
208- }
209- else if ( cause . ToString ( ) == "ARENA" )
210- {
211- UnturnedChat . Say ( Translate ( "arena" , player . DisplayName ) , UnturnedChat . GetColorFromName ( Configuration . Instance . DeathMessagesColor , Color . green ) ) ;
212- }
213- else if ( cause . ToString ( ) == "SUICIDE" && Configuration . Instance . ShowSuicideMSG )
214- {
215- UnturnedChat . Say ( Translate ( "suicide" , player . DisplayName ) , UnturnedChat . GetColorFromName ( Configuration . Instance . DeathMessagesColor , Color . green ) ) ;
216- }
217- else if ( cause . ToString ( ) == "GRENADE" )
218- {
219- UnturnedChat . Say ( Translate ( "grenade" , player . DisplayName ) , UnturnedChat . GetColorFromName ( Configuration . Instance . DeathMessagesColor , Color . green ) ) ;
123+ {
124+ Rocket . Core . Logging . Logger . LogError ( "Please add translation for " + cause . ToString ( ) + " | Parameters for custom translation: {0} = Player , {1} = Killer" ) ;
125+ }
220126 }
221127 }
222128 }
223-
224129 }
225- }
130+ }
0 commit comments