Advertisement
RuiGy

Dynamic Zones Simple Test Script

Aug 2nd, 2012
283
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.23 KB | None | 0 0
  1. /* Bare script edited, thanks to the original author.*/
  2.  
  3. #include <a_samp>
  4.  
  5. #if defined MAX_GANG_ZONES
  6.     #undef MAX_GANG_ZONES
  7. #endif
  8. #define MAX_GANG_ZONES 2
  9.  
  10. #include <dzones>
  11.  
  12. new g_los_santos_zone;
  13.  
  14. main()
  15. {
  16.     print("\n----------------------------------");
  17.     print("  (Bare) Test Script\n");
  18.     print("----------------------------------\n");
  19. }
  20.  
  21. public OnPlayerCommandText(playerid, cmdtext[])
  22. {
  23.     new idx;
  24.     new cmd[256];
  25.    
  26.     cmd = strtok(cmdtext, idx);
  27.  
  28.     if(strcmp(cmd, "/gotoarea", true) == 0) {
  29.         ShowDynamicZoneForPlayer( playerid, g_los_santos_zone );
  30.         SetPlayerPos( playerid, 1482.26, -1650.28, 15.0 );
  31.         return 1;
  32.     }
  33.  
  34.     return 0;
  35. }
  36.  
  37. public OnPlayerEnterDynamicZone(playerid, zoneid)
  38. {
  39.     SendClientMessage(playerid, -1, "Welcome to the zone, you make it flash.");
  40.     FlashDynamicZoneForPlayer(playerid, g_los_santos_zone, 0xFF00007F);
  41.     return 1;
  42. }
  43.  
  44. public OnPlayerExitDynamicZone(playerid, zoneid)
  45. {
  46.     SendClientMessage(playerid, -1, "You quit the zone, it won't flash anymore.");
  47.     StopFlashDynamicZoneForPlayer(playerid, g_los_santos_zone);
  48.     return 1;
  49. }
  50.  
  51. public OnPlayerSpawn(playerid)
  52. {
  53.     SetPlayerInterior(playerid,0);
  54.     TogglePlayerClock(playerid,0);
  55.     return 1;
  56. }
  57.  
  58. SetupPlayerForClassSelection(playerid)
  59. {
  60.     SetPlayerInterior(playerid,14);
  61.     SetPlayerPos(playerid,258.4893,-41.4008,1002.0234);
  62.     SetPlayerFacingAngle(playerid, 270.0);
  63.     SetPlayerCameraPos(playerid,256.0815,-43.0475,1004.0234);
  64.     SetPlayerCameraLookAt(playerid,258.4893,-41.4008,1002.0234);
  65. }
  66.  
  67. public OnPlayerRequestClass(playerid, classid)
  68. {
  69.     SetupPlayerForClassSelection(playerid);
  70.     return 1;
  71. }
  72.  
  73. public OnGameModeInit()
  74. {
  75.     SetGameModeText("Bare Script");
  76.  
  77.     AddPlayerClass(299,1958.3783,1343.1572,15.3746,270.1425,0,0,0,0,-1,-1);
  78.     g_los_santos_zone = CreateDynamicZone( 1444.231, -1741.078, 1539.302, -1595.012, 0xFFFFFF7F );
  79.  
  80.     return 1;
  81. }
  82.  
  83. strtok(const string[], &index)
  84. {
  85.     new length = strlen(string);
  86.     while ((index < length) && (string[index] <= ' '))
  87.     {
  88.         index++;
  89.     }
  90.  
  91.     new offset = index;
  92.     new result[20];
  93.     while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
  94.     {
  95.         result[index - offset] = string[index];
  96.         index++;
  97.     }
  98.     result[index - offset] = EOS;
  99.     return result;
  100. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement