· 8 years ago · Mar 18, 2018, 02:40 PM
1//==============================================================================
2//------------------------- Server Functions -----------------------------------
3//==============================================================================
4/*
5 Server: Extreme City
6 Coding by: Florenco
7*/
8
9// One equals first biggest Island/ Two equals all center Islands/ Three equals other big Island
10Player_Island <- array( GetMaxPlayers(), 0 );
11// North and South/one/two
12Player_Locator <- array( GetMaxPlayers(), 0 );
13
14// Death Spawn
15Hospital_Spawn <- array( GetMaxPlayers(), false );
16HospitalSpawnLocations <- [ Vector( -886.074,-470.278,13.1109 ), Vector( -783.051,1141.83,12.4111), Vector( 467.763,697.68,11.7033 ), Vector( -135.137,-981.579,10.4634 ) ];
17Hospital_Locator <- array( GetMaxPlayers() );
18
19District_ID <- array(120, 0);
20District_Name <- array(120, "");
21SpawnKill <- array(GetMaxPlayers(), 0 );
22
23oldGetVehicleNameFromModel <- GetVehicleNameFromModel;
24function GetVehicleNameFromModel( modelID )
25{
26 switch( modelID )
27 {
28 case 6400:
29 {
30 return "Camaro";
31 }
32 break;
33 case 6401:
34 {
35 return "Tapete";
36 }
37 break;
38 case 6402:
39 {
40 return "Cop Bike";
41 }
42 break;
43 case 6403:
44 {
45 return "Hydra";
46 }
47 break;
48 case 6404:
49 {
50 return "Saveiro Pancadao";
51 }
52 break;
53 case 6405:
54 {
55 return "Porsche Cayenne";
56 }
57 break;
58 case 6406:
59 {
60 return "BMW Z4";
61 }
62 break;
63 case 6407:
64 {
65 return "Lamborghini Aventador";
66 }
67 break;
68 case 6408:
69 {
70 return "Buggati Veyron";
71 }
72 break;
73 case 6409:
74 {
75 return "Ferrari La Ferrari";
76 }
77 break;
78 case 6410:
79 {
80 return "Bicycle";
81 }
82 break;
83 case 6411:
84 {
85 return "Batmovel";
86 }
87 break; case 6412:
88 {
89 return "Porsche 911 GT2";
90 }
91 break;
92 case 6413:
93 {
94 return "Mercedes Benz";
95 }
96 break;
97 case 6414:
98 {
99 return "Salmvan";
100 }
101 break; case 6415:
102 {
103 return "Suzuki 1000RR";
104 }
105 break;
106 case 6416:
107 {
108 return "Horse";
109 }
110 break;
111 case 6417:
112 {
113 return "Carroca";
114 }
115 break;
116 case 6455:
117 {
118 return "Mustang";
119 }
120 break;
121 case 6461:
122 {
123 return "Lamborghini Galardo";
124 }
125 break;
126
127 default:
128 {
129 return oldGetVehicleNameFromModel( modelID );
130 }
131 break;
132 };
133};
134
135//-----------------------------------------------------------------------------------------
136
137function SetPlayersDistrict(Name, player) {
138 switch(Name) {
139 /* First Island */
140 case "Vice Point": return District_ID[player.ID] = 1;
141 case "Ocean Beach": return District_ID[player.ID] = 2;
142 case "Washington Beach": return District_ID[player.ID] = 3;
143
144 /* Center Shit */
145 case "Leaf Links": return District_ID[player.ID] = 4;
146 case "Starfish Island": return District_ID[player.ID] = 5;
147 case "Prawn Island": return District_ID[player.ID] = 6;
148
149 /* Third Island */
150 case "Escobar International Airport": return District_ID[player.ID] = 7;
151 case "Downtown Vice City": return District_ID[player.ID] = 8;
152 case "Junkyard": return District_ID[player.ID] = 9;
153 case "Little Haiti": return District_ID[player.ID] = 10;
154 case "Little Havana": return District_ID[player.ID] = 11;
155 case "Little Haiti": return District_ID[player.ID] = 12;
156
157 case "Viceport": return District_ID[player.ID] = 13;
158 case "Vice City": return District_ID[player.ID] = 14;
159 default: return District_ID[player.ID] = 0;
160 }
161}
162
163//-----------------------------------------------------------------------------------------
164
165function GetPlayerIsland(player) {
166 if ( ( District_ID[player.ID] >= 1 ) && ( District_ID[player.ID] <= 3 ) ) {
167 if (NearestHospital(player.Pos) == 1 ) {
168 Player_Island[player.ID] = 1;
169 Player_Locator[player.ID] = 1;
170 }
171 if (NearestHospital(player.Pos) == 2 ) {
172 Player_Island[player.ID] = 1;
173 Player_Locator[player.ID] = 2;
174 }
175 }
176
177 if ( ( District_ID[player.ID] >= 4 ) && ( District_ID[player.ID] <= 6 ) ) {
178 if (NearestHospital(player.Pos) == 1 ) {
179 Player_Island[player.ID] = 2;
180 Player_Locator[player.ID] = 1;
181 }
182 if (NearestHospital(player.Pos) == 2 ) {
183 Player_Island[player.ID] = 2;
184 Player_Locator[player.ID] = 2;
185 }
186 }
187
188 if ( ( District_ID[player.ID] >= 7 ) && ( District_ID[player.ID] <= 12 ) ) {
189 if (NearestHospital(player.Pos) == 1 ) {
190 Player_Island[player.ID] = 3;
191 Player_Locator[player.ID] = 1;
192 }
193 if (NearestHospital(player.Pos) == 2 ) {
194 Player_Island[player.ID] = 3;
195 Player_Locator[player.ID] = 2;
196 }
197 }
198
199 if ( ( District_ID[player.ID] == 13 ) || ( District_ID[player.ID] == 0 ) || ( District_ID[player.ID] == 14 )) {
200 if ((GetIsland(player.Pos) == 1 ) && ( NearestHospital(player.Pos) == 1 )) {
201 Player_Island[player.ID] = 1;
202 Player_Locator[player.ID] = 1;
203 }
204 if ((GetIsland(player.Pos) == 1 ) && ( NearestHospital(player.Pos) == 2 )) {
205 Player_Island[player.ID] = 1;
206 Player_Locator[player.ID] = 2;
207 }
208 if ((GetIsland(player.Pos) == 2 ) && ( NearestHospital(player.Pos) == 1 )) {
209 Player_Island[player.ID] = 2;
210 Player_Locator[player.ID] = 1;
211 }
212 if ((GetIsland(player.Pos) == 2 ) && ( NearestHospital(player.Pos) == 2 )) {
213 if (player.Pos.x < -500 ) {
214 Player_Island[player.ID] = 3;
215 Player_Locator[player.ID] = 2;
216 }
217 else{
218 Player_Island[player.ID] = 2;
219 Player_Locator[player.ID] = 2;
220 }
221 }
222 if ((GetIsland(player.Pos) == 3 ) && ( NearestHospital(player.Pos) == 1 )) {
223 Player_Island[player.ID] = 3;
224 Player_Locator[player.ID] = 1;
225 }
226 if ((GetIsland(player.Pos) == 3 ) && ( NearestHospital(player.Pos) == 2 )) {
227 Player_Island[player.ID] = 3;
228 Player_Locator[player.ID] = 2;
229 }
230 }
231}
232
233//-----------------------------------------------------------------------------------------
234
235function GetNearestHospital(player) {
236 Hospital_Spawn[player.ID] = true;
237 Hospital_Locator[player.ID] = player.Pos;
238
239 District_Name[player.ID] = GetDistrictName(player.Pos.x, player.Pos.y);
240
241 SetPlayersDistrict(District_Name[player.ID], player); //Do not remove player, LOL..
242
243 GetPlayerIsland(player);
244 if ( Player_Island[player.ID] == 1 ) {
245 local
246 pos = player.Pos,
247 first_check = GetDistance(HospitalSpawnLocations[2], pos).tointeger(),
248 second_check = GetDistance(HospitalSpawnLocations[3], pos).tointeger();
249
250 if (first_check <= second_check ) Hospital_Locator[player.ID] = HospitalSpawnLocations[2];
251 else if (second_check <= first_check ) Hospital_Locator[player.ID] = HospitalSpawnLocations[3];
252 }
253
254 if ( Player_Island[player.ID] == 3 ) {
255 local
256 pos = player.Pos,
257 first_check = GetDistance(HospitalSpawnLocations[0], pos).tointeger(),
258 second_check = GetDistance(HospitalSpawnLocations[1], pos).tointeger();
259
260 if (first_check <= second_check ) Hospital_Locator[player.ID] = HospitalSpawnLocations[0];
261 else if (second_check <= first_check ) Hospital_Locator[player.ID] = HospitalSpawnLocations[1];
262 }
263
264 if ( Player_Island[player.ID] == 2 ) {
265 if (Player_Locator[player.ID] == 1 ) {
266 local
267 pos = player.Pos,
268 first_check = GetDistance(HospitalSpawnLocations[1], pos).tointeger(),
269 second_check = GetDistance(HospitalSpawnLocations[2], pos).tointeger();
270
271 if (first_check <= second_check ) Hospital_Locator[player.ID] = HospitalSpawnLocations[1];
272 else if (second_check <= first_check ) Hospital_Locator[player.ID] = HospitalSpawnLocations[2];
273 }
274
275 if (Player_Locator[player.ID] == 2 ) {
276 local
277 pos = player.Pos,
278 first_check = GetDistance(HospitalSpawnLocations[0], pos).tointeger(),
279 second_check = GetDistance(HospitalSpawnLocations[3], pos).tointeger();
280
281 if (first_check <= second_check ) Hospital_Locator[player.ID] = HospitalSpawnLocations[0];
282 else if (second_check <= first_check ) Hospital_Locator[player.ID] = HospitalSpawnLocations[3];
283 }
284 }
285}
286//-----------------------------------------------------------------------------------------
287function GetIsland(pos) {
288
289 // First Island
290 if (pos.x > -170) return 1;
291 // Third Island
292 if (pos.x < -716) return 3;
293
294 // Center island BS
295 return 2;
296}
297
298function NearestHospital(pos) {
299 if (pos.y >= 0) return 1; // north hospitals
300 if (pos.y <= 0) return 2; // south hospitals
301}
302//-----------------------------------------------------------------------------------------
303function onPlayerRequestClass( player, classID, team, skin ) {
304 if (Hospital_Spawn[player.ID] == true) { player.Spawn(); }
305}
306
307function onPlayerSpawn(player) {
308 // Spawn data
309 if (Hospital_Spawn[player.ID] == true) { player.Pos = Hospital_Locator[player.ID]; Hospital_Spawn[player.ID] = false; }
310}
311
312function onPlayerKill( killer, killed, reason, bodypart ) {
313 GetNearestHospital(killed);
314}
315function onPlayerDeath( player, reason ) {
316 GetNearestHospital(player);
317}
318
319function GetDistance(pos1, pos2)
320{
321 return sqrt(pow(pos1.x - pos2.x, 2) + pow(pos1.y - pos2.y, 2) + pow(pos1.z - pos2.z, 2));
322}
323
324function onPlayerPart(player, reason) {
325 Player_Island[player.ID] = 0;
326 Player_Locator[player.ID] = 0;
327 Hospital_Spawn[player.ID] = false;
328 Hospital_Locator[player.ID] = null;
329
330 District_ID[player.ID] = 0;
331 District_Name[player.ID] = "";
332}
333
334//-----------------------------------------------------------------------------------------
335HideMapObject(1587,-1074.912964,-276.7081299,11.05003262); //pw_presrommshad - Print Works
336HideMapObject( 379, -1721.86,-293.002, 15.1086 )
337HideMapObject( 813, -832.981,-1484.41, 12.9336 )
338HideMapObject( 832, -844.324,-1496.67, 12.7424 )
339HideMapObject( 474, -879.05,-362.036, 11.3873 )
340HideMapObject( 449, -891.555,-356.085, 11.1887 )
341HideMapObject( 474, -890.837,-349.622, 12.0561)
342HideMapObject( 474, -890.875,-361.886, 12.0561)
343HideMapObject( 474, -879.072,-350.381, 11.3873)
344HideMapObject( 474, -890.189,-331.894, 12.0561)
345HideMapObject( 474, -878.258,-330.723, 11.2693)
346HideMapObject( 449, -890.156,-325.002, 11.1887)
347HideMapObject( 474, -877.137,-318.868, 11.2693)
348HideMapObject( 474, -889.261,-317.071, 12.0561)
349HideMapObject( 474, -854.112,-321.801, 9.27197)
350HideMapObject( 474, -855.012,-351.864, 9.27197)
351HideMapObject( 474, -855.972,-388.961, 9.27197)
352HideMapObject( 474, -854.957,-436.886, 9.27197)
353function LoadPickups()
354{
355local q = QuerySQL( db, "SELECT * FROM Pickups" ), i = 0;
356while( GetSQLColumnData( q, 0 ) )
357{
358local
359ID = GetSQLColumnData( q, 0 ),
360PX = GetSQLColumnData( q, 2 ),
361PY = GetSQLColumnData( q, 3 ),
362PZ = GetSQLColumnData( q, 4 );
363
364CreatePickup(ID.tointeger(), Vector(PX.tofloat(), PY.tofloat(), PZ.tofloat()));
365GetSQLNextRow( q );
366i++;
367}
368print( "Pickups Cargados - " + i );
369}
370
371function TagEmpregos( player )
372{
373if ( ( status[ player.ID ].Policia < 1 ) && ( status[ player.ID ].Emprego < 1 ) ) return "Desempregado"
374else if ( status[ player.ID ].Policia >= 1 ) return "Policial"
375else if( status[ player.ID ].Emprego == 1 ) return "Traficante";
376else if( status[ player.ID ].Emprego == 2 ) return "Mecanico";
377else if( status[ player.ID ].Emprego == 3 ) return "Medico";
378else if( status[ player.ID ].Emprego == 4 ) return "Seguranca De Banco";
379else if( status[ player.ID ].Emprego == 5 ) return "Sorveteiro";
380else if( status[ player.ID ].Emprego == 6 ) return "Investigador";
381else if( status[ player.ID ].Emprego == 7 ) return "Distribuidor De Drogas";
382else if( status[ player.ID ].Emprego == 8 ) return "Caminhoneiro";
383else if( status[ player.ID ].Emprego == 9 ) return "Pizza-Boy";
384else if( status[ player.ID ].Emprego == 10 ) return "Frentista";
385else if( status[ player.ID ].Emprego == 11 ) return "Lixeiro";
386//VOCE QUE VAI ESCOLHER QUAIS VÃO SER OS EMPREGOS, DEPOIS QUE ESCOLHER E SO ME CONTACTAR E ME DIZER QUE EU FAÇO ALGUM SISTEMA PARA ELES!
387}
388
389function ForceSpawn(player)
390{
391 // Forced spawning
392 //player.Spawn();
393 // Forced character selection
394 //player.Select();
395}
396
397function Caminhoneiro2( player )
398{
399player = FindPlayer( player );
400if ( player )
401{
402if ( player.Vehicle && player.Vehicle.Model == 213 )
403{
404AntiBugSphere[ player.ID ] = 5;
405player.Eject();
406//player.Frozen = false;
407Carregado[ player.ID ] = false;
408I_MSG("You completed the delivery and earned 50k!!",player);
409IncCash( player, 50000 );
410Message("[#FF0000][[#7CFC00]Job[#FF0000]] [#40E0D0]Truck driver " + player.Name + " Completed a delivery!!");
411EchoMessage("9[7Trabalho9] 10Truck Driver " + player.Name + " Completed a delivery!!");
412}
413}
414}
415
416function Entrega2( player )
417{
418player = FindPlayer( player );
419if ( player )
420{
421if ( player.Vehicle && player.Vehicle.Model == 228 )
422{
423AntiBugSphere[ player.ID ] = 5;
424player.Eject();
425//player.Frozen = false;
426Carregado[ player.ID ] = false;
427I_MSG("You have completed the delivery and earned 50k!!",player);
428IncCash( player, 50000 );
429if ( player.WantedLevel < 6 ) player.WantedLevel ++;
430Message("[#FF0000][[#7CFC00]Job[#FF0000]] [#40E0D0]Drug Distributor " + player.Name + " Completed a drug delivery!!");
431EchoMessage("9[7Job9] 10Drug Distributor " + player.Name + " Completed a drug delivery!!");
432}
433}
434}
435
436function Lixeiro2( player )
437{
438player = FindPlayer( player );
439if ( player )
440{
441if ( player.Vehicle && player.Vehicle.Model == 138 )
442{
443AntiBugSphere[ player.ID ] = 5;
444player.Eject();
445//player.Frozen = false;
446Carregado[ player.ID ] = false;
447I_MSG("You collected the garbage and earned 50k!!",player);
448IncCash( player, 50000 );
449Message("[#FF0000][[#7CFC00]Job[#FF0000]] [#40E0D0]Garbageman " + player.Name + " Collected garbage in the Mansion Vice City!");
450EchoMessage("9[7Job9] 10Garbageman " + player.Name + " Collected garbage in the Mansion Vice City!");
451}
452}
453}
454
455
456function Temporizador()
457{
458for( local i = 0, player; i < GetMaxPlayers(); i++ )
459{
460player = FindPlayer( i );
461if ( player )
462{
463if ( AntiBugSphere[ player.ID ] >= 1 ) AntiBugSphere[ player.ID ] --;
464}
465}
466}
467
468function Entrega( player )
469{
470player = FindPlayer( player );
471if ( player )
472{
473if ( player.Vehicle && player.Vehicle.Model == 228 )
474{
475AntiBugSphere[ player.ID ] = 5;
476player.RestoreCamera();
477Carregado[ player.ID ] = true;
478player.Frozen = false;
479CreateMarker(player.UniqueWorld, Vector( 79.8685, 1080.55, 16.2623 ), 1, RGB(000 ,000 ,000), 0 );
480//I_MSG("Your Truck Is Now Loaded With Drugs!!",player);
481}
482}
483}
484
485function Lixeiro( player )
486{
487player = FindPlayer( player );
488if ( player )
489{
490if ( player.Vehicle && player.Vehicle.Model == 138 )
491{
492AntiBugSphere[ player.ID ] = 5;
493player.RestoreCamera();
494Carregado[ player.ID ] = true;
495player.Frozen = false;
496CreateMarker(player.UniqueWorld, Vector( 1276.32, 77.324, 11.4534 ), 1, RGB(000 ,000 ,000), 0 );
497//I_MSG("You were selected for the job. !!",player);
498}
499}
500}
501
502function Caminhoneiro( player )
503{
504player = FindPlayer( player );
505if ( player )
506{
507if ( player.Vehicle && player.Vehicle.Model == 213 )
508{
509AntiBugSphere[ player.ID ] = 5;
510player.RestoreCamera();
511Carregado[ player.ID ] = true;
512player.Frozen = false;
513CreateMarker(player.UniqueWorld, Vector( 309.361, -302.185, 11.9591 ), 1, RGB(000 ,000 ,000), 0 );
514//I_MSG("You were selected for the job.!!",player);
515}
516}
517}
518
519function CarregarCasas()
520{
521local i = 0, id, nome, preco, dono, compart, x, y, z;
522local q = QuerySQL( db, "SELECT * FROM Casas" );
523while ( GetSQLColumnData( q, 0 ) != null )
524{
525nome = GetSQLColumnData( q, 1 );
526preco = GetSQLColumnData( q, 2 );
527dono = GetSQLColumnData( q, 3 );
528compart = GetSQLColumnData( q, 4 );
529x = GetSQLColumnData( q, 5 );
530y = GetSQLColumnData( q, 6 );
531z = GetSQLColumnData( q, 7 );
532id = CreatePickup( 407, 1, 1, x, y, z, 255, true ).ID;
533Casa[ id ] = PropStats();
534Casa[ id ].ID = GetSQLColumnData( q, 0 );
535Casa[ id ].Nome = nome;
536Casa[ id ].Preco = preco;
537Casa[ id ].Dono = dono;
538Casa[ id ].Compart = compart;
539GetSQLNextRow( q );
540i++;
541}
542FreeSQLQuery( q );
543print( "[Cargado] Casas del servidor - " + i );
544}
545
546function CountProps()
547{
548local c = 0;
549for( local i = 0, pickup; i < GetPickupCount(); i++ )
550{
551pickup = FindPickup( i );
552if ( pickup && pickup.Model == 407 ) c ++;
553}
554return c;
555}
556
557function PropNameExist( nome )
558{
559local result = false;
560for( local i = 0, pickup; i < GetPickupCount(); i++ )
561{
562pickup = FindPickup( i );
563if ( pickup && Casa[ pickup.ID ] != null )
564{
565if ( Casa[ pickup.ID ].Nome == nome ) result = true;
566}
567}
568return result;
569}
570
571function FindProp( id )
572{
573if ( id < 0 ) return false;
574else if ( id > 1000 ) return false;
575else if ( Casa[ id ] == null ) return false;
576else return true;
577}
578
579function CarregarObjetos()
580{
581local i = 0, obj, modelo, world, pos, alpha, rot;
582local q = QuerySQL( db, "SELECT * FROM Objectss" );
583while ( GetSQLColumnData( q, 0 ) != null )
584{
585modelo = GetSQLColumnData( q, 0 );
586world = GetSQLColumnData( q, 1 );
587pos = Vector( GetSQLColumnData( q, 2 ), GetSQLColumnData( q, 3 ), GetSQLColumnData( q, 4 ) );
588alpha = GetSQLColumnData( q, 5 );
589rot = Vector( GetSQLColumnData( q, 6 ), GetSQLColumnData( q, 7 ), GetSQLColumnData( q, 8 ) );
590obj = CreateObject( modelo, world, pos, alpha );
591obj.RotateToEuler( rot, 0 );
592GetSQLNextRow( q );
593i++;
594}
595FreeSQLQuery( q );
596print( "Cargados objetos: "+ CountObjectss() );
597}
598
599function DeathWindow(leftName, reason, rightName)
600{
601 image <- "" + reason + ".png";
602 if (TextInfo[0])
603 {
604 TextInfo[0].Delete();
605 }
606 if(SpriteInfo[0])
607 {
608 SpriteInfo[0].Delete();
609 }
610 if (TextInfo2[0])
611 {
612 TextInfo2[0].Delete();
613 }
614 for (local i=0; i<MaxLines-1; i++)
615 {
616 if(TextLengh[i+1])
617 {
618 TextLengh[i] = TextLengh[i+1];
619 }
620 if (TextInfo[i+1])
621 {
622 TextInfo[i] = TextInfo[i+1];
623 TextInfo[i].SetPosForAll(PosX-TextLengh[i], PosY-(i)*LineGap);
624 }
625
626 if(SpriteInfo[i+1])
627 {
628 SpriteInfo[i] = SpriteInfo[i+1];
629 SpriteInfo[i].SetPosForAll(-230, PosY3-(i)*LineGap);
630 }
631
632 if(TextInfo2[i+1])
633 {
634 TextInfo2[i] = TextInfo2[i+1];
635 TextInfo2[i].SetPosForAll(PosX2, PosY-(i)*LineGap);
636 }
637 }
638
639 MinusPosX <- 0;
640
641 if(leftName.len() == 1)
642 {
643 MinusPosX <- 8;
644 }
645 else
646 {
647 MinusPosX <- leftName.len()*8;
648 }
649
650 TextLengh[MaxLines-1] = MinusPosX;
651 TextInfo[MaxLines-1] = CreateTextdraw(leftName, PosX-MinusPosX, PosY-(MaxLines-1)*LineGap, 0xFFB0B0B0);
652 TextInfo[MaxLines-1].ShowForAll();
653 SpriteInfo[MaxLines-1] = CreateSprite(image, -230, PosY3-(MaxLines-1)*LineGap, 0, 0, 0, 200);
654 SpriteInfo[MaxLines-1].ShowForAll();
655 TextInfo2[MaxLines-1] = CreateTextdraw(rightName, PosX2, PosY-(MaxLines-1)*LineGap, 0xFFB0B0B0);
656 TextInfo2[MaxLines-1].ShowForAll();
657 return 1;
658}
659
660function GetVehicleType( model )
661{
662 // by Force
663 // Returns: Car / Bike / Heli / Plane / Boat / RC
664 switch ( model ) {
665 case 136:
666 case 160:
667 case 176:
668 case 182:
669 case 183:
670 case 184:
671 case 190:
672 case 202:
673 case 203:
674 case 214:
675 case 223:
676 return "Boat";
677 case 155:
678 case 165:
679 case 217:
680 case 218:
681 case 227:
682 return "Heli";
683 case 166:
684 case 178:
685 case 191:
686 case 192:
687 case 193:
688 case 198:
689 return "Bike";
690 case 171:
691 case 194:
692 case 195:
693 case 231:
694 return "RC";
695 case 180:
696 case 181:
697 return "Plane";
698 default:
699 return "Car";
700 }
701}
702
703function ActivateNOS( vehicle )
704{
705
706}
707
708function DeactivateNOS( vehicle )
709{
710
711}
712
713function DecreaseNOS( vehID )
714{
715
716}
717
718function nosLoadSprites()
719{
720
721}
722
723function nosShowBar( player )
724{
725
726}
727
728function nosHideBar( player )
729{
730
731}
732
733function IsInRangeOfPoint( a, range, x, y, z )
734{
735local px = a.Pos.x, py = a.Pos.y, pz = a.Pos.z;
736px -= x, py -= y, pz -= z;
737return ( ( px * px ) + ( py * py ) + ( pz * pz ) ) < ( range * range );
738}
739
740function IsFloat( value )
741{
742if ( typeof value == "float" ) return true;
743try
744{
745if ( value.find( "." ) != null )
746{
747value = value.tofloat();
748return true;
749}
750else return false;
751}
752catch(e) return false;
753}
754
755function MoverPortao( player )
756{
757if ( player.IsSpawned )
758{
759for ( local i = 0; i < Portao.len(); i++ )
760{
761local portao = Portao[i].Objeto;
762if ( IsInRangeOfPoint( player, 10, Portao[i].Pos1.x, Portao[i].Pos1.y, Portao[i].Pos1.z ) )
763{
764if ( Casa[ Portao[i].ID ].Dono == player.Name || Casa[ Portao[i].ID ].Compart == player.Name )
765{
766if ( Portao[i].Trancado == true )
767{
768PlaySound( player.World, 145, player.Pos );
769portao.MoveTo( Portao[i].Pos2, 2800 );
770portao.RotateToEuler( Portao[i].Rot2, 2800 );
771Portao[i].Trancado = false;
772}
773else if ( Portao[i].Trancado == false )
774{
775PlaySound( player.World, 145, player.Pos );
776portao.MoveTo( Portao[i].Pos1, 2800 );
777portao.RotateToEuler( Portao[i].Rot1, 2800 );
778Portao[i].Trancado = true;
779}
780}
781}
782}
783}
784}
785
786function CarregarPortoes()
787{
788local i = 0, obj, id, modelo, pos1, rot1, pos2, rot2;
789local q = QuerySQL( db, "SELECT * FROM Portoes" );
790while ( GetSQLColumnData( q, 0 ) != null )
791{
792id = GetSQLColumnData( q, 0 );
793modelo = GetSQLColumnData( q, 1 );
794pos1 = split( GetSQLColumnData( q, 2 ), " " );
795rot1 = split( GetSQLColumnData( q, 3 ), " " );
796pos2 = split( GetSQLColumnData( q, 4 ), " " );
797rot2 = split( GetSQLColumnData( q, 5 ), " " );
798obj = CreateObject( modelo, 1, Vector( pos1[0].tofloat(), pos1[1].tofloat(), pos1[2].tofloat() ), 255 );
799obj.RotateToEuler( Vector( rot1[0].tofloat(), rot1[1].tofloat(), rot1[2].tofloat() ), 0 );
800Portao.push({
801Objeto = obj,
802ID = id,
803Pos1 = Vector( pos1[0].tofloat(), pos1[1].tofloat(), pos1[2].tofloat() ),
804Rot1 = Vector( rot1[0].tofloat(), rot1[1].tofloat(), rot1[2].tofloat() ),
805Pos2 = Vector( pos2[0].tofloat(), pos2[1].tofloat(), pos2[2].tofloat() ),
806Rot2 = Vector( rot2[0].tofloat(), rot2[1].tofloat(), rot2[2].tofloat() ),
807Trancado = true
808});
809GetSQLNextRow( q );
810i++;
811}
812FreeSQLQuery( q );
813print( "[Cargados] Portones del servidor - " + i );
814}
815
816function rotateRight(val, sbits)
817{
818 return (val >> sbits) | (val << (0x20 - sbits));
819}
820
821function topkiller()
822{
823local
824query = "SELECT Nome, Matou FROM Contas ORDER BY Matou DESC LIMIT 5", //Top 5
825q,
826Nome1, Nome2, Nome3, Nome4, Nome5,
827Matou1, Matou2, Matou3, Matou4, Matou5, i = 1;
828q = QuerySQL( db, query );
829while( GetSQLColumnData( q, 0 ) )
830{
831switch(i)
832{
833case 1:
834Nome1 = GetSQLColumnData( q, 0 );
835Matou1 = GetSQLColumnData( q, 1 );
836break;
837case 2:
838Nome2 = GetSQLColumnData( q, 0 );
839Matou2 = GetSQLColumnData( q, 1 );
840break;
841case 3:
842Nome3 = GetSQLColumnData( q, 0 );
843Matou3 = GetSQLColumnData( q, 1 );
844break;
845case 4:
846Nome4 = GetSQLColumnData( q, 0 );
847Matou4 = GetSQLColumnData( q, 1 );
848break;
849case 5:
850Nome5 = GetSQLColumnData( q, 0 );
851Matou5 = GetSQLColumnData( q, 1 );
852break;
853}
854GetSQLNextRow( q );
855i++;
856}
857FreeSQLQuery(q);
858MSG(" Top 5 Mejores Asesinos: " + Nome1 + " Mato a: " + Matou1 + ", " + Nome2 + " Mato a: " + Matou2 + ", " + Nome3 + " Mato a: " + Matou3 + ", " + Nome4 + " Mato a: " + Matou4 + ", " + Nome5 + " Mato a: " + Matou5 + "");
859}
860
861function PuxarModelo( modelo )
862{
863if ( modelo >= 6400 ) return VeiculosMods( modelo );
864else return GetVehicleNameFromModel( modelo );
865}
866
867function VeiculosMods( modelo )
868{
869if ( modelo == 6400 ) return "My Vehiculo MOD 1";
870else if ( modelo == 6401 ) return "Mi Vehiculo MOD 2";
871else if ( modelo == 6402 ) return "Mi Vehiculo MOD 3";
872else return "Desconocido";
873}
874
875function DecFuel()
876{
877for( local i = 0, player; i < GetMaxPlayers(); i++ )
878{
879player = FindPlayer( i );
880if ( player )
881{
882local vehicle = player.Vehicle;
883if ( vehicle && player.VehicleSlot == 0 )
884{
885if ( Fuel[ vehicle.ID ] >= 1 )
886{
887Fuel[ vehicle.ID ] --;
888Announce( "~b~Fuel: ~w~" + Fuel[ vehicle.ID ], player, 4 );
889if ( Fuel[ vehicle.ID ] == 0 )
890{
891vehicle.Speed = Vector( 0, 0, 0 );
892if ( vehicle.GetHandlingData( 13 ) != 0 ) vehicle.SetHandlingData( 13, 0 );
893if ( vehicle.GetHandlingData( 14 ) != 0 ) vehicle.SetHandlingData( 14, 0 );
894}
895}
896}
897}
898}
899}
900
901function CheckFuel( player, vehicle, door )
902{
903Announce( "~b~FUEL: ~w~" + Fuel[ vehicle.ID ], player, 4 );
904if ( Fuel[ vehicle.ID ] == 0 && door == 0 )
905{
906vehicle.Speed = Vector( 0, 0, 0 );
907if ( vehicle.GetHandlingData( 13 ) != 0 ) vehicle.SetHandlingData( 13, 0 );
908if ( vehicle.GetHandlingData( 14 ) != 0 ) vehicle.SetHandlingData( 14, 0 );
909}
910}
911
912function GetDistance(pos1, pos2)
913{
914 return sqrt(pow(pos1.x - pos2.x, 2) + pow(pos1.y - pos2.y, 2) + pow(pos1.z - pos2.z, 2));
915}
916
917function Arrest(player,target)
918{
919 if (!target) {
920 E_MSG("Jugador desconocido",player)
921 return false;
922 }
923 if (target.WantedLevel <1) {
924 I_MSG("This player is not wanted",player)
925 return false;
926 }
927 if (target.WantedLevel > 0) {
928 local distance = GetDistance(player.Pos,target.Pos)
929 if ( distance < 5 ) {
930 I_MSG("[#ffffff]You have Arrested "+target+" , you won $5000",player)
931 player.Cash += 5000;
932 target.Pos = Vector(386.59, -502.732, 9.39561)
933 target.WantedLevel = 0
934 Message("[#000099]Police[#ffffff] "+player+ " [#00ffff]has arrested[#ff0000] "+target)
935 }
936 }
937}
938
939function arresttime(p)
940{
941local player = FindPlayer(p);
942if (plr)
943plr.Pos = Vector(394.654, -495.409, 10.8694);
944MessagePlayer( RED+"**You have been released from jail",plr );
945}
946
947function Velocimetro()
948{
949if ( GetPlayers() >= 1 )
950{
951 for ( local i = 0; i < GetMaxPlayers(); i++ )
952 {
953 local player = FindPlayer( i );
954 if ( player )
955 {
956 if ( player.IsSpawned && player.Vehicle )
957 {
958 local vehicle = player.Vehicle;
959 local Speed = sqrt(vehicle.Speed.x*vehicle.Speed.x + vehicle.Speed.y * vehicle.Speed.y + vehicle.Speed.z * vehicle.Speed.z) * 50 * 3.6;
960 local output = round(Speed, 0);
961 Announce("\x10 \x10 \x10 \x20 \x20 \x20 \x20 \x20 \x20 \x20 \x20 ~w~Kph: ~o~" + output, player, 1 );
962}
963}
964}
965}
966}
967
968function round(value, precision) {
969 local factor = pow(10.0, precision);
970 return floor(value * factor + 0.5) / factor;
971}
972/*
973
974function onKeyDown(player,key)
975{
976if ( key == L )
977{
978I_MSG("[#FF9933]Ahorita no hay un evento de esquivar creado.",player);
979}
980else if ( key == P )
981{
982MoverPortao( player );
983}
984else if ( key == I )
985{
986I_MSG("[#FF9933]Ahorita no hay un evento de agilidad creado.",player);
987}
988}
989*/
990function AddSkin( player, skin )
991{
992if ( ( skin ) && IsNum( skin ) ) skin = skin.tointeger();
993else if ( skin ) skin = GetSkinID( skin );
994QuerySQL( db, "DELETE FROM Skins WHERE Name='" + player.Name + "'" );
995QuerySQL( db, "INSERT INTO Skins ( Nome, Skin ) VALUES ( '" + player.Name + "', '" + skin + "')" );
996}
997
998function DelSkin( player )
999{
1000QuerySQL( db, "DELETE FROM Skins WHERE Nome='" + player.Name + "'" );
1001}
1002
1003function skin( player )
1004{
1005local skin = GetSQLColumnData( QuerySQL( db, "SELECT Skin FROM Skins WHERE Nome='" + player.Name + "'" ), 0 );
1006if ( skin ) return skin;
1007else return 0;
1008}
1009
1010function LoadSkin( player )
1011{
1012if ( skin(player) == 0 ) player.Skin = 0 ;
1013else if ( skin(player) == 1 ) QuerySQL( db, "DELETE FROM Skins WHERE Nome='" + player.Name + "'" );
1014else if ( skin(player) == 2 ) QuerySQL( db, "DELETE FROM Skins WHERE Nome='" + player.Name + "'" );
1015else if ( skin(player) == 3 ) QuerySQL( db, "DELETE FROM Skins WHERE Nome='" + player.Name + "'" );
1016else if ( skin(player) == 4 ) QuerySQL( db, "DELETE FROM Skins WHERE Nome='" + player.Name + "'" );
1017else if ( skin(player) == 5 ) player.Skin = 5 ;
1018else if ( skin(player) == 6 ) player.Skin = 6 ;
1019else if ( skin(player) == 7 ) player.Skin = 7 ;
1020else if ( skin(player) == 8 ) QuerySQL( db, "DELETE FROM Skins WHERE Nome='" + player.Name + "'" );
1021else if ( skin(player) == 9 ) player.Skin = 9 ;
1022else if ( skin(player) == 10 ) player.Skin = 10 ;
1023else if ( skin(player) == 11 ) player.Skin = 11 ;
1024else if ( skin(player) == 12 ) player.Skin = 12 ;
1025else if ( skin(player) == 13 ) player.Skin = 13 ;
1026else if ( skin(player) == 14 ) player.Skin = 14 ;
1027else if ( skin(player) == 15 ) player.Skin = 15 ;
1028else if ( skin(player) == 16 ) player.Skin = 16 ;
1029else if ( skin(player) == 17 ) player.Skin = 17 ;
1030else if ( skin(player) == 18 ) player.Skin = 18 ;
1031else if ( skin(player) == 19 ) player.Skin = 19 ;
1032else if ( skin(player) == 20 ) player.Skin = 20 ;
1033else if ( skin(player) == 21 ) player.Skin = 21 ;
1034else if ( skin(player) == 22 ) player.Skin = 22 ;
1035else if ( skin(player) == 23 ) player.Skin = 23 ;
1036else if ( skin(player) == 24 ) player.Skin = 24 ;
1037else if ( skin(player) == 25 ) player.Skin = 25 ;
1038else if ( skin(player) == 26 ) player.Skin = 26 ;
1039else if ( skin(player) == 27 ) player.Skin = 27 ;
1040else if ( skin(player) == 28 ) player.Skin = 28 ;
1041else if ( skin(player) == 29 ) player.Skin = 29 ;
1042else if ( skin(player) == 30 ) player.Skin = 30 ;
1043else if ( skin(player) == 31 ) player.Skin = 31 ;
1044else if ( skin(player) == 32 ) player.Skin = 32 ;
1045else if ( skin(player) == 33 ) player.Skin = 33 ;
1046else if ( skin(player) == 34 ) player.Skin = 34 ;
1047else if ( skin(player) == 35 ) player.Skin = 35 ;
1048else if ( skin(player) == 36 ) player.Skin = 36 ;
1049else if ( skin(player) == 37 ) player.Skin = 37 ;
1050else if ( skin(player) == 38 ) player.Skin = 38 ;
1051else if ( skin(player) == 39 ) player.Skin = 39 ;
1052else if ( skin(player) == 40 ) player.Skin = 40 ;
1053else if ( skin(player) == 41 ) player.Skin = 41 ;
1054else if ( skin(player) == 42 ) player.Skin = 42 ;
1055else if ( skin(player) == 43 ) player.Skin = 43 ;
1056else if ( skin(player) == 44 ) player.Skin = 44 ;
1057else if ( skin(player) == 45 ) player.Skin = 45 ;
1058else if ( skin(player) == 46 ) player.Skin = 46 ;
1059else if ( skin(player) == 47 ) player.Skin = 47 ;
1060else if ( skin(player) == 48 ) player.Skin = 48 ;
1061else if ( skin(player) == 49 ) player.Skin = 49 ;
1062else if ( skin(player) == 50 ) player.Skin = 50 ;
1063else if ( skin(player) == 51 ) player.Skin = 51 ;
1064else if ( skin(player) == 52 ) player.Skin = 52 ;
1065else if ( skin(player) == 53 ) player.Skin = 53 ;
1066else if ( skin(player) == 54 ) player.Skin = 54 ;
1067else if ( skin(player) == 55 ) player.Skin = 55 ;
1068else if ( skin(player) == 56 ) player.Skin = 56 ;
1069else if ( skin(player) == 57 ) player.Skin = 57 ;
1070else if ( skin(player) == 58 ) player.Skin = 58 ;
1071else if ( skin(player) == 59 ) player.Skin = 59 ;
1072else if ( skin(player) == 60 ) player.Skin = 60 ;
1073else if ( skin(player) == 61 ) player.Skin = 61 ;
1074else if ( skin(player) == 62 ) player.Skin = 62 ;
1075else if ( skin(player) == 63 ) player.Skin = 63 ;
1076else if ( skin(player) == 64 ) player.Skin = 64 ;
1077else if ( skin(player) == 65 ) player.Skin = 65 ;
1078else if ( skin(player) == 66 ) player.Skin = 66 ;
1079else if ( skin(player) == 67 ) player.Skin = 67 ;
1080else if ( skin(player) == 68 ) player.Skin = 68 ;
1081else if ( skin(player) == 69 ) player.Skin = 69 ;
1082else if ( skin(player) == 70 ) player.Skin = 70 ;
1083else if ( skin(player) == 71 ) player.Skin = 71 ;
1084else if ( skin(player) == 72 ) player.Skin = 72 ;
1085else if ( skin(player) == 73 ) player.Skin = 73 ;
1086else if ( skin(player) == 74 ) player.Skin = 74 ;
1087else if ( skin(player) == 75 ) player.Skin = 75 ;
1088else if ( skin(player) == 76 ) player.Skin = 76 ;
1089else if ( skin(player) == 77 ) player.Skin = 77 ;
1090else if ( skin(player) == 78 ) player.Skin = 78 ;
1091else if ( skin(player) == 79 ) player.Skin = 79 ;
1092else if ( skin(player) == 80 ) player.Skin = 80 ;
1093else if ( skin(player) == 81 ) player.Skin = 81 ;
1094else if ( skin(player) == 82 ) player.Skin = 82 ;
1095else if ( skin(player) == 83 ) player.Skin = 83 ;
1096else if ( skin(player) == 84 ) player.Skin = 84 ;
1097else if ( skin(player) == 85 ) player.Skin = 85 ;
1098else if ( skin(player) == 86 ) player.Skin = 86 ;
1099else if ( skin(player) == 87 ) player.Skin = 87 ;
1100else if ( skin(player) == 88 ) player.Skin = 88 ;
1101else if ( skin(player) == 89 ) player.Skin = 89 ;
1102else if ( skin(player) == 90 ) player.Skin = 90 ;
1103else if ( skin(player) == 91 ) player.Skin = 91 ;
1104else if ( skin(player) == 92 ) player.Skin = 92 ;
1105else if ( skin(player) == 93 ) player.Skin = 93 ;
1106else if ( skin(player) == 94 ) player.Skin = 94 ;
1107else if ( skin(player) == 95 ) player.Skin = 95 ;
1108else if ( skin(player) == 96 ) player.Skin = 96 ;
1109else if ( skin(player) == 97 ) QuerySQL( db, "DELETE FROM Skins WHERE Nome='" + player.Name + "'" );
1110else if ( skin(player) == 98 ) QuerySQL( db, "DELETE FROM Skins WHERE Nome='" + player.Name + "'" );
1111else if ( skin(player) == 99 ) QuerySQL( db, "DELETE FROM Skins WHERE Nome='" + player.Name + "'" );
1112else if ( skin(player) == 100 ) QuerySQL( db, "DELETE FROM Skins WHERE Nome='" + player.Name + "'" );
1113else if ( skin(player) == 101 ) QuerySQL( db, "DELETE FROM Skins WHERE Nome='" + player.Name + "'" );
1114else if ( skin(player) == 102 ) QuerySQL( db, "DELETE FROM Skins WHERE Nome='" + player.Name + "'" );
1115else if ( skin(player) == 103 ) player.Skin = 103 ;
1116else if ( skin(player) == 104 ) player.Skin = 104 ;
1117else if ( skin(player) == 105 ) player.Skin = 105 ;
1118else if ( skin(player) == 106 ) player.Skin = 106 ;
1119else if ( skin(player) == 107 ) player.Skin = 107 ;
1120else if ( skin(player) == 108 ) player.Skin = 108 ;
1121else if ( skin(player) == 109 ) player.Skin = 109 ;
1122else if ( skin(player) == 110 ) player.Skin = 110 ;
1123else if ( skin(player) == 111 ) player.Skin = 111 ;
1124else if ( skin(player) == 112 ) player.Skin = 112 ;
1125else if ( skin(player) == 113 ) player.Skin = 113 ;
1126else if ( skin(player) == 114 ) player.Skin = 114 ;
1127else if ( skin(player) == 115 ) player.Skin = 115 ;
1128else if ( skin(player) == 116 ) player.Skin = 116 ;
1129else if ( skin(player) == 117 ) player.Skin = 117 ;
1130else if ( skin(player) == 118 ) player.Skin = 118 ;
1131else if ( skin(player) == 119 ) player.Skin = 119 ;
1132else if ( skin(player) == 120 ) player.Skin = 120 ;
1133else if ( skin(player) == 121 ) player.Skin = 121 ;
1134else if ( skin(player) == 122 ) player.Skin = 122 ;
1135else if ( skin(player) == 123 ) player.Skin = 123 ;
1136else if ( skin(player) == 124 ) player.Skin = 124 ;
1137else if ( skin(player) == 125 ) player.Skin = 125 ;
1138else if ( skin(player) == 126 ) player.Skin = 126 ;
1139else if ( skin(player) == 127 ) player.Skin = 127 ;
1140else if ( skin(player) == 128 ) player.Skin = 128 ;
1141else if ( skin(player) == 129 ) player.Skin = 129 ;
1142else if ( skin(player) == 130 ) player.Skin = 130 ;
1143else if ( skin(player) == 131 ) player.Skin = 131 ;
1144else if ( skin(player) == 132 ) player.Skin = 132 ;
1145else if ( skin(player) == 133 ) player.Skin = 133 ;
1146else if ( skin(player) == 134 ) player.Skin = 134 ;
1147else if ( skin(player) == 135 ) player.Skin = 135 ;
1148else if ( skin(player) == 136 ) player.Skin = 136 ;
1149else if ( skin(player) == 137 ) player.Skin = 137 ;
1150else if ( skin(player) == 138 ) player.Skin = 138 ;
1151else if ( skin(player) == 139 ) player.Skin = 139 ;
1152else if ( skin(player) == 140 ) player.Skin = 140 ;
1153else if ( skin(player) == 141 ) player.Skin = 141 ;
1154else if ( skin(player) == 142 ) player.Skin = 142 ;
1155else if ( skin(player) == 143 ) player.Skin = 143 ;
1156else if ( skin(player) == 144 ) player.Skin = 144 ;
1157else if ( skin(player) == 145 ) player.Skin = 145 ;
1158else if ( skin(player) == 146 ) player.Skin = 146 ;
1159else if ( skin(player) == 147 ) player.Skin = 147 ;
1160else if ( skin(player) == 148 ) player.Skin = 148 ;
1161else if ( skin(player) == 149 ) player.Skin = 149 ;
1162else if ( skin(player) == 150 ) player.Skin = 150 ;
1163else if ( skin(player) == 151 ) player.Skin = 151 ;
1164else if ( skin(player) == 152 ) player.Skin = 152 ;
1165else if ( skin(player) == 153 ) player.Skin = 153 ;
1166else if ( skin(player) == 154 ) player.Skin = 154 ;
1167else if ( skin(player) == 155 ) player.Skin = 155 ;
1168else if ( skin(player) == 156 ) player.Skin = 156 ;
1169else if ( skin(player) == 157 ) player.Skin = 157 ;
1170else if ( skin(player) == 158 ) player.Skin = 158 ;
1171else if ( skin(player) == 159 ) player.Skin = 159 ;
1172else if ( skin(player) == 160 ) player.Skin = 160 ;
1173else if ( skin(player) == 161 ) player.Skin = 161 ;
1174else if ( skin(player) == 162 ) player.Skin = 162 ;
1175else if ( skin(player) == 163 ) player.Skin = 163 ;
1176else if ( skin(player) == 164 ) player.Skin = 164 ;
1177else if ( skin(player) == 165 ) player.Skin = 165 ;
1178else if ( skin(player) == 166 ) player.Skin = 166 ;
1179else if ( skin(player) == 167 ) player.Skin = 167 ;
1180else if ( skin(player) == 168 ) player.Skin = 168 ;
1181else if ( skin(player) == 169 ) player.Skin = 169 ;
1182else if ( skin(player) == 170 ) player.Skin = 170 ;
1183else if ( skin(player) == 171 ) player.Skin = 171 ;
1184else if ( skin(player) == 172 ) player.Skin = 172 ;
1185else if ( skin(player) == 173 ) player.Skin = 173 ;
1186else if ( skin(player) == 174 ) player.Skin = 174 ;
1187else if ( skin(player) == 175 ) player.Skin = 175 ;
1188else if ( skin(player) == 176 ) player.Skin = 176 ;
1189else if ( skin(player) == 177 ) player.Skin = 177 ;
1190else if ( skin(player) == 178 ) player.Skin = 178 ;
1191else if ( skin(player) == 179 ) player.Skin = 179 ;
1192else if ( skin(player) == 180 ) player.Skin = 180 ;
1193else if ( skin(player) == 181 ) player.Skin = 181 ;
1194else if ( skin(player) == 182 ) player.Skin = 182 ;
1195else if ( skin(player) == 183 ) player.Skin = 183 ;
1196else if ( skin(player) == 184 ) player.Skin = 184 ;
1197else if ( skin(player) == 185 ) player.Skin = 185 ;
1198else if ( skin(player) == 186 ) player.Skin = 186 ;
1199else if ( skin(player) == 187 ) player.Skin = 187 ;
1200else if ( skin(player) == 188 ) player.Skin = 188 ;
1201else if ( skin(player) == 189 ) player.Skin = 189 ;
1202else if ( skin(player) == 190 ) player.Skin = 190 ;
1203else if ( skin(player) == 191 ) player.Skin = 191 ;
1204else if ( skin(player) == 192 ) player.Skin = 192 ;
1205else if ( skin(player) == 193 ) player.Skin = 193 ;
1206else if ( skin(player) == 194 ) player.Skin = 194 ;
1207else if ( skin(player) == 195 ) player.Skin = 195 ;
1208else if ( skin(player) == 196 ) QuerySQL( db, "DELETE FROM Skins WHERE Nome='" + player.Name + "'" );
1209else if ( skin(player) == 197 ) QuerySQL( db, "DELETE FROM Skins WHERE Nome='" + player.Name + "'" );
1210else if ( skin(player) == 198 ) QuerySQL( db, "DELETE FROM Skins WHERE Nome='" + player.Name + "'" );
1211else if ( skin(player) == 199 ) QuerySQL( db, "DELETE FROM Skins WHERE Nome='" + player.Name + "'" );
1212else if ( skin(player) == 200 ) player.Skin = 200 ;
1213else if ( skin(player) == 201 ) player.Skin = 201 ;
1214else if ( skin(player) == 202 ) player.Skin = 202 ;
1215else if ( skin(player) == 203 ) player.Skin = 203 ;
1216else if ( skin(player) == 204 ) player.Skin = 204 ;
1217else if ( skin(player) == 205 ) player.Skin = 205 ;
1218else if ( skin(player) == 206 ) player.Skin = 206 ;
1219else if ( skin(player) == 207 ) player.Skin = 207 ;
1220else if ( skin(player) == 208 ) player.Skin = 208 ;
1221else if ( skin(player) == 209 ) player.Skin = 209 ;
1222else if ( skin(player) == 210 ) player.Skin = 210 ;
1223else if ( skin(player) == 211 ) player.Skin = 211 ;
1224else if ( skin(player) == 212 ) player.Skin = 212 ;
1225else if ( skin(player) == 213 ) player.Skin = 213 ;
1226else if ( skin(player) == 214 ) player.Skin = 214 ;
1227else if ( skin(player) == 215 ) player.Skin = 215 ;
1228else if ( skin(player) == 216 ) player.Skin = 216 ;
1229else if ( skin(player) == 217 ) player.Skin = 217 ;
1230else if ( skin(player) == 218 ) player.Skin = 218 ;
1231}
1232
1233function CountObjectss()
1234{
1235try
1236 {
1237 local a = 0, q = QuerySQL( db, "SELECT * FROM Objectss" );
1238 while ( GetSQLColumnData( q, 0 ) )
1239 {
1240 a ++;
1241 GetSQLNextRow( q );
1242 }
1243 return a;
1244 FreeSQLQuery( q );
1245 }
1246 catch(e) print( "[Error] CountObjects - " + e );
1247}
1248
1249function RespawnVehicles( rtime = 0 ){
1250//Loop over all the vehicles.
1251for( local veh, i = 1; i <= 1000; i++ ){
1252veh = FindVehicle(i);
1253if( !veh ) continue;
1254if( rtime == 0 ) veh.Respawn();
1255else veh.RespawnTimer = rtime; //Time in ms.
1256}
1257}
1258
1259function onPickupPickedUp( player, pickup )
1260{
1261 if ( !player.Vehicle && pickup.Model == 407 )
1262 {
1263 if ( Casa[ pickup.ID ] != null )
1264 {
1265 pickup.Timer = 3000;
1266 MessagePlayer( "[#EEC900]Name of Prop: [#00FFFF]" + Casa[ pickup.ID ].Nome + "[#EEC900] - ID: [#00FFFF]" + pickup.ID + "[#EEC900] - Owner: [#00FFFF]" + Casa[ pickup.ID ].Dono + "[#EEC900].", player );
1267 MessagePlayer( "[#EEC900]Price: [#00FFFF]$" + Casa[ pickup.ID ].Preco + "[#EEC900] - Shared with: [#00FFFF]" + Casa[ pickup.ID ].Compart + "[#EEC900].", player );
1268 }
1269 }
1270 if ( pickup.Model == 345 )
1271 {
1272 MSG( player.Name + " found the surprise box! Reward: $400000!" );
1273 IncCash( player, 400000 );
1274 pickup.Remove();
1275 BoxActive = false;
1276 }
1277if ( pickup.Model == 407 )
1278{
1279if ( Casa[ pickup.ID ] != null )
1280{
1281pickup.Timer = 3000;
1282
1283}
1284}
1285else if ( pickup.Model == 408 )
1286{
1287local robbedcash = random( 2000, 5000);
1288Message("[#ff0000]"+ player.Name +" [#00ffff]robbed [#cccccc]$" + robbedcash + " [#cc00cc]on[#00cc00] "+ GetDistrictName( player.Pos.x, player.Pos.y ) +"");
1289IncCash( player, robbedcash );
1290player.WantedLevel++;
1291pickup.RespawnTime = 15000;
1292}
1293else if ( pickup.Model == 356 )
1294{
1295local vehicle = player.Vehicle;
1296if ( !vehicle ) I_MSG( "You need to be in your vehicle.", player );
1297else if ( Fuel[ vehicle.ID ] >= 51 ) I_MSG( "The vehicle does not need gas.", player );
1298else if ( player.Cash <= 2000 ) E_MSG( "You need 10,000.", player );
1299else
1300{
1301Fuel[ vehicle.ID ] = 100;
1302player.Cash -= 10000;
1303I_MSG( "Recharged petrol!", player );
1304if ( vehicle.GetHandlingData( 13 ) == 0 ) vehicle.ResetHandlingData( 13 );
1305if ( vehicle.GetHandlingData( 14 ) == 0 ) vehicle.ResetHandlingData( 14 );
1306Announce("\x10 \x10 \x10 \x20 \x20 \x20 \x20 \x20 \x20 \x20 \x20 ~w~Gasolina: ~w~" + Fuel[ vehicle.ID ], player, 5 );
1307pickup.RespawnTime = 10000;
1308}
1309}
1310else if ( pickup.Model == 406 )
1311{
1312player.Pos = Vector( -713.673 1298.67 11.7673 );
1313I_MSG( "Para salir interior use /casa <ID>", player );
1314}
1315else if ( pickup.Model == 409 )
1316{
1317I_MSG("Now you work as a police officer." player );
1318player.Skin = ( 1 );
1319}
1320}
1321
1322function random(start, finish)
1323{
1324local t = ((rand() % (finish - start)) + start);
1325return t;
1326}
1327
1328function createpickupss()
1329{
1330CreatePickup(408, Vector( 207.214, -470.93, 11.0699 )); // bunchoftools
1331CreatePickup(408, Vector( 467.072, -53.9059, 11.4837 )); // malibu
1332CreatePickup(408, Vector( 418.765, 91.317, 11.2808 )); // pizzavc
1333CreatePickup(408, Vector( 491.143, 701.207, 12.1033 )); // hospitalvc
1334CreatePickup(408, Vector( 450.729, 782.371, 12.954 )); // storevc
1335CreatePickup(408, Vector( 472.171, 1009.33, 19.1462 )); // tarbrush1
1336CreatePickup(408, Vector( 471.983, 1014.02, 20.0473 )); // tarbrush2
1337CreatePickup(408, Vector( 421.842, 1026.69, 25.2993 )); // gash
1338CreatePickup(408, Vector( 364.444, 1052.46, 19.213 )); // ammunationmall
1339CreatePickup(408, Vector( 363.719, 1074.71, 19.0613 )); // tooledup
1340CreatePickup(408, Vector( 351.45, 1111.41, 25.3879 )); // musicshop
1341CreatePickup(408, Vector( 469.438, 1206.76, 19.0103 )); // jewelry
1342CreatePickup(408, Vector( 2.39992, 956.954, 11.1667 )); // film
1343CreatePickup(408, Vector( -680.664, 1204.1, 11.1093 )); // ammudowntown
1344CreatePickup(408, Vector( -822.855, 1138.59, 12.4111 )); // hospitaldt
1345CreatePickup(408, Vector( -853.756, 850.456, 11.3846 )); // jewelrydt
1346CreatePickup(408, Vector( -905.961, 799.732, 11.4661 )); // pizzadt
1347CreatePickup(408, Vector( -830.144, 742.221, 11.2885 )); // medicaldt
1348CreatePickup(408, Vector( -594.15, 643.695, 11.6765 )); // bikers
1349CreatePickup(408, Vector( -846.475, -71.8574, 11.5403 )); // medicallh
1350CreatePickup(408, Vector( -1079.9, -275.156, 12.0882 )); // printworks
1351CreatePickup(408, Vector( -1038.02, 80.8385, 11.6263 )); // pizzalh
1352CreatePickup(408, Vector( -997.021, 186.33, 12.434 )); // kaufman
1353CreatePickup(408, Vector( -887.722, -474.079, 13.1115 )); // hospitallh
1354CreatePickup(408, Vector( -867.464, -584.271, 11.2155 )); // cherrypopper
1355CreatePickup(408, Vector( -855.472, -631.404, 11.3756 )); // donuts
1356CreatePickup(408, Vector( -1166.79, -620.55, 11.8279 )); // cubaan
1357CreatePickup(408, Vector( -1031.45, -850.113, 13.5224 )); // sunshine
1358CreatePickup(408, Vector( -665.544, -1484.63, 13.8016 )); // boatyard
1359CreatePickup(408, Vector( -112.599, -975.639, 10.4634 )); // hospitalvc
1360CreatePickup(408, Vector( -63.8908, -1485.23, 10.505 )); // ammuvc
1361CreatePickup(408, Vector( 90.5438, -1454.35, 10.5655 )); // poleposition
1362CreatePickup(356, Vector( 59.9425, -1071.8, 10.4633 ));
1363CreatePickup(356, Vector( 59.9448, -1078.36, 10.4633 ));
1364CreatePickup(408, Vector( -714.307, -1265.8, 11.0715 ));
1365}
1366
1367function random( min, max )
1368{
1369 if ( min < max )
1370 return rand() % (max - min + 1) + min.tointeger();
1371 else if ( min > max )
1372 return rand() % (min - max + 1) + max.tointeger();
1373 else if ( min == max )
1374 return min.tointeger();
1375}
1376
1377function MSG1()
1378{
1379MSG("Need fuel? .Go on washington's beach fuel station");
1380}
1381
1382function MSG2()
1383{
1384MSG("There are some jobs which u can earn money, go work.");
1385}
1386
1387function MSG3()
1388{
1389MSG("Want to race? Use /race.");
1390}
1391
1392function MSG4()
1393{
1394MSG("Want duel? Use /duel.");
1395}
1396
1397function MSG5()
1398{
1399MSG("Server version: 1.3.");
1400}
1401
1402function MSG6()
1403{
1404MSG("Something illegal? /report.");
1405}
1406
1407function MSG7()
1408{
1409MSG("Use /cmds to learn faster the commands.");
1410}
1411
1412function GetTok(string, separator, n, ...)
1413{
1414 local m = vargv.len() > 0 ? vargv[0] : n,
1415 tokenized = split(string, separator),
1416 text = "";
1417
1418 if (n > tokenized.len() || n < 1) return null;
1419 for (; n <= m; n++)
1420 {
1421 text += text == "" ? tokenized[n-1] : separator + tokenized[n-1];
1422 }
1423 return text;
1424}
1425
1426function NumTok(string, separator)
1427{
1428 local tokenized = split(string, separator);
1429 return tokenized.len();
1430}
1431
1432function Distance(x3, y6, x3, y6)
1433{
1434local dist = sqrt(((x2 - x1)*(x2 - x1)) + ((y2 - y1)*(y2 - y1)));
1435return dist;
1436}
1437
1438function GetPlayer( plr )
1439{
1440if ( plr )
1441{
1442if ( IsNum( plr ) )
1443{
1444plr = FindPlayer( plr.tointeger() );
1445if ( plr ) return plr;
1446else return false;
1447}
1448else
1449{
1450plr = FindPlayer( plr );
1451if ( plr ) return plr;
1452else return false;
1453}
1454}
1455else return false;
1456}
1457
1458function GetFullTime()
1459{
1460local t = date();
1461return ::format(@"%.2d/%.2d/%d - %.2d:%.2d:%.2d", t.day, t.month, t.year, t.hour, t.min, t.sec);
1462}
1463
1464function CriarTabelas()
1465{
1466QuerySQL( db, "CREATE TABLE IF NOT EXISTS Contas ( Nome TEXT, IP VARCHAR(20), UID TEXT, Senha VARCHAR(255), Dinheiro NUMERIC, Banco NUMERIC, Level NUMERIC, Data_Reg TEXT, Data_Join TEXT, Matou NUMERIC, Morreu NUMERIC, Nogoto TEXT, SpawnLoc TEXT, Loc TEXT )" );
1467QuerySQL( db, "CREATE TABLE IF NOT EXISTS Bans ( Nome TEXT, UID TEXT, Admin TEXT, Motivo TEXT, Data TEXT )" );
1468QuerySQL( db, "CREATE TABLE IF NOT EXISTS Locs ( Nome TEXT, Pos TEXT, Criador TEXT, Data TEXT )" );
1469QuerySQL( db, "CREATE TABLE IF NOT EXISTS SpawnWep ( Nome TEXT, Wep1 NUMERIC, Wep2 NUMERIC, Wep3 NUMERIC, Wep4 NUMERIC )" );
1470QuerySQL( db, "CREATE TABLE IF NOT EXISTS Carros ( ID NUMERIC, Preco NUMERIC, Dono TEXT, Compart TEXT, Modelo NUMERIC, PX FLOAT, PY FLOAT, PZ FLOAT, Angulo FLOAT, Cor1 NUMERIC, Cor2 NUMERIC )" );
1471QuerySQL( db, "CREATE TABLE IF NOT EXISTS Skins ( Nome TEXT, Skin NUMERIC )" );
1472QuerySQL( db, "CREATE TABLE IF NOT EXISTS Portoes ( CasaID NUMERIC, Model NUMERIC, Pos1 TEXT, Rot1 TEXT, Pos2 TEXT, Rot2 TEXT )" );
1473QuerySQL( db, "CREATE TABLE IF NOT EXISTS Objectss ( Model NUMERIC, World NUMERIC, PX FLOAT, PY FLOAT, PZ FLOAT, Alpha NUMERIC, RX FLOAT, RT FLOAT, RZ FLOAT, Creator TEXT )" );
1474QuerySQL( db, "CREATE TABLE IF NOT EXISTS Casas ( ID NUMERIC, Nome TEXT, Preco NUMERIC, Dono TEXT, Compart TEXT, PX FLOAT, PY FLOAT, PZ FLOAT )" );
1475QuerySQL( db, "CREATE TABLE IF NOT EXISTS Pickups(ID TEXT, Creator VARCHAR(32), X NUMERIC, Y NUMERIC, Z NUMERIC, PickupID TEXT, World NUMERIC )" );
1476QuerySQL( db, "CREATE TABLE IF NOT EXISTS Report(Player TEXT, Reporter TEXT, Reason TEXT, Date_Of_Report TEXT )" );
1477}
1478
1479function Reload()
1480{
1481dofile( "scripts/Main.nut" );
1482dofile( "scripts/Functions.nut" );
1483dofile( "scripts/Cmds.nut" );
1484dofile( "scripts/Echo.nut" );
1485MSG( "Script Reloaded" );
1486print( "Script Reloaded" );
1487}
1488
1489function CarregarCarros()
1490{
1491local i = 0, modelo, x, y, z, angulo, cor1, cor2;
1492local q = QuerySQL( db, "SELECT * FROM Carros" );
1493
1494while ( GetSQLColumnData( q, 0 ) != null )
1495{
1496modelo = GetSQLColumnData( q, 4 );
1497x = GetSQLColumnData( q, 5 );
1498y = GetSQLColumnData( q, 6 );
1499z = GetSQLColumnData( q, 7 );
1500angulo = GetSQLColumnData( q, 8 );
1501cor1 = GetSQLColumnData( q, 9 );
1502cor2 = GetSQLColumnData( q, 10 );
1503CreateVehicle( modelo, 0, Vector( x.tofloat(), y.tofloat(), z.tofloat() ), angulo, cor1, cor2 );
1504GetSQLNextRow( q );
1505i++;
1506}
1507FreeSQLQuery( q );
1508print( "Vehiculos Cargados - " + i );
1509}
1510
1511function IpToCountry( IP )
1512{
1513local country = geoip_country_name_by_addr( IP );
1514if ( IP == "127.0.0.1" ) return "Local-Host";
1515else if ( country == null ) return "Nao Encontrado";
1516else return country;
1517}
1518
1519function PartReason( reason )
1520{
1521if ( reason == 0 ) return "Timeout";
1522else if ( reason == 1 ) return "Quit";
1523else if ( reason == 2 ) return "Kickado";
1524else if ( reason == 3 ) return "Crash";
1525}
1526
1527function DeathReason( reason )
1528{
1529if ( reason == 70 ) return "Suicidio";
1530else if ( reason == 39 ) return "Car Accident";
1531else if ( reason == 31 ) return "Burned";
1532else if ( reason == 14 ) return "Suffocated";
1533else if ( reason == 43 ) return "Drowned";
1534else if ( reason == 41 ) return "Exploded";
1535else if ( reason == 51 ) return "Exploded";
1536else if ( reason == 44 ) return "Fell";
1537else return "Motivo Desconocido";
1538}
1539
1540function GetBP( part )
1541{
1542local group = "";
1543if ( part == 0 ) group = "Body";
1544else if ( part == 1 ) group = "Torso";
1545else if ( part == 2 ) group = "Left Arm";
1546else if ( part == 3 ) group = "Right Arm";
1547else if ( part == 4 ) group = "Left Leg";
1548else if ( part == 5 ) group = "Right Leg";
1549else if ( part == 6 ) group = "Head";
1550return group;
1551}
1552
1553function Configuracao()
1554{
1555SetUseClasses( true );
1556SetDeathMessages( false );
1557SetDrivebyEnabled( true );
1558SetDriveOnWater( true );
1559SetFlyingCars( false );
1560SetFriendlyFire( false );
1561SetJoinMessages( false );
1562SetShowNametags( true );
1563SetShowOnRadar( true );
1564SetStuntBike( false );
1565SetTaxiBoostJump( true );
1566SetServerName( Server.Nome );
1567SetSpawnPlayerPos( 104.356, -797.621, 10.4633 );
1568SetSpawnCameraPos( 98.3744, -810.273, 10.4633 );
1569SetSpawnCameraLook( 475.172, -67.5395, 9.98375 );
1570SetGameModeName( " v" + Server.Versao );
1571SetTime( 18, 00 );
1572SetTimeRate( 0 );
1573Classes();
1574print( Server.Nome + " v" + Server.Versao + " creado por " + Server.Desenvolvedor + " iniciado." );
1575}
1576
1577function Classes()
1578{
1579//================================= Tommy Team =================================
1580AddClass( 0, RGB( 30, 144, 255 ), 0, Vector( -378.557, -541.685, 17.2831 ), -0.00544404, 17, 1000 , 21, 1000, 26, 1000 );
1581AddClass( 0, RGB( 30, 144, 255 ), 95, Vector( -378.557, -541.685, 17.2831 ), -0.00544404, 17, 1000 , 21, 1000, 26, 1000 );
1582//================================== Cop Team ==================================
1583AddClass( 1, RGB( 190, 190, 190 ), 1, Vector( -657.341, 762.188, 11.5999 ), 2.441, 17, 1000 , 21, 1000, 26, 1000 );
1584AddClass( 1, RGB( 190, 190, 190 ), 3, Vector( -657.341, 762.188, 11.5999 ), 2.441, 17, 1000 , 21, 1000, 26, 1000 );
1585//================================== Army Team =================================
1586AddClass( 2, RGB( 255, 0, 0 ), 2, Vector( -1721.48, -226.703, 14.8683 ), -3.12018, 17, 1000 , 21, 1000, 26, 1000 );
1587AddClass( 2, RGB( 255, 0, 0 ), 4, Vector( -1721.48, -226.703, 14.8683 ), -3.12018, 17, 1000 , 21, 1000, 26, 1000 );
1588//================================== Taxi Team =================================
1589AddClass( 3, RGB( 255, 165, 0 ), 28, Vector( -995.355, 185.432, 12.434 ), -0.123521, 17, 1000 , 21, 1000, 26, 1000 );
1590AddClass( 3, RGB( 255, 165, 0 ), 74, Vector( -995.355, 185.432, 12.434 ), -0.123521, 17, 1000 , 21, 1000, 26, 1000 );
1591//================================== Golf Team =================================
1592AddClass( 4, RGB( 250, 128, 114 ), 62, Vector( 100.034, 254.158, 21.7719 ), -2.70758, 17, 1000 , 21, 1000, 26, 1000 );
1593AddClass( 4, RGB( 250, 128, 114 ), 64, Vector( 100.034, 254.158, 21.7719 ), -2.70758, 17, 1000 , 21, 1000, 26, 1000 );
1594//================================== Biker Team ================================
1595AddClass( 5, RGB( 160, 32, 240 ), 93, Vector( -603.613, 634.466, 12.2347 ), -1.47827, 17, 1000 , 21, 1000, 26, 1000 );
1596AddClass( 5, RGB( 160, 32, 240 ), 94, Vector( -603.613, 634.466, 12.2347 ), -1.47827, 17, 1000 , 21, 1000, 26, 1000 );
1597//================================== Pizza Team ================================
1598AddClass( 6, RGB( 255, 255, 0 ), 68, Vector( -907.399, 800.637, 11.3918 ), -1.64542, 17, 1000 , 21, 1000, 26, 1000 );
1599AddClass( 6, RGB( 255, 255, 0 ), 132, Vector( -907.399, 800.637, 11.3918 ), -1.64542, 17, 1000 , 21, 1000, 26, 1000 );
1600//================================== Thug Team =================================
1601AddClass( 7, RGB( 0, 139, 139 ), 154, Vector( 85.0716, 1112.38, 18.7597 ), 3.12136, 17, 1000 , 21, 1000, 26, 1000 );
1602AddClass( 7, RGB( 0, 139, 139 ), 148, Vector( 85.0716, 1112.38, 18.7597 ), 3.12136, 17, 1000 , 21, 1000, 26, 1000 );
1603//================================ Haitian Team ================================
1604AddClass( 8, RGB( 0, 255, 255 ), 85, Vector( -965.356, 148.572, 9.39548 ), -1.53778, 17, 1000 , 21, 1000, 26, 1000 );
1605AddClass( 8, RGB( 0, 255, 255 ), 86, Vector( -965.356, 148.572, 9.39548 ), -1.53778, 17, 1000 , 21, 1000, 26, 1000 );
1606//================================= Cuban Team =================================
1607AddClass( 9, RGB( 255, 192, 203 ), 83, Vector( -1167.03, -614.434, 11.8292 ), 1.78367, 17, 1000 , 21, 1000, 26, 1000 );
1608AddClass( 9, RGB( 255, 192, 203 ), 84, Vector( -1167.03, -614.434, 11.8292 ), 1.78367, 17, 1000 , 21, 1000, 26, 1000 );
1609//================================ Malibu Team =================================
1610AddClass( 10, RGB( 127, 255, 212 ), 186, Vector( 465.706, -53.9011, 15.7038 ), -2.37175, 17, 1000 , 21, 1000, 26, 1000 );
1611AddClass( 10, RGB( 127, 255, 212 ), 115, Vector( 465.706, -53.9011, 15.7038 ), -2.37175, 17, 1000 , 21, 1000, 26, 1000 );
1612//================================= FBI Team ===================================
1613AddClass( 11, RGB( 255, 215, 0 ), 97, Vector( -873.145, -684.57, 11.3023 ), -0.649355, 17, 1000 , 21, 1000, 26, 1000 );
1614AddClass( 11, RGB( 255, 215, 0 ), 100, Vector( -873.145, -684.57, 11.3023 ), -0.649355, 17, 1000 , 21, 1000, 26, 1000 );
1615}
1616
1617function GetNameClass( classID )
1618{
1619local id = classID;
1620if ( id == 0 ) return "Tommy's Team";
1621else if ( id == 1 ) return "Police Team";
1622else if ( id == 2 ) return "Army Team";
1623else if ( id == 3 ) return "Taxi Team";
1624else if ( id == 4 ) return "Golf Team";
1625else if ( id == 5 ) return "Bikers Team";
1626else if ( id == 6 ) return "Pizza Team";
1627else if ( id == 7 ) return "Thug Team";
1628else if ( id == 8 ) return "Haitian Team";
1629else if ( id == 9 ) return "Cuban Team";
1630else if ( id == 10 ) return "Malibu Team";
1631else if ( id == 11 ) return "FBI Team";
1632else return " ";
1633}
1634
1635function S_MSG( text, player ) MessagePlayer( "[#00cc00]|SINTAX|[#FFFFFF] " + text, player );
1636
1637function E_MSG( text, player ) MessagePlayer( "[#ff0000]|ERROR|[#FFFFFF] " + text, player );
1638
1639function I_MSG( text, player ) MessagePlayer( "[#000099]|INFO|[#FFFFFF] " + text, player );
1640
1641function A_MSG( text, player )
1642{
1643MessageAllExcept( "[#FFFFFF]***[#00FFFF] " + text, player );
1644EchoMessage( "6***3 " + text );
1645}
1646
1647function MSG( text )
1648{
1649Message( "[#FFFFFF]***[#00FFFF] " + text );
1650EchoMessage( "6***3 " + text );
1651}
1652
1653function SalvarTudo()
1654{
1655for( local i = 0, plr; i < GetMaxPlayers(); i++ )
1656{
1657plr = FindPlayer( i );
1658if ( plr ) SalvarDados( plr );
1659}
1660}
1661
1662function CreateBox()
1663{
1664 Box = CreatePickup( 345 , Vector( -403.665, 900.964, 39.2562 ) );
1665}
1666
1667function Agua( user )
1668{
1669local player = FindPlayer( user );
1670if ( player ) player.Pos = Vector( -597.7496, -1858.9531, 28.1291 );
1671}
1672
1673function Drown( admin, player, motivo )
1674{
1675if ( player.Vehicle ) player.Eject();
1676MSG( "Admin " + admin + " drowned " + player.Name + ". Motiv: " + motivo + "." );
1677player.Health = 3;
1678NewTimer( "Agua", 700, 1, player.ID );
1679}
1680
1681function Ban( admin, player, motivo )
1682{
1683QuerySQL( db, "INSERT INTO Bans ( Nome, UID, Admin, Motivo, Data ) VALUES ( '" + player.Name + "', '" + player.UniqueID + "', '" + admin + "', '" + motivo + "', '" + GetFullTime() + "' )" );
1684MSG( "Admin " + admin + " baneo a " + player.Name + ". Motivo: " + motivo + "." );
1685KickPlayer( player );
1686}
1687
1688function Kick( admin, player, motivo )
1689{
1690MSG( "Admin " + admin + " kickeo " + player.Name + ". Motivo: " + motivo + "." );
1691KickPlayer( player );
1692}
1693
1694function GetVehInfo( veh, opcao )
1695{
1696local opcao = opcao.tolower();
1697if ( veh )
1698{
1699local q = QuerySQL( db, "SELECT * FROM Carros WHERE ID='" + veh.ID + "'" );
1700if ( opcao == "preco" ) return GetSQLColumnData( q, 1 ).tointeger();
1701else if ( opcao == "dono" ) return GetSQLColumnData( q, 2 );
1702else if ( opcao == "compart" ) return GetSQLColumnData( q, 3 );
1703else return "Informacion no encontrada";
1704}
1705}
1706
1707function DonoCompartVeh( player, veh )
1708{
1709if ( GetVehInfo( veh, "dono" ) == player.Name || GetVehInfo( veh, "compart" ) == player.Name ) return true;
1710else return false;
1711}
1712
1713function VeiculoInfo( player, veh, opcao )
1714{
1715if ( opcao == 0 )
1716{
1717I_MSG( "ID: [" + veh.ID + "] | Price: [$ " + GetVehInfo( veh, "preco" ) + "].", player );
1718I_MSG( "Owner: [" + GetVehInfo( veh, "dono" ) + "] | Shared with: [" + GetVehInfo( veh, "compart" ) + "].", player );
1719}
1720else if ( opcao == 1 ) I_MSG( "You have left the vehicle " + ".", player );
1721}
1722
1723function IsVehForSale( id )
1724{
1725local q = QuerySQL( Vehicles, "SELECT * FROM Sale WHERE ID='"+id+"'" );
1726local own = GetSQLColumnData( q, 2 );
1727if ( own == "Unowned" ) return 1;
1728else return 0;
1729}
1730function IsOwnerOrSharer( veh, player )
1731{
1732local q = QuerySQL( Vehicles, "SELECT * FROM Sale WHERE ID='"+veh.ID+"'" );
1733local owner = GetSQLColumnData( q, 2 );
1734local sha = GetSQLColumnData( q, 3 );
1735local sha2 = GetSQLColumnData( q, 4 );
1736if ( ( owner == player.Name ) || ( sha == player.Name ) || ( sha2 == player.Name ) ) return 1;
1737else return 0;
1738}
1739function IsVehicleOwner( veh, player )
1740{
1741local q = QuerySQL( Vehicles, "SELECT * FROM Sale WHERE ID='"+veh.ID+"'" );
1742local owner = GetSQLColumnData( q, 2 );
1743if ( owner == player.Name ) return 1;
1744else return 0;
1745}
1746//==============================================================================
1747//------------------------- Player Functions -----------------------------------
1748//==============================================================================
1749function Checar( player, plr )
1750{
1751if ( plr == null )
1752{
1753if ( status[ player.ID ].Registrado == false )
1754{
1755E_MSG( "[#cccccc]Your name is not registered.", player );
1756return true;
1757}
1758else if ( status[ player.ID ].Registrado == true && status[ player.ID ].Logado == false )
1759{
1760E_MSG( "[#cccccc]You are not loged in.", player );
1761return true;
1762}
1763}
1764else if ( plr != null )
1765{
1766if ( status[ plr.ID ].Registrado == false )
1767{
1768E_MSG( plr.Name + " [#cccccc]it's not registered.", player );
1769return true;
1770}
1771else if ( status[ plr.ID ].Registrado == true && status[ plr.ID ].Logado == false )
1772{
1773E_MSG( plr.Name + " [#cccccc]not loged in.", player );
1774return true;
1775}
1776}
1777else return false;
1778}
1779
1780function GetStats( player )
1781{
1782local kills = status[ player.ID ].Matou, deaths = status[ player.ID ].Morreu, ratio;
1783if ( kills >= 1 && deaths >= 1 ) ratio = format( "%.2f", kills.tofloat() / deaths.tofloat() );
1784else ratio = 0;
1785Message( "[#cc00cc]* Stats de[#ff0000] " + player.Name + "[#00fFFF]: Killed:[#00FFFF] " + kills + "[#00fFFF] | Died:[#00FFFF] " + deaths + "[#00fFFF] | Experiencia:[#00FFFF] " + ratio + "[#00fFFF]." );
1786EchoMessage( "12* Status de4 " + player.Name + "12: Matou:4 " + kills + "12 | Morreu:4 " + deaths + "12 | Ratio:4 " + ratio + "12." );
1787}
1788
1789function Registrar( player, senha )
1790{
1791local pass = e(senha);
1792QuerySQL( db, "INSERT INTO Contas ( Nome, IP, UID, Senha, Dinheiro, Banco, Level, Data_Reg, Data_Join, Matou, Morreu, Nogoto, SpawnLoc, Loc ) VALUES ( '" + player.Name +
1793"', '" + player.IP + "', '" + player.UniqueID + "', '" + pass + "', 2000, 0, 1, '" + GetFullTime() + "', '" + GetFullTime() + "', 0, 0, 'off', 'off', 0 )" );
1794IncCash( player, 10000 );
1795status[ player.ID ].Registrado = true;
1796status[ player.ID ].Logado = true;
1797status[ player.ID ].Level = 1;
1798A_MSG( player.Name + " was successfully registered.", player );
1799I_MSG( "You are registered successfully.", player );
1800I_MSG( "Do not forget your password: " + senha, player );
1801Announce( "~y~Account Registred!", player, 3 );
1802}
1803
1804function Login( player )
1805{
1806CarregarDados( player );
1807A_MSG( player.Name + " has successfully loged in.", player );
1808I_MSG( "[#00cc00]Welcome back [#cccccc]" + player.Name + ".", player );
1809I_MSG( "[#cccccc]You have entered correctly.", player );
1810I_MSG( "Level: " + status[ player.ID ].Level + " - Status: " + LevelTag( player ) + ".", player );
1811Announce( "~y~Loged in!", player, 3 );
1812}
1813
1814function ChecarConta( player )
1815{
1816status[ player.ID ] = PlayerStats();
1817
1818if ( GetLevel( player ) >= 1 )
1819{
1820if ( player.IP != GetIP( player ) )
1821{
1822I_MSG( "[#cccccc]You are connected with a different IP.", player );
1823I_MSG( "[#cccccc]Please use /login <password>", player );
1824status[ player.ID ].Registrado = true;
1825status[ player.ID ].Logado = false;
1826}
1827else if ( player.IP == GetIP( player ) )
1828{
1829CarregarDados( player );
1830I_MSG( "[#00cc00]Welcome back [#cccccc]" + player.Name + ".", player );
1831I_MSG( "[#cccccc]You have loged in automatically.", player );
1832I_MSG( "Level: " + status[ player.ID ].Level + " - Status: " + LevelTag( player ) + ".", player );
1833}
1834}
1835else
1836{
1837I_MSG( "[#00cc00]Welcome back [#cccccc]" + player.Name + ".", player );
1838I_MSG( "[#cccccc]Your name is not registered on the server.", player );
1839I_MSG( "[#cccccc]Please use /register <password>.", player );
1840}
1841ChecarJogador( player );
1842}
1843
1844function CarregarDados( player )
1845{
1846local q = QuerySQL( db, "SELECT * FROM Contas WHERE Nome='" + player.Name + "'" );
1847
1848status[ player.ID ].Registrado = true;
1849status[ player.ID ].Logado = true;
1850status[ player.ID ].Dinheiro = GetSQLColumnData( q, 4 );
1851status[ player.ID ].Banco = GetSQLColumnData( q, 5 );
1852status[ player.ID ].Level = GetSQLColumnData( q, 6 );
1853status[ player.ID ].Matou = GetSQLColumnData( q, 9 );
1854status[ player.ID ].Morreu = GetSQLColumnData( q, 10 );
1855if ( GetSQLColumnData( q, 11 ) == "on" ) status[ player.ID ].Nogoto = true;
1856if ( GetSQLColumnData( q, 12 ) == "on" ) status[ player.ID ].SpawnLoc = true;
1857if ( GetSQLColumnData( q, 13 ) != "0" ) status[ player.ID ].Loc = GetSQLColumnData( q, 13 );
1858player.Cash = status[ player.ID ].Dinheiro;
1859Data_IP( player );
1860}
1861
1862function Data_IP( player )
1863{
1864QuerySQL( db, "UPDATE Contas SET IP='" + player.IP + "', Data_Join='" + GetFullTime() + "' WHERE Nome='" + player.Name + "'" );
1865}
1866
1867function SalvarDados( player )
1868{
1869local p = status[ player.ID ], nogoto = "off";
1870if ( p.Registrado == true && p.Logado == true )
1871{
1872if ( p.Nogoto == true ) nogoto = "on";
1873QuerySQL( db, "UPDATE Contas SET Dinheiro='" + p.Dinheiro + "', Banco='" + p.Banco + "', Level='" + p.Level +
1874"', Matou='" + p.Matou + "', Morreu='" + p.Morreu + "', Nogoto='" + nogoto + "' WHERE Nome='" + player.Name + "'" );
1875}
1876}
1877
1878function ChecarJogador( player )
1879{
1880local q = QuerySQL( db, "SELECT * FROM Bans WHERE UID='" + player.UniqueID + "'" );
1881if ( GetSQLColumnData( q, 1 ) == player.UniqueID )
1882{
1883A_MSG( player.Name + " esta baneado.", player );
1884I_MSG( "Usted esta baneado del server.", player );
1885I_MSG( "Admin que te baneo: " + GetSQLColumnData( q, 2 ) + " | Data: " + GetSQLColumnData( q, 4 ) + ".", player );
1886I_MSG( "Motivo de banimento: " + GetSQLColumnData( q, 3 ) + ".", player );
1887KickPlayer( player );
1888}
1889else if ( player.Name == "Ninguem" ) Kick( "Server", player, "Nick Bloqueado" );
1890}
1891
1892function Heal( user )
1893{
1894local player = FindPlayer( user );
1895if ( player )
1896{
1897if ( player.IsSpawned && player.Health >= 1 )
1898{
1899player.IsFrozen = false;
1900DecCash( player, 250 );
1901player.Health = 100;
1902I_MSG( "[#cccccc]Usted se ha curado. Precio $250.", player );
1903}
1904else
1905{
1906player.IsFrozen = false;
1907E_MSG( "Usted no puede curarse en este momento.", player );
1908}
1909}
1910}
1911
1912function Goto( user, user2 )
1913{
1914local player = FindPlayer( user ), plr = FindPlayer( user2 );
1915if ( player && plr )
1916{
1917player.Pos = plr.Pos;
1918player.IsFrozen = false;
1919I_MSG( "You have teleported to " + plr.Name + ".", player );
1920I_MSG( player.Name + " teleported to you.", plr );
1921}
1922if ( !plr )
1923{
1924player.IsFrozen = false;
1925I_MSG( "Jugador desconocido.", player );
1926}
1927}
1928
1929function Gotoloc( user, loc )
1930{
1931local player = FindPlayer( user );
1932if ( player )
1933{
1934local q = QuerySQL( db, "SELECT * FROM Locs WHERE Nome='" + loc + "'" ),
1935pos = split( GetSQLColumnData( q, 1 ), " " );
1936player.Pos = Vector( pos[0].tofloat(), pos[1].tofloat(), pos[2].tofloat() );
1937I_MSG( "Teleported to the location: " + loc + " | Created by: " + GetSQLColumnData( q, 2 ) + " | Date: " + GetSQLColumnData( q, 3 ) + ".", player );
1938player.IsFrozen = false;
1939}
1940}
1941
1942function GiveWeapons( player, vargv )
1943{
1944local Weapons = "", i;
1945for ( i = 0; i < vargv.len(); i++ )
1946{
1947if( GetWeaponID( vargv[ i ] ) && GetWeaponName( GetWeaponID( vargv[ i ] ) ) != "Unknown" && GetWeaponID( vargv[ i ] ) != 33 )
1948{
1949local wep = GetWeaponID( vargv[ i ] );
1950if ( wep != 33 )
1951{
1952player.SetWeapon( GetWeaponID( vargv[ i ] ), 9999 );
1953if( Weapons == "" ) Weapons = GetWeaponName( GetWeaponID( vargv[ i ] ) ).tostring();
1954else Weapons = Weapons + ", " + GetWeaponName( GetWeaponID( vargv[ i ] ) ).tostring();
1955}
1956}
1957}
1958I_MSG( Weapons + ".", player );
1959}
1960
1961function JoinMessage( player )
1962{
1963Message( "[#00BFFF]*** [#FFFFFF]" + player.Name + " [#00ffff]Entered on the server. (" + IpToCountry( player.IP ) + ")" );
1964EchoMessage( "10***4 " + player.Name + " 10Entered on server. (" + IpToCountry( player.IP ) + ")" );
1965}
1966
1967function QuitMessage( player, motivo )
1968{
1969Message( "[#00BFFF]*** [#FFFFFF]" + player.Name + " [#00BFFF]saiu do servidor. (" + PartReason( motivo ) + ")" );
1970EchoMessage( "10***4 " + player.Name + " 10left the server. (" + PartReason( motivo ) + ")" );
1971}
1972
1973function LevelTag( player )
1974{
1975local lvl = status[ player.ID ].Level;
1976if ( lvl == 0 ) return "Visitante";
1977else if ( lvl == 1 ) return "Miembro";
1978else if ( lvl == 2 ) return "VIP";
1979else if ( lvl == 3 ) return "Admin";
1980else if ( lvl == 4 ) return "Administrador";
1981else if ( lvl == 5 ) return "Co_Moderador";
1982else if ( lvl == 6 ) return "Moderador";
1983else if ( lvl == 7 ) return "Administrador avanzado";
1984else if ( lvl == 8 ) return "Administrador Maestro";
1985else if ( lvl == 9 ) return "Manager";
1986else if ( lvl >= 10 ) return "Desarrollador";
1987}
1988
1989function GetLevel( player )
1990{
1991local result = GetSQLColumnData( QuerySQL( db, "SELECT Level FROM Contas WHERE Nome='" + player.Name + "'" ), 0 ), lvl;
1992if ( result == null ) lvl = GetSQLColumnData( QuerySQL( db, "SELECT Level FROM Contas WHERE Nome='" + player.Name + "'" ), 0 );
1993else lvl = result;
1994if ( lvl ) return lvl;
1995else return 0;
1996}
1997
1998function GetIP( player )
1999{
2000local result = GetSQLColumnData( QuerySQL( db, "SELECT IP FROM Contas WHERE Nome='" + player.Name + "'" ), 0 ), ip;
2001if ( result == null ) ip = GetSQLColumnData( QuerySQL( db, "SELECT IP FROM Contas WHERE Nome='" + player.Name + "'" ), 0 );
2002else ip = result;
2003if ( ip ) return ip;
2004else return 0;
2005}
2006
2007function GetSenha( player )
2008{
2009local result = GetSQLColumnData( QuerySQL( db, "SELECT Senha FROM Contas WHERE Nome='" + player.Name + "'" ), 0 ), pass;
2010if ( result == null ) pass = GetSQLColumnData( QuerySQL( db, "SELECT Senha FROM Contas WHERE Nome='" + player.Name + "'" ), 0 );
2011else pass = result;
2012if ( pass ) return pass;
2013else return 0;
2014}
2015
2016function IncCash( player, amount )
2017{
2018local cash = status[ player.ID ].Dinheiro;
2019local add = cash + amount;
2020status[ player.ID ].Dinheiro = add;
2021player.Cash = add;
2022}
2023
2024function DecCash( player, amount )
2025{
2026local cash = status[ player.ID ].Dinheiro;
2027local det = cash - amount;
2028status[ player.ID ].Dinheiro = det;
2029player.Cash = det;
2030}
2031
2032function IncBank( player, amount )
2033{
2034local bank = status[ player.ID ].Banco;
2035local add = bank + amount;
2036status[ player.ID ].Banco = add;
2037}
2038
2039function DecBank( player, amount )
2040{
2041local bank = status[ player.ID ].Banco;
2042local det = bank - amount;
2043status[ player.ID ].Banco = det;
2044}
2045
2046function Timer()
2047{
2048for( local i = 0, player; i < GetMaxPlayers(); i++ )
2049{
2050player = FindPlayer( i );
2051if ( player )
2052{
2053if ( SpawnKill[ player.ID ] >= 1 ) SpawnKill[ player.ID ] --;
2054if ( Multa[ player.ID ] >= 1 )
2055{
2056Multa[ player.ID ] --;
2057if ( Multa[ player.ID ] == 0 ) UnMute( "Server", player );
2058}
2059}
2060}
2061}
2062
2063function CheckSpam( player, reason )
2064{
2065local MSNxSEC = 2000, LIMIT_REP_SPAM = 3;
2066local spammer = ( GetTickCount() - status[ player.ID ].Count_Msg ) / MSNxSEC;
2067status[ player.ID ].Msg_Player += spammer - 1;
2068if ( status[ player.ID ].Msg_Player > LIMIT_REP_SPAM ) status[ player.ID ].Msg_Player = LIMIT_REP_SPAM - 1;
2069if ( status[ player.ID ].Msg_Player < 0 ) status[ player.ID ].Msg_Player = -1;
2070status[ player.ID ].Count_Msg = GetTickCount();
2071if ( status[ player.ID ].Msg_Player < 0)
2072{
2073if ( Multa[ player.ID ] == 0 )
2074{
2075Multa[ player.ID ] = 30;
2076I_MSG( "[#ff0000]Cuidado: [#cccccc]you have been muted for spamming and you will not be able to chat for a moment.", player );
2077A_MSG( "Auto-Mute " + player.Name + ", ID: " + player.ID + ". Motivo:[ " + reason + " ].", player );
2078}
2079}
2080}
2081
2082function UnMute( admin, player )
2083{
2084Multa[ player.ID ] = 0;
2085MSG( "Admin " + admin + " desmuteo a " + player.Name + "." );
2086}
2087
2088function LoadSpawnLoc( player )
2089{
2090if ( status[ player.ID ].SpawnLoc == true && status[ player.ID ].Loc != null )
2091{
2092local loc = status[ player.ID ].Loc,
2093pos = split( loc, " " ),
2094px = pos[0].tofloat(), py = pos[1].tofloat(), pz = pos[2].tofloat();
2095player.Pos = Vector( px, py, pz );
2096}
2097}
2098
2099function AddSpawnWep( player, wep, wep2, wep3, wep4 )
2100{
2101if ( ( wep ) && IsNum( wep ) ) wep = wep.tointeger();
2102else if ( wep ) wep = GetWeaponID( wep );
2103if ( ( wep2 ) && IsNum( wep2 ) ) wep2 = wep2.tointeger();
2104else if ( wep2 ) wep2 = GetWeaponID( wep2 );
2105if ( ( wep3 ) && IsNum( wep3 ) ) wep3 = wep3.tointeger();
2106else if ( wep3 ) wep3 = GetWeaponID( wep3 );
2107if ( ( wep4 ) && IsNum( wep4 ) ) wep4 = wep4.tointeger();
2108else if ( wep4 ) wep4 = GetWeaponID( wep4 );
2109QuerySQL( db, "DELETE FROM SpawnWep WHERE Nome='" + player.Name + "'" );
2110QuerySQL( db, "INSERT INTO SpawnWep ( Nome, Wep1, Wep2, Wep3, Wep4 ) VALUES ( '" + player.Name + "', '" + wep + "', '" + wep2 + "', '" + wep3 + "', '" + wep4 + "')" );
2111I_MSG( "Arma(s) adiciona(s) e carregada(s).", player );
2112}
2113
2114function DelSpawnWep( player )
2115{
2116QuerySQL( db, "DELETE FROM SpawnWep WHERE Nome='" + player.Name + "'" );
2117I_MSG( "Arma(s) deletada(s) de seu spawn.", player );
2118}
2119
2120function swep( player )
2121{
2122local swep = GetSQLColumnData( QuerySQL( db, "SELECT Wep1 FROM SpawnWep WHERE Nome='" + player.Name + "'" ), 0 );
2123if ( swep ) return swep;
2124else return 0;
2125}
2126
2127function swep2( player )
2128{
2129local swep2 = GetSQLColumnData( QuerySQL( db, "SELECT Wep2 FROM SpawnWep WHERE Nome='" + player.Name + "'" ), 0 );
2130if ( swep2 ) return swep2;
2131else return 0;
2132}
2133
2134function swep3( player )
2135{
2136local swep3 = GetSQLColumnData( QuerySQL( db, "SELECT Wep3 FROM SpawnWep WHERE Nome='" + player.Name + "'" ), 0 );
2137if ( swep3 ) return swep3;
2138else return 0;
2139}
2140function swep4( player )
2141{
2142local swep4 = GetSQLColumnData( QuerySQL( db, "SELECT Wep4 FROM SpawnWep WHERE Nome='" + player.Name + "'" ), 0 );
2143if ( swep4 ) return swep4;
2144else return 0;
2145}
2146
2147function LoadSpawnWep( player )
2148{
2149if ( swep(player) == 0 );
2150else if ( swep(player) == 1 ) player.SetWeapon( 1, 300 );
2151else if ( swep(player) == 2 ) player.SetWeapon( 2, 300 );
2152else if ( swep(player) == 3 ) player.SetWeapon( 3, 300 );
2153else if ( swep(player) == 4 ) player.SetWeapon( 4, 300 );
2154else if ( swep(player) == 5 ) player.SetWeapon( 5, 300 );
2155else if ( swep(player) == 6 ) player.SetWeapon( 6, 300 );
2156else if ( swep(player) == 7 ) player.SetWeapon( 7, 300 );
2157else if ( swep(player) == 8 ) player.SetWeapon( 8, 300 );
2158else if ( swep(player) == 9 ) player.SetWeapon( 9, 300 );
2159else if ( swep(player) == 10 ) player.SetWeapon( 10, 300 );
2160else if ( swep(player) == 11 ) player.SetWeapon( 11, 300 );
2161else if ( swep(player) == 12 ) player.SetWeapon( 12, 300 );
2162else if ( swep(player) == 13 ) QuerySQL( db, "DELETE FROM SpawnWep WHERE Nome='" + player.Name + "'" );
2163else if ( swep(player) == 14 ) QuerySQL( db, "DELETE FROM SpawnWep WHERE Nome='" + player.Name + "'" );
2164else if ( swep(player) == 15 ) player.SetWeapon( 15, 300 );
2165else if ( swep(player) == 16 ) player.SetWeapon( 16, 300 );
2166else if ( swep(player) == 17 ) player.SetWeapon( 17, 300 );
2167else if ( swep(player) == 18 ) player.SetWeapon( 18, 300 );
2168else if ( swep(player) == 19 ) player.SetWeapon( 19, 300 );
2169else if ( swep(player) == 20 ) player.SetWeapon( 20, 300 );
2170else if ( swep(player) == 21 ) player.SetWeapon( 21, 300 );
2171else if ( swep(player) == 22 ) player.SetWeapon( 22, 300 );
2172else if ( swep(player) == 23 ) player.SetWeapon( 23, 300 );
2173else if ( swep(player) == 24 ) player.SetWeapon( 24, 300 );
2174else if ( swep(player) == 25 ) player.SetWeapon( 25, 300 );
2175else if ( swep(player) == 26 ) player.SetWeapon( 26, 300 );
2176else if ( swep(player) == 27 ) player.SetWeapon( 27, 300 );
2177else if ( swep(player) == 28 ) player.SetWeapon( 28, 300 );
2178else if ( swep(player) == 29 ) player.SetWeapon( 29, 300 );
2179else if ( swep(player) == 30 ) player.SetWeapon( 30, 300 );
2180else if ( swep(player) == 31 ) player.SetWeapon( 31, 300 );
2181else if ( swep(player) == 32 ) player.SetWeapon( 32, 300 );
2182else if ( swep(player) == 33 ) QuerySQL( db, "DELETE FROM SpawnWep WHERE Nome='" + player.Name + "'" );
2183
2184if ( swep2(player) == 0 );
2185else if ( swep2(player) == 1 ) player.SetWeapon( 1, 300 );
2186else if ( swep2(player) == 2 ) player.SetWeapon( 2, 300 );
2187else if ( swep2(player) == 3 ) player.SetWeapon( 3, 300 );
2188else if ( swep2(player) == 4 ) player.SetWeapon( 4, 300 );
2189else if ( swep2(player) == 5 ) player.SetWeapon( 5, 300 );
2190else if ( swep2(player) == 6 ) player.SetWeapon( 6, 300 );
2191else if ( swep2(player) == 7 ) player.SetWeapon( 7, 300 );
2192else if ( swep2(player) == 8 ) player.SetWeapon( 8, 300 );
2193else if ( swep2(player) == 9 ) player.SetWeapon( 9, 300 );
2194else if ( swep2(player) == 10 ) player.SetWeapon( 10, 300 );
2195else if ( swep2(player) == 11 ) player.SetWeapon( 11, 300 );
2196else if ( swep2(player) == 12 ) player.SetWeapon( 12, 300 );
2197else if ( swep2(player) == 13 ) QuerySQL( db, "DELETE FROM SpawnWep WHERE Nome='" + player.Name + "'" );
2198else if ( swep2(player) == 14 ) QuerySQL( db, "DELETE FROM SpawnWep WHERE Nome='" + player.Name + "'" );
2199else if ( swep2(player) == 15 ) player.SetWeapon( 15, 300 );
2200else if ( swep2(player) == 16 ) player.SetWeapon( 16, 300 );
2201else if ( swep2(player) == 17 ) player.SetWeapon( 17, 300 );
2202else if ( swep2(player) == 18 ) player.SetWeapon( 18, 300 );
2203else if ( swep2(player) == 19 ) player.SetWeapon( 19, 300 );
2204else if ( swep2(player) == 20 ) player.SetWeapon( 20, 300 );
2205else if ( swep2(player) == 21 ) player.SetWeapon( 21, 300 );
2206else if ( swep2(player) == 22 ) player.SetWeapon( 22, 300 );
2207else if ( swep2(player) == 23 ) player.SetWeapon( 23, 300 );
2208else if ( swep2(player) == 24 ) player.SetWeapon( 24, 300 );
2209else if ( swep2(player) == 25 ) player.SetWeapon( 25, 300 );
2210else if ( swep2(player) == 26 ) player.SetWeapon( 26, 300 );
2211else if ( swep2(player) == 27 ) player.SetWeapon( 27, 300 );
2212else if ( swep2(player) == 28 ) player.SetWeapon( 28, 300 );
2213else if ( swep2(player) == 29 ) player.SetWeapon( 29, 300 );
2214else if ( swep2(player) == 30 ) player.SetWeapon( 30, 300 );
2215else if ( swep2(player) == 31 ) player.SetWeapon( 31, 300 );
2216else if ( swep2(player) == 32 ) player.SetWeapon( 32, 300 );
2217else if ( swep2(player) == 33 ) QuerySQL( db, "DELETE FROM SpawnWep WHERE Nome='" + player.Name + "'" );
2218
2219if ( swep3(player) == 0 );
2220else if ( swep3(player) == 1 ) player.SetWeapon( 1, 300 );
2221else if ( swep3(player) == 2 ) player.SetWeapon( 2, 300 );
2222else if ( swep3(player) == 3 ) player.SetWeapon( 3, 300 );
2223else if ( swep3(player) == 4 ) player.SetWeapon( 4, 300 );
2224else if ( swep3(player) == 5 ) player.SetWeapon( 5, 300 );
2225else if ( swep3(player) == 6 ) player.SetWeapon( 6, 300 );
2226else if ( swep3(player) == 7 ) player.SetWeapon( 7, 300 );
2227else if ( swep3(player) == 8 ) player.SetWeapon( 8, 300 );
2228else if ( swep3(player) == 9 ) player.SetWeapon( 9, 300 );
2229else if ( swep3(player) == 10 ) player.SetWeapon( 10, 300 );
2230else if ( swep3(player) == 11 ) player.SetWeapon( 11, 300 );
2231else if ( swep3(player) == 12 ) player.SetWeapon( 12, 300 );
2232else if ( swep3(player) == 13 ) QuerySQL( db, "DELETE FROM SpawnWep WHERE Nome='" + player.Name + "'" );
2233else if ( swep3(player) == 14 ) QuerySQL( db, "DELETE FROM SpawnWep WHERE Nome='" + player.Name + "'" );
2234else if ( swep3(player) == 15 ) player.SetWeapon( 15, 300 );
2235else if ( swep3(player) == 16 ) player.SetWeapon( 16, 300 );
2236else if ( swep3(player) == 17 ) player.SetWeapon( 17, 300 );
2237else if ( swep3(player) == 18 ) player.SetWeapon( 18, 300 );
2238else if ( swep3(player) == 19 ) player.SetWeapon( 19, 300 );
2239else if ( swep3(player) == 20 ) player.SetWeapon( 20, 300 );
2240else if ( swep3(player) == 21 ) player.SetWeapon( 21, 300 );
2241else if ( swep3(player) == 22 ) player.SetWeapon( 22, 300 );
2242else if ( swep3(player) == 23 ) player.SetWeapon( 23, 300 );
2243else if ( swep3(player) == 24 ) player.SetWeapon( 24, 300 );
2244else if ( swep3(player) == 25 ) player.SetWeapon( 25, 300 );
2245else if ( swep3(player) == 26 ) player.SetWeapon( 26, 300 );
2246else if ( swep3(player) == 27 ) player.SetWeapon( 27, 300 );
2247else if ( swep3(player) == 28 ) player.SetWeapon( 28, 300 );
2248else if ( swep3(player) == 29 ) player.SetWeapon( 29, 300 );
2249else if ( swep3(player) == 30 ) player.SetWeapon( 30, 300 );
2250else if ( swep3(player) == 31 ) player.SetWeapon( 31, 300 );
2251else if ( swep3(player) == 32 ) player.SetWeapon( 32, 300 );
2252else if ( swep3(player) == 33 ) QuerySQL( db, "DELETE FROM SpawnWep WHERE Nome='" + player.Name + "'" );
2253
2254if ( swep4(player) == 0 );
2255else if ( swep4(player) == 1 ) player.SetWeapon( 1, 300 );
2256else if ( swep4(player) == 2 ) player.SetWeapon( 2, 300 );
2257else if ( swep4(player) == 3 ) player.SetWeapon( 3, 300 );
2258else if ( swep4(player) == 4 ) player.SetWeapon( 4, 300 );
2259else if ( swep4(player) == 5 ) player.SetWeapon( 5, 300 );
2260else if ( swep4(player) == 6 ) player.SetWeapon( 6, 300 );
2261else if ( swep4(player) == 7 ) player.SetWeapon( 7, 300 );
2262else if ( swep4(player) == 8 ) player.SetWeapon( 8, 300 );
2263else if ( swep4(player) == 9 ) player.SetWeapon( 9, 300 );
2264else if ( swep4(player) == 10 ) player.SetWeapon( 10, 300 );
2265else if ( swep4(player) == 11 ) player.SetWeapon( 11, 300 );
2266else if ( swep4(player) == 12 ) player.SetWeapon( 12, 300 );
2267else if ( swep4(player) == 13 ) QuerySQL( db, "DELETE FROM SpawnWep WHERE Nome='" + player.Name + "'" );
2268else if ( swep4(player) == 14 ) QuerySQL( db, "DELETE FROM SpawnWep WHERE Nome='" + player.Name + "'" );
2269else if ( swep4(player) == 15 ) player.SetWeapon( 15, 300 );
2270else if ( swep4(player) == 16 ) player.SetWeapon( 16, 300 );
2271else if ( swep4(player) == 17 ) player.SetWeapon( 17, 300 );
2272else if ( swep4(player) == 18 ) player.SetWeapon( 18, 300 );
2273else if ( swep4(player) == 19 ) player.SetWeapon( 19, 300 );
2274else if ( swep4(player) == 20 ) player.SetWeapon( 20, 300 );
2275else if ( swep4(player) == 21 ) player.SetWeapon( 21, 300 );
2276else if ( swep4(player) == 22 ) player.SetWeapon( 22, 300 );
2277else if ( swep4(player) == 23 ) player.SetWeapon( 23, 300 );
2278else if ( swep4(player) == 24 ) player.SetWeapon( 24, 300 );
2279else if ( swep4(player) == 25 ) player.SetWeapon( 25, 300 );
2280else if ( swep4(player) == 26 ) player.SetWeapon( 26, 300 );
2281else if ( swep4(player) == 27 ) player.SetWeapon( 27, 300 );
2282else if ( swep4(player) == 28 ) player.SetWeapon( 28, 300 );
2283else if ( swep4(player) == 29 ) player.SetWeapon( 29, 300 );
2284else if ( swep4(player) == 30 ) player.SetWeapon( 30, 300 );
2285else if ( swep4(player) == 31 ) player.SetWeapon( 31, 300 );
2286else if ( swep4(player) == 32 ) player.SetWeapon( 32, 300 );
2287else if ( swep4(player) == 33 ) QuerySQL( db, "DELETE FROM SpawnWep WHERE Nome='" + player.Name + "'" );
2288}
2289//==============================================================================
2290//----------------------------- Criptografia -----------------------------------
2291//==============================================================================
2292function rotateRight(val, sbits)
2293{
2294 return (val >> sbits) | (val << (0x20 - sbits));
2295}
2296
2297function e( string )
2298{
2299 local hp = [
2300 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a,
2301 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19
2302 ];
2303
2304 local k = [
2305 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
2306 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
2307 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
2308 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
2309 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
2310 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
2311 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
2312 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
2313 ];
2314
2315 local
2316 w = array( 64 ),
2317 i = 0,
2318 s = 0,
2319 len = string.len( ),
2320 word_array = array( 0 );
2321
2322 for( i = 0; i < len - 3; i += 4 )
2323 {
2324 word_array.push( string[i] << 0x18 | string[i + 1] << 0x10 | string[i + 2] << 0x08 | string[i + 3] );
2325 }
2326
2327 switch( len % 4 )
2328 {
2329 case 0:
2330 i = 0x80000000;
2331 break;
2332 case 1:
2333 i = string[len - 1] << 0x18 | 0x80000000;
2334 break;
2335 case 2:
2336 i = string[len - 2] << 0x18 | string[len - 1] << 0x10 | 0x08000;
2337 break;
2338 case 3:
2339 i = string[len - 3] << 0x18 | string[len - 2] << 0x10 | string[len - 1] << 0x08 | 0x80;
2340 break;
2341 }
2342 word_array.push( i );
2343
2344 while( ( word_array.len() % 0x10 ) != 0x0E )
2345 word_array.push( 0 );
2346
2347 word_array.push( len >> 0x10 );
2348 word_array.push( ( len << 0x03 ) & 0xFFFFFFFF );
2349
2350 local s0, s1;
2351 for( s = 0; s < word_array.len(); s += 0x10 )
2352 {
2353 for( i = 0x00; i < 0x10; i++ )
2354 w[i] = word_array[s + i];
2355
2356 for( i = 0x10; i < 0x40; i++ )
2357 {
2358 s0 = rotateRight( w[i - 15], 7 ) ^ rotateRight( w[i - 15], 18 ) ^ ( w[i - 15] >> 3 );
2359 s1 = rotateRight( w[i - 2], 17 ) ^ rotateRight( w[i - 2], 19 ) ^ ( w[i - 2] >> 10 );
2360 w[i] = w[i - 0x10] + s0 + w[i - 7] + s1;
2361 }
2362
2363 local a = hp[0],
2364 b = hp[1],
2365 c = hp[2],
2366 d = hp[3],
2367 e = hp[4],
2368 f = hp[5],
2369 g = hp[6],
2370 h = hp[7];
2371
2372 for( i = 0x00; i < 0x40; i++ )
2373 {
2374 s0 = ( rotateRight( a, 2 ) ^ rotateRight( a, 13 ) ^ rotateRight( a, 22 ) );
2375 local maj = ( ( a & b ) ^ ( a & c ) ^ ( b & c ) );
2376 local t2 = ( s0 + maj );
2377 s1 = ( rotateRight( e, 6 ) ^ rotateRight( e, 11) ^ rotateRight( e, 25 ) );
2378 local ch = ( ( e & f ) ^ ( ( ~e ) & g ) );
2379 local t1 = ( h + s1 + ch + k[i] + w[i] );
2380
2381 h = g;
2382 g = f;
2383 f = e;
2384 e = d + t1;
2385 d = c;
2386 c = b;
2387 b = a;
2388 a = t1 + t2;
2389 }
2390
2391 hp[0] += a;
2392 hp[1] += b;
2393 hp[2] += c;
2394 hp[3] += d;
2395 hp[4] += e;
2396 hp[5] += f;
2397 hp[6] += g;
2398 hp[7] += h;
2399 }
2400
2401 local hash = format(
2402 "%08x%08x%08x%08x%08x%08x%08x%08x",
2403 hp[0],
2404 hp[1],
2405 hp[2],
2406 hp[3],
2407 hp[4],
2408 hp[5],
2409 hp[6],
2410 hp[7]
2411 );
2412
2413 return hash;
2414}