Advertisement
Guest User

ColoredCheckpoint by White_116

a guest
May 21st, 2012
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.24 KB | None | 0 0
  1. #include <W_Points>//http://pastebin.com/kxdzWUQ9
  2. new PlayerOnPoint[MAX_PLAYERS];
  3. new PointsTimer;
  4.  
  5. public OnFilterScriptInit()
  6. {
  7.     CreateColoredCheckpoint(0.0,0.0,4.0,0x99FFFF00);
  8.     PointsTimer=SetTimer("PointsUpdate",200,1);//запуск псевдочекпойнтов.
  9.     return 1;
  10. }
  11.  
  12. public OnFilterScriptExit()
  13. {
  14.     for(new j=1;j<MAX_POINTS;j++)
  15.     if(PointInfo[j][Created])
  16.     if(PointInfo[j][Type1]==1)
  17.     {
  18.         DestroyObject(PointInfo[j][Type2]);
  19.         DestroyPoint(j);
  20.     }
  21.    
  22.     KillTimer(PointsTimer);
  23.     return 1;
  24. }
  25. //==============================================================================
  26. //==============================================================================
  27. forward PointsUpdate();
  28. public PointsUpdate()
  29. {
  30.     for(new playerid;playerid<MAX_PLAYERS;++playerid)
  31.     {
  32.         if(IsPlayerConnected(playerid) && !IsPlayerNPC(playerid))
  33.         {
  34.             new newppoint = GetPlayerPoint(playerid);
  35.             if(PlayerOnPoint[playerid]!=newppoint)
  36.             {
  37.                 if(PlayerOnPoint[playerid]!=0)
  38.                 OnPlayerLeaveColoredCheckpoint(playerid,PlayerOnPoint[playerid]);
  39.                 if(newppoint!=0)
  40.                 OnPlayerEnterColoredCheckpoint(playerid,newppoint);
  41.  
  42.                 PlayerOnPoint[playerid]= newppoint;
  43.             }
  44.         }
  45.     }
  46.     return 1;
  47. }
  48.  
  49. stock OnPlayerEnterColoredCheckpoint(playerid,pointid)
  50. {
  51.     new str[64];
  52.     format(str,64,"ты вошёл в точку %d",pointid);
  53.     SendClientMessage(playerid,0xFFFFFFFF,str);
  54.     return 1;
  55. }
  56.  
  57. stock OnPlayerLeaveColoredCheckpoint(playerid,pointid)
  58. {
  59.     new str[64];
  60.     format(str,64,"ты вышел из точки %d",pointid);
  61.     SendClientMessage(playerid,0xFFFFFFFF,str);
  62.     return 1;
  63. }
  64.  
  65. stock CreateColoredCheckpoint(Float: x, Float: y, Float: z, color)
  66. {
  67.     new pointid=CreatePoint(x,y,z,1.0,-1,1);
  68.     if(pointid)
  69.     {
  70.         PointInfo[pointid][Type2]=CreateObject(1317, x, y, z, 0.0, 0.0, 0.0);
  71.         SetObjectMaterial(PointInfo[pointid][Type2], 0, 18646, "none", "none", color);
  72.     }
  73.     return pointid;
  74. }
  75.  
  76. stock DestroyColoredCheckpoint(pointid)
  77. {
  78.     if(!IsValidPoint(pointid))return 0;
  79.     DestroyObject(PointInfo[pointid][Type2]);
  80.     return DestroyPoint(pointid);
  81. }
  82. //==============================================================================
  83. //==============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement