Advertisement
Guest User

Hunting

a guest
Jan 16th, 2014
2,139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 3.31 KB | None | 0 0
  1. /* Deer Hunting CONCEPT
  2. This script is designed to show the basics to a dear hunting system
  3. using SA:MP 0.3Z functions.
  4. Edit it to fit your standards, and re release it as you like
  5. This script is unlicensed, and therefore, credits are not a requirement.
  6. If you re release it, PM me a link to the thread, i'd love to see what
  7. others did with my concept!
  8.  
  9. Made by: Mattakil of SA:MP forums.
  10. */
  11.  
  12. //                              Let's begin!
  13. //=%=%=%=%=%=%=%=%=%=%=%=%=%=%=%=%=%=%=%=%=%=%=%=%=%=%=%=%=%=%=%=%=%=%=%=%=%=%=%
  14.  
  15. #include <a_samp>
  16. #include <zcmd>
  17.  
  18. //==============================================================================
  19. //                                  DEFINES
  20.  
  21. #define SpawnTime 60000 //time in milliseconds before the deer changes position
  22. #define Deer 19315 //the object for the deer
  23. #define MaxDeer 1 //how many deer you want spawned, for testing purposes I spawn 1.
  24.  
  25. #define red 0xFF0000FF
  26. #define yellow 0xFFFF00FF
  27. #define blue 0x0000FFFF
  28. //==============================================================================
  29.  
  30.  
  31. //==============================================================================
  32. //                              New functions
  33.  
  34. new Float:positions[][3] = //array of positions where the deer will spawn
  35. {
  36.     {2456.7625, -124.3695, 30.1576},
  37.     {2593.3740, -114.2172, 48.5642},
  38.     {2598.4680, -225.4654, 35.6671},
  39.     {2330.8091, -164.9444, 22.7093} //Last position does not have comma.
  40. };
  41.  
  42. new DeerCreated[MaxDeer];
  43. //==============================================================================
  44.  
  45.  
  46. //==============================================================================
  47. //                              CALLBACKS
  48.  
  49. public OnFilterScriptInit()
  50. {
  51.     for(new i; i<=MaxDeer; i++)
  52.     {
  53.         DeerCreated[i] = CreateObject(Deer, 2330.8091, -164.9444, 22.7093, 0.0, 0.0, 0.0);
  54.     }
  55.     SetTimer("OnDeerRespawn", SpawnTime, true);
  56.     return 1;
  57. }
  58.  
  59. public OnFilterScriptExit()
  60. {
  61.     for(new i; i<=MaxDeer; i++)
  62.     {
  63.         DestroyObject(DeerCreated[i]);
  64.     }
  65.     return 1;
  66. }
  67.  
  68. forward OnDeerRespawn();
  69. public OnDeerRespawn()
  70. {
  71.     new ran = random(sizeof(positions));
  72.     for(new i; i<=MaxDeer; i++)
  73.     {
  74.         SetObjectPos(DeerCreated[i], positions[ran][0], positions[ran][1], positions[ran][2]);
  75.     }
  76.     return 1;
  77. }
  78.  
  79. public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
  80. {
  81.     if(hittype == 3)
  82.     {
  83.         new Float:X, Float:Y, Float:Z;
  84.         GetObjectPos(hitid, X, Y, Z);
  85.         SetObjectRot(hitid, 90, 0, 0);
  86.         SetObjectPos(hitid, X, Y, Z-0.4);
  87.         SendClientMessage(playerid, blue, "[{ffff00}i{0000ff}] {f0f0f0}You hit the deer!");
  88.         return 1;
  89.     }
  90.     return 1;
  91. }
  92. //==============================================================================
  93.  
  94.  
  95. //==============================================================================
  96. //                                  COMMANDS
  97.  
  98. CMD:rifle(playerid)
  99. {
  100.     GivePlayerWeapon(playerid, 33, 50);
  101.     SendClientMessage(playerid, blue, "[{ffff00}i{0000ff}] {f0f0f0}You spawned a rifle.");
  102.     return 1;
  103. }
  104.  
  105. CMD:gotodeer(playerid)//THIS COMMAND WILL HAVE TO BE EDITED IF YOU HAVE MORE THAN 1 DEER!
  106. {
  107.     new Float:X, Float:Y, Float:Z;
  108.     GetObjectPos(DeerCreated[0], X, Y, Z);
  109.     SetPlayerPos(playerid, X, Y+1, Z);
  110.     SendClientMessage(playerid, blue, "[{ffff00}i{0000ff}] {f0f0f0}You have teleported to the deer.");
  111.     return 1;
  112. }
  113.  
  114. CMD:huntinghelp(playerid)
  115. {
  116.     SendClientMessage(playerid, red, "Commands: {00FF00}/rifle /gotodeer");
  117.     return 1;
  118. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement