LucasRed

Checkpoints

Jul 2nd, 2018
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.51 KB | None | 0 0
  1. function onScriptLoad()
  2. {
  3.     myCheckpoint <- array( 500, null );
  4.  
  5.     LoadCheckpoints()
  6.     {
  7.         CreateCheckpoints();
  8.     }
  9. }
  10.  
  11. // Preparação
  12. function LoadCheckpoints()
  13. {
  14.     // Aqui é pedir pra se foder; Criar manualmente :)
  15.     myCheckpoint[0] = { Player = null, World = 1, IsSphere = true, Position = [ 141.977, -1363.74, 13.1827 ], RGB = [ 0, 0, 0 ], Radius = 20.0 }; // Tipo Shere
  16.     myCheckpoint[1] = { Player = null, World = 1, IsSphere = false, Position = [ -975.007, -826.021, 6.80091 ], RGB = [ 0, 139, 139 ], Radius = 3.0 }; // Tipo Checkpoint
  17. }
  18.  
  19. // Criação
  20. function CreateCheckpoints()
  21. {
  22.     local MAX_CHECKPOINTS = myCheckpoint.len(), CP_COUNT = 0;
  23.     while ( CP_COUNT <= MAX_CHECKPOINTS )
  24.     {
  25.         if ( myCheckpoint[CP_COUNT] )
  26.         {
  27.             local CP = myCheckpoint[CP_COUNT];
  28.             CreateCheckpoint( CP["Player"], CP["World"], CP["IsSphere"], Vector( CP["Position"][0], CP["Position"][1], CP["Position"][2], ARGB( CP["RGB"][0], CP["RGB"][1], CP["RGB"][2], 255 ), CP["Radius"] ) );
  29.         }
  30.         CP_COUNT ++;
  31.     }
  32. }
  33.  
  34. function onCheckpointEntered( player, checkpoint )
  35. {
  36.     local CP = myCheckpoint[ checkpoint.ID ];
  37.     if ( CP["IsSphere"] ) PrivMessage( player, "Voce entrou em um checkpoint do tipo sphere." );
  38.     else PrivMessage( player, "Voce entrou em um checkpoint normal." );
  39. }
  40.  
  41. function onCheckpointExited( player, checkpoint )
  42. {
  43.     local CP = myCheckpoint[ checkpoint.ID ];
  44.     if ( CP["IsSphere"] ) PrivMessage( player, "Voce saiu de um checkpoint do tipo sphere." );
  45.     else PrivMessage( player, "Voce saiu de um checkpoint normal." );
  46. }
Advertisement
Add Comment
Please, Sign In to add comment