Advertisement
Guest User

Untitled

a guest
Nov 3rd, 2015
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PCRE 2.16 KB | None | 0 0
  1. // w OnGameModeInit:
  2. SetTimer("Update", 150, true);
  3. SetTimer("OnSecondTimer", 1000, true);
  4.  
  5. // na górze mapy, dawałem też bez MAX_PLAYERS i też nie działało jak trzeba:
  6. new FleshFoto[MAX_PLAYERS] = 0;
  7. new ViaBlip[MAX_PLAYERS] =;
  8. public Update()
  9. {
  10.     static Float:vhealth, Float:VehidHealth, string[256], string2[256];
  11.     Loop(i, GetMaxPlayers())
  12.     {
  13.         Loop(photoid, MAX_PHOTO_RADARS)
  14.         {
  15.             if(PhotoRadar[photoid][pUID])
  16.                 {
  17.                     if(IsPlayerInRangeOfPoint(i, 8.0, PhotoRadar[photoid][pPosX], PhotoRadar[photoid][pPosY], PhotoRadar[photoid][pPosZ]))
  18.                     {
  19.                         if(speed > PhotoRadar[photoid][pMaxSpeed] && GetPlayerState(i) == PLAYER_STATE_DRIVER)
  20.                         {
  21.                             if(!GetPVarInt(i, "Fotoradar"))
  22.                             {
  23.                             TextDrawShowForPlayer(i, FleshText[i]);
  24.                             FleshFoto[i] = 2; // tutaj ustawiam sekundy po jakim zniknie textdraw 'FleshText' (tutaj 2 sekundy)
  25.                             SetPVarInt(i, "Fotoradar", 1);
  26.                     }
  27.                         }
  28.             }
  29.         }
  30.         Loop(viaid, MAX_VIA)
  31.         {
  32.                 if(!GetPVarInt(i, "via"))
  33.             {
  34.                     if(IsPlayerInRangeOfPoint(i, 5.0, via[viaid][vPosX], via[viaid][vPosY], via[viaid][vPosZ]))
  35.                     {
  36.                         if(GetPlayerState(i) == PLAYER_STATE_DRIVER && PlayerVehicleIsTruck(i))
  37.                     {
  38.                         TextDrawShowForPlayer(i, toll[i]);
  39.                         SetPVarInt(i, "via", 1);
  40.                         ViaBlip[i] = 5; // tutaj ustawiam po jakim czasie zniknie textdraw 'toll' (5 sekund)
  41.                     }
  42.                 }
  43.             }
  44.         }
  45.     }
  46.     return 1;
  47. }
  48.  
  49. // teraz te czasy ustawione w publicu Update zeruje w publicu OnSecondTimer odświeżającym się co sekundę:
  50. public OnSecondTimer()
  51. {
  52.     Loop(i, GetMaxPlayers())
  53.     {
  54.         if(FleshFoto[i])
  55.         {
  56.                 if(GetPVarInt(i, "Fotoradar") == 1)
  57.                 {
  58.                     FleshFoto[i] --;
  59.                     if(FleshFoto[i] <= 0)
  60.                     {
  61.                             TextDrawHideForPlayer(i, FleshText[i]);
  62.                             DeletePVar(i, "Fotoradar");
  63.                 }
  64.                 }  
  65.         }
  66.         if(ViaBlip[i])
  67.         {
  68.                 if(GetPVarInt(i, "via") == 1)
  69.                 {
  70.                     iaBlip[i]--;
  71.                 if(ViaBlip[i] <= 0)
  72.                 {
  73.                         TextDrawHideForPlayer(i, toll[i]);
  74.                         DeletePVar(i, "via");
  75.                 }
  76.             }
  77.         }
  78.     }
  79.     return 1;
  80. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement