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