· 8 years ago · Dec 06, 2017, 12:04 PM
1//* Some commands and functions for Morphine by DarkSky *//
2
3
4 If you need any type of help Morphine, call me
5//* *//
6
7============================Spawnweps Cmd============================
8
9 else if ( cmd == "spawnwep" )
10 {
11
12 local wep = GetWeaponID( text );
13 local wepname = GetWeaponName(wep);
14 if ( text == "on")
15 {
16 WriteIniString("Spawnweps.ini",player.Name,"type","on");
17 PrivMessage("Spawn Weps : ON ",player);
18 }
19 else if ( text == "off")
20 {
21 WriteIniString("Spawnweps.ini",player.Name,"type","off");
22 PrivMessage("Spawn Weps : OFF ",player);
23 }
24 else if ( text == "list")
25 {
26 local w1 = ReadIniInteger("Spawnweps.ini",player.Name,"w1");
27 local w2 = ReadIniInteger("Spawnweps.ini",player.Name,"w2");
28 local w3 = ReadIniInteger("Spawnweps.ini",player.Name,"w3");
29 local w4 = ReadIniInteger("Spawnweps.ini",player.Name,"w4");
30 local w5 = ReadIniInteger("Spawnweps.ini",player.Name,"w5");
31 local w6 = ReadIniInteger("Spawnweps.ini",player.Name,"w6");
32 local wname1 = GetWeaponName(w1);
33 local wname2 = GetWeaponName(w2);
34 local wname3 = GetWeaponName(w3);
35 local wname4 = GetWeaponName(w4);
36 local wname5 = GetWeaponName(w5);
37 local wname6 = GetWeaponName(w6);
38 PrivMessage("Spawn Wep [1] : "+wname1,player);
39 PrivMessage("Spawn Wep [2] : "+wname2,player);
40 PrivMessage("Spawn Wep [3] : "+wname3,player);
41 PrivMessage("Spawn Wep [4] : "+wname4,player);
42 PrivMessage("Spawn Wep [5] : "+wname5,player);
43 PrivMessage("Spawn Wep [6] : "+wname6,player);
44 }
45 else {
46 if ( wep < 16 ) {
47 WriteIniInteger("Spawnweps.ini",player.Name,"w1",wep.tointeger());
48 PrivMessage("Spawn wep [1] seted to : "+wepname,player);
49 }
50 else if (( 16 < wep ) || ( wep < 19 )) {
51 WriteIniInteger("Spawnweps.ini",player.Name,"w2",wep.tointeger());
52 PrivMessage("Spawn wep [2] seted to : "+wepname,player);
53 }
54 else if (( 18 < wep ) || ( wep < 22 )) {
55 WriteIniInteger("Spawnweps.ini",player.Name,"w3",wep.tointeger());
56 PrivMessage("Spawn wep [3] seted to : "+wepname,player);
57 }
58 else if (( 21 < wep ) || ( wep < 26 )) {
59 WriteIniInteger("Spawnweps.ini",player.Name,"w4",wep.tointeger());
60 PrivMessage("Spawn wep [4] seted to : "+wepname,player);
61 }
62 else if (( 25 < wep ) || ( wep < 28 )) {
63 WriteIniInteger("Spawnweps.ini",player.Name,"w5",wep.tointeger());
64 PrivMessage("Spawn wep [5] seted to : "+wepname,player);
65 }
66 else if (( 27 < wep ) || ( wep < 33 )) {
67 WriteIniInteger("Spawnweps.ini",player.Name,"w6",wep.tointeger());
68 PrivMessage("Spawn wep [6] seted to : "+wepname,player);
69 }
70 }
71}
72=============Function Of Spawnwep Cmd================
73
74 //Add it onplayerspawn//
75
76 local swt = ReadIniString("Spawnweps.ini",player.Name,"type");
77 if ( swt == "on") {
78 local w1 = ReadIniInteger("Spawnweps.ini",player.Name,"w1");
79 local w2 = ReadIniInteger("Spawnweps.ini",player.Name,"w2");
80 local w3 = ReadIniInteger("Spawnweps.ini",player.Name,"w3");
81 local w4 = ReadIniInteger("Spawnweps.ini",player.Name,"w4");
82 local w5 = ReadIniInteger("Spawnweps.ini",player.Name,"w5");
83 local w6 = ReadIniInteger("Spawnweps.ini",player.Name,"w6");
84 player.SetWeapon(w1,9000);
85 player.SetWeapon(w2,9000);
86 player.SetWeapon(w3,9000);
87 player.SetWeapon(w4,9000);
88 player.SetWeapon(w5,9000);
89 player.SetWeapon(w6,9000);
90 }
91
92================Wepclass And Wepinfo Cmds===============
93 else if ( cmd == "wepclass" )
94 {
95 local type = ReadIniInteger("Scripts Files/wepclass.ini",player.Name,"type");
96 if ( !text ) PrivMessage("[Syntax] - Usage: /c wepclass [on/off/set/1,2,3]",player);
97 else
98 {
99 if ( text == "on" )
100 {
101 if ( type == 1 ) ClientMessage("[Error] - Wepclass is already on",player,255, 0, 0);
102 else
103 {
104
105 WriteIniInteger("Scripts Files/wepclass.ini",player.Name,"type",1);
106 ClientMessage("You have turned on wepclass",player,60,234,34);
107 }
108 }
109
110 else if ( text == "off" )
111 {
112
113 if ( type == 0 ) ClientMessage("[Error] - Wepclass is already off",player,255, 0, 0);
114 else
115 {
116
117 WriteIniInteger("Scripts Files/wepclass.ini",player.Name,"type",0);
118 ClientMessage("You have turned off wepclass",player,60,234,34);
119 }
120 }
121 else if ( text == "set1" )
122 {
123 WriteIniInteger("Scripts Files/wepclass.ini",player.Name,"wepclass",1);
124 ClientMessage("Wepclass seted to: [ 1 ]",player,60,234,34);
125 }
126 else if ( text == "set2" )
127 {
128 WriteIniInteger("Scripts Files/wepclass.ini",player.Name,"wepclass",2);
129 ClientMessage("Wepclass seted to: [ 2 ]",player,60,234,34);
130 }
131 else if ( text == "set3" )
132 {
133 WriteIniInteger("Scripts Files/wepclass.ini",player.Name,"wepclass",3);
134 ClientMessage("Wepclass seted to: [ 3 ]",player,60,234,34);
135
136 }
137
138 }
139}
140//Wepinfo cmd
141 else if ( cmd == "wepinfo" )
142 {
143 PrivMessage(" [ Wepclasses info ] 1- [ Python, M4, Stubby, Ingram, Grenade ], 2- [ M60, Shotgun, Uzi, Molotov, Colt 45 ]",player);
144 PrivMessage("3- [ Rocket Launcher, Ruger, Spaz, Grenade, Mp5 ]",player);
145}
146//==========================Function Of Wepclass Cmd==========================//
147//Ad it onplayerspawn//
148
149 local type = ReadIniInteger("Scripts Files/wepclass.ini",player.Name,"type");
150 if ( type == 1 ) {
151
152
153 local wepclass = ReadIniInteger("Scripts Files/wepclass.ini",player.Name,"wepclass");
154 if ( wepclass == 1 ) {
155
156 player.SetWeapon( 18, 9999 );
157 player.SetWeapon( 26, 9999 );
158 player.SetWeapon( 21, 9999 );
159 player.SetWeapon( 24, 9999 );
160 player.SetWeapon( 12, 9999 );
161 ClientMessage("Wepclass status: On, Wepclass: [ 1 ]",player,60,234,34);
162 }
163
164 if ( wepclass == 2 ) {
165
166 player.SetWeapon( 32, 9999 );
167 player.SetWeapon( 19, 9999 );
168 player.SetWeapon( 23, 9999 );
169 player.SetWeapon( 15, 9999 );
170 player.SetWeapon( 17, 9999 );
171 ClientMessage("Wepclass status: On, Wepclass: [ 2 ]",player,60,234,34);
172
173 }
174
175 if ( wepclass == 3 ) {
176
177 player.SetWeapon( 30, 9999 );
178 player.SetWeapon( 27, 9999 );
179 player.SetWeapon( 20, 9999 );
180 player.SetWeapon( 12, 9999 );
181 player.SetWeapon( 25, 9999 );
182 ClientMessage("Wepclass status: On, Wepclass: [ 3 ]",player,60,234,34);
183 }
184}
185
186//==============================Spawnplace Cmd========================
187
188 else if ( cmd == "spawnplace" )
189 {
190 local type = ReadIniInteger("Scripts Files/Spawnplace.ini",player.Name,"type");
191 if ( !text ) PrivMessage("[Syntax] - Usage: /c spawnplace [on/off/set]",player);
192 else
193 {
194 if ( text == "on" )
195 {
196 if ( type == 1 ) ClientMessage("[Error] - Spawn place is already turned on",player,255, 0, 0);
197 else
198 {
199
200 WriteIniInteger("Scripts Files/Spawnplace.ini",player.Name,"type",1);
201 ClientMessage("You have turned on spawn place",player,60,234,34);
202 }
203 }
204
205 else if ( text == "off" )
206 {
207
208 if ( type == 2 ) ClientMessage("[Error] - Spawn place is already turned off",player,255, 0, 0);
209 else
210 {
211 WriteIniInteger("Scripts Files/Spawnplace.ini",player.Name,"type",2);
212 ClientMessage("You have turned off spawn place",player,60,234,34);
213 }
214 }
215
216 else if ( text == "set" )
217 {
218
219 if ( !player.IsSpawned ) ClientMessage("[Error] - You haven't spawned",player,255, 0, 0);
220 else
221 {
222
223 local pos = player.Pos;
224 WriteIniString("Scripts Files/Spawnplace.ini",player.Name,"x",pos.x.tostring());
225 WriteIniString("Scripts Files/Spawnplace.ini",player.Name,"y",pos.y.tostring());
226 WriteIniString("Scripts Files/Spawnplace.ini",player.Name,"z",pos.z.tostring());
227 ClientMessage("Spawn place is now seted to: ( "+pos.x+","+pos.y+","+pos.z+" )",player,60,234,34);
228
229 }
230 }
231 }
232}
233//==============Function Of Spawnplace==============//
234
235//Add it onplayerspawn
236
237 local type = ReadIniInteger("Scripts Files/Spawnplace.ini",player.Name,"type");
238 if ( type == 1 ) {
239 local spx = ReadIniString("Scripts Files/Spawnplace.ini",player.Name,"x");
240 local spy = ReadIniString("Scripts Files/Spawnplace.ini",player.Name,"y");
241 local spz = ReadIniString("Scripts Files/Spawnplace.ini",player.Name,"z");
242 ClientMessage("You have spawned to your spawnplace",player,60,234,34);
243 player.Pos = Vector(spx.tointeger(),spy.tointeger(),spz.tointeger());
244}
245
246//==================================Bstats,Wstats,Cmds And Its Functions========================
247
248 else if ( cmd == "!bstats" )
249 {
250
251 ClientMessageToAll( ""+player.Name+"'s Bstats: "+ GetPlayerBStats( player ) + "",249,162,43 );
252 }
253
254
255 else if ( cmd == "!wstats" )
256 {
257 ClientMessageToAll( ""+player.Name+"'s Wstats: " + GetPlayerWStats( player ) + "",249,162,43);
258
259 }
260//===================Its Functions=======================//
261
262//Create two tables for the both cmds
263
264 //Unscriptsload
265
266 QuerySQL( SQLDataBase, "CREATE TABLE IF NOT EXISTS Bstats ( Name TEXT, User TEXT, Body NUMERIC, Torso NUMERIC, LeftArm NUMERIC, RightArm NUMERIC, LeftLeg NUMERIC, RightLeg NUMERIC, Head NUMERIC )" );
267 QuerySQL( SQLDataBase, "CREATE TABLE IF NOT EXISTS Wstats ( Name TEXT, User TEXT, Fist NUMERIC, BrassKnuckle NUMERIC, ScrewDriver NUMERIC, GolfClub NUMERIC, NightStick NUMERIC, Knife NUMERIC, BaseballBat NUMERIC, Hammer NUMERIC, Cleaver NUMERIC, Machete NUMERIC, Katana NUMERIC, Chainsaw NUMERIC, Grenade NUMERIC, RemoteGrenade NUMERIC, TearGas NUMERIC, Molotov NUMERIC, Missile NUMERIC, Colt45 NUMERIC, Python NUMERIC, Shotgun NUMERIC, Spaz NUMERIC, Stubby NUMERIC, Tec9 NUMERIC, Uzi NUMERIC, Ingrams NUMERIC, MP5 NUMERIC, M4 NUMERIC, Ruger NUMERIC, SniperRifle NUMERIC, LaserScope NUMERIC, RocketLauncher NUMERIC, FlameThrower NUMERIC, M60 NUMERIC )" );
268
269//Ad it to onplayerregister system
270
271 QuerySQL( SQLDataBase, "REPLACE INTO Bstats ( Name, User, Body, Torso, LeftArm, RightArm, LeftLeg, RightLeg, Head ) VALUES ( '" + player.Name.tolower() + "', '" + player.Name + "', 0, 0, 0, 0, 0, 0, 0 )" );
272 QuerySQL( SQLDataBase, "REPLACE INTO Wstats ( Name, User, Fist, BrassKnuckle, ScrewDriver, GolfClub, NightStick, Knife, BaseballBat, Hammer, Cleaver, Machete, Katana, Chainsaw, Grenade, RemoteGrenade, TearGas, Molotov, Missile, Colt45, Python, Shotgun, Spaz , Stubby, Tec9, Uzi, Ingrams, MP5, M4, Ruger, SniperRifle, LaserScope, RocketLauncher, FlameThrower, M60 ) VALUES ( '" + player.Name.tolower() + "', '" + player.Name + "', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 )" );
273
274//==============================Function Of Bodayparts====================//
275
276function BStats( bodypart )
277{
278 local bp = "Not found";
279 if ( bodypart.tointeger() == 0 ) bp = "Body";
280 if ( bodypart.tointeger() == 1 ) bp = "Torso";
281 if ( bodypart.tointeger() == 2 ) bp = "LeftArm";
282 if ( bodypart.tointeger() == 3 ) bp = "RightArm";
283 if ( bodypart.tointeger() == 4 ) bp = "LeftLeg";
284 if ( bodypart.tointeger() == 5 ) bp = "RightLeg";
285 if ( bodypart.tointeger() == 6 ) bp = "Head";
286 return bp;
287}
288
289//===========================Functions Of Wstats===========================//
290
291function WStats( wep )
292{
293 local id = "Not found";
294 if ( wep.tointeger() == 0 ) id = "Fist";
295 if ( wep.tointeger() == 1 ) id = "BrassKnuckle";
296 if ( wep.tointeger() == 2 ) id = "ScrewDriver";
297 if ( wep.tointeger() == 3 ) id = "GolfClub";
298 if ( wep.tointeger() == 4 ) id = "NightStick";
299 if ( wep.tointeger() == 5 ) id = "Knife";
300 if ( wep.tointeger() == 6 ) id = "BaseballBat";
301 if ( wep.tointeger() == 7 ) id = "Hammer";
302 if ( wep.tointeger() == 8 ) id = "Cleaver";
303 if ( wep.tointeger() == 9 ) id = "Machete";
304 if ( wep.tointeger() == 10 ) id = "Katana";
305 if ( wep.tointeger() == 11 ) id = "Chainsaw";
306 if ( wep.tointeger() == 12 ) id = "Grenade";
307 if ( wep.tointeger() == 13 ) id = "RemoteGrenade";
308 if ( wep.tointeger() == 14 ) id = "TearGas";
309 if ( wep.tointeger() == 15 ) id = "Molotov";
310 if ( wep.tointeger() == 16 ) id = "Missile";
311 if ( wep.tointeger() == 17 ) id = "Colt45";
312 if ( wep.tointeger() == 18 ) id = "Python";
313 if ( wep.tointeger() == 19 ) id = "Shotgun";
314 if ( wep.tointeger() == 20 ) id = "Spaz";
315 if ( wep.tointeger() == 21 ) id = "Stubby";
316 if ( wep.tointeger() == 22 ) id = "Tec9";
317 if ( wep.tointeger() == 23 ) id = "Uzi";
318 if ( wep.tointeger() == 24 ) id = "Ingrams";
319 if ( wep.tointeger() == 25 ) id = "MP5";
320 if ( wep.tointeger() == 26 ) id = "M4";
321 if ( wep.tointeger() == 27 ) id = "Ruger";
322 if ( wep.tointeger() == 28 ) id = "SniperRifle";
323 if ( wep.tointeger() == 29 ) id = "LaserScope";
324 if ( wep.tointeger() == 30 ) id = "RocketLauncher";
325 if ( wep.tointeger() == 31 ) id = "FlameThrower";
326 if ( wep.tointeger() == 32 ) id = "M60";
327 return id;
328}
329
330//======================Main Functions Of Both Cmds===========================//
331//======================Functions Of bstats===========///
332
333function SetPlayerBodyPart( player, bodypart, amount )
334{
335 QuerySQL( SQLDataBase, format( "UPDATE Bstats SET %s=%i WHERE Name='" + player.Name.tolower() + "'", BStats( bodypart ), amount ) );
336}
337
338function GetPlayerBodyPart( player, bodypart )
339{
340 local BP = GetSQLColumnData( QuerySQL( SQLDataBase, format( "SELECT %s FROM Bstats WHERE Name='" + player.Name.tolower() + "'", BStats( bodypart ) ) ), 0 );
341 if ( BP ) return BP;
342 else return 0;
343}
344
345function IncPlayerBodyPart( player, bodypart, amount )
346{
347 QuerySQL( SQLDataBase, format( "UPDATE Bstats SET %s=%i WHERE Name='" + player.Name.tolower() + "'", BStats( bodypart ), ( GetPlayerBodyPart( player, bodypart ) + amount ) ) );
348}
349
350function DecPlayerBodyPart( player, bodypart, amount )
351{
352 QuerySQL( SQLDataBase, format( "UPDATE Bstats SET %s=%i WHERE Name='" + player.Name.tolower() + "'", BStats( bodypart ), ( GetPlayerBodyPart( player, bodypart ) - amount ) ) );
353}
354
355function GetPlayerBStats( player )
356{
357 local bps = null;
358 for ( local b = 0; b <= 6; b++ )
359 {
360 if ( GetPlayerBodyPart( player, b ) > 0 )
361 {
362 if ( bps ) bps = bps + " " + BStats( b ) + ": [ " + GetPlayerBodyPart( player, b ) + " ]";
363 else bps = "" + BStats( b ) + ": [ " + GetPlayerBodyPart( player, b ) + " ]";
364 }
365 }
366 if ( bps ) return bps;
367 else return "Empty (Need Stats)";
368}
369
370//====================== Functions Of Wstats =============================//
371
372function SetPlayerWep( player, wepid, amount )
373{
374 QuerySQL( SQLDataBase, format( "UPDATE Wstats SET %s=%i WHERE Name='" + player.Name.tolower() + "'", WStats( wepid ), amount ) );
375}
376
377function GetPlayerWep( player, wepid )
378{
379 local WP = GetSQLColumnData( QuerySQL( SQLDataBase, format( "SELECT %s FROM Wstats WHERE Name='" + player.Name.tolower() + "'", WStats( wepid ) ) ), 0 );
380 if ( WP ) return WP;
381 else return 0;
382}
383
384function IncPlayerWep( player, wepid, amount )
385{
386 QuerySQL( SQLDataBase, format( "UPDATE Wstats SET %s=%i WHERE Name='" + player.Name.tolower() + "'", WStats( wepid ), ( GetPlayerWep( player, wepid ) + amount ) ) );
387}
388
389function DecPlayerWep( player, wepid, amount )
390{
391 QuerySQL( SQLDataBase, format( "UPDATE Wstats SET %s=%i WHERE Name='" + player.Name.tolower() + "'", WStats( wepid ), ( GetPlayerWep( player, wepid ) - amount ) ) );
392}
393
394function GetPlayerWStats( player )
395{
396 local wps = null;
397 for ( local w = 0; w <= 32; w++ )
398 {
399 if ( GetPlayerWep( player, w ) > 0 )
400 {
401 if ( wps ) wps = wps + " " + WStats( w ) + ": [ " + GetPlayerWep( player, w ) + " ] ";
402 else wps = " " + WStats( w ) + ": [ " + GetPlayerWep( player, w ) + " ] ";
403 }
404 }
405 if ( wps ) return wps;
406 else return "Empty (Need Stats)";
407}
408//===========Onplayerkill===========//
409
410function onPlayerKill( killer, player, reason, bodypart )
411{
412 if ( bodypart <= 6 ) IncPlayerBodyPart( killer, bodypart, 1 );
413 if ( reason <= 32 ) IncPlayerWep( killer, reason, 1 );
414
415 PrivMessage( "Killed " + player.Name + ", With: " + GetWeaponName( reason ) + ", Hit: " + GetBPName( bodypart ) + "", killer );
416}