Advertisement
garfield

[FS]: Sistema de nitro (avanced)

Oct 29th, 2012
267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 3.11 KB | None | 0 0
  1. #include a_samp
  2. #include progress // Progress Bar by Toribio
  3.  
  4.  
  5. #if !defined CallBack
  6.     #define CallBack::%0(%1)    %0(%1); public %0(%1)
  7. #endif
  8.  
  9. #define MAX_INT     2
  10.  
  11. new
  12.     Bar:Barra[ MAX_PLAYERS],
  13.     Nitro[MAX_PLAYERS char],
  14.     PlayersConectados,
  15.     Text:TextDraw
  16. ;
  17.  
  18. public OnPlayerConnect(playerid){
  19.  
  20.     Barra[playerid] = CreateProgressBar(505.00, 380.00, 109.50, 9.19, 0x00BFFFFF, 100.0);
  21.     Nitro{playerid} = 100;
  22.     return PlayersConectados++, true;
  23. }
  24.  
  25.  
  26. public OnPlayerDisconnect(playerid, reason){
  27.     return PlayersConectados--, true;
  28. }
  29.  
  30. public OnFilterScriptInit(){
  31.  
  32.     printf (#===========================);
  33.     printf (#Advanced Nitrous system);
  34.     printf (#Criado por: SuYaNW. Dacio);
  35.     printf (#- Carregado!);
  36.     printf (#===========================);
  37.    
  38.     SetTimer("UpdateNos",  MAX_INT * 1000,  true);
  39.    
  40.    
  41.     TextDraw = TextDrawCreate(501.000000, 366.000000, "Nitro:");
  42.     TextDrawBackgroundColor(TextDraw, 16777215);
  43.     TextDrawFont(TextDraw, 1);
  44.     TextDrawLetterSize(TextDraw, 0.590000, 1.200000);
  45.     TextDrawColor(TextDraw, 255);
  46.     TextDrawSetOutline(TextDraw, 1);
  47.     TextDrawSetProportional(TextDraw, 1);
  48.     return true;
  49. }
  50.  
  51.  
  52.  
  53. public OnPlayerEnterVehicle(playerid, vehicleid){
  54.     if(zNitro(vehicleid)){
  55.         AddVehicleComponent(vehicleid, 1010);
  56.     }
  57.     return true;
  58. }
  59.  
  60. public OnPlayerExitVehicle(playerid, vehicleid){
  61.     if(zNitro(vehicleid)){
  62.         HideProgressBarForPlayer(playerid, Barra[playerid]);
  63.         TextDrawHideForPlayer(playerid, TextDraw);
  64.     }
  65.     return true;
  66. }
  67.  
  68. public OnPlayerSpawn(playerid){
  69.     Nitro{playerid} = 100;
  70.    
  71.     return true;
  72. }
  73.  
  74.  
  75. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  76. {
  77.     if(IsPlayerInAnyVehicle(playerid) && zNitro(GetPlayerVehicleID(playerid)) && (oldkeys & 4)) {
  78.    
  79.        
  80.         TextDrawShowForPlayer(playerid, TextDraw);
  81.         if(Nitro{playerid} != 0){
  82.             RemoveVehicleComponent(GetPlayerVehicleID(playerid), 1010);
  83.             AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
  84.            
  85.             Nitro{playerid} -= 5;
  86.            
  87.             SetProgressBarValue(Barra[playerid], Nitro{playerid});
  88.             UpdateProgressBar(Barra[playerid], playerid);
  89.             ShowProgressBarForPlayer(playerid, Barra[playerid]);
  90.         }else{
  91.             RemoveVehicleComponent(GetPlayerVehicleID(playerid), 1010);
  92.         }
  93.     }
  94.    
  95.     return true;
  96. }
  97.  
  98.  
  99. CallBack::UpdateNos(vehicleid){
  100.     static
  101.         Interator
  102.     ;
  103.     for(Interator = 0; Interator != PlayersConectados; ++Interator){
  104.         if(IsPlayerInAnyVehicle(Interator)){
  105.             if(Nitro{Interator} < 100){
  106.                 Nitro{Interator} += 5;
  107.  
  108.                 SetProgressBarValue(Barra[Interator], Nitro{Interator});
  109.                 UpdateProgressBar(Barra[Interator], Interator);
  110.                 ShowProgressBarForPlayer(Interator, Barra[Interator]);
  111.             }
  112.         }
  113.     }
  114.     return true;
  115. }
  116.  
  117.  
  118. CallBack::zNitro(vehicleid){
  119.    switch(GetVehicleModel(vehicleid))
  120.    {
  121.      case
  122.           444, 581, 586, 481, 509, 446, 556, 443, 452, 453, 454, 472,
  123.           473, 484, 493, 495, 462, 463, 468, 521, 522, 417, 425, 447,
  124.           488, 497, 501, 548, 563, 406, 520, 539, 553, 557, 573, 460,
  125.           464, 476, 511, 512, 577, 592, 471, 448, 461, 523, 510, 487,
  126.           430, 465, 469, 513, 593, 419:
  127.           return false ;
  128.    }
  129.    return true ;
  130. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement