Advertisement
Guest User

Untitled

a guest
Dec 15th, 2011
397
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.04 KB | None | 0 0
  1. #include <a_samp>
  2. #include <mapandreas>
  3.  
  4. #define chopperid 497 //Die ID Vom helicopter (Chopper)
  5. #define ropelength 50 //Länge vom Seil (Ingame Meter)
  6. #define skinid 285 //Skin, welcher vom Seil "Abspringen"
  7.  
  8.  
  9. #define offsetz 12
  10. #define dur 250
  11.  
  12. new r0pes[MAX_PLAYERS][ropelength],Float:pl_pos[MAX_PLAYERS][5];
  13.  
  14. public OnFilterScriptInit()
  15. {
  16. MapAndreas_Init(MAP_ANDREAS_MODE_FULL);
  17. return 1;
  18. }
  19.  
  20. public OnFilterScriptExit()
  21. {
  22. return 1;
  23. }
  24.  
  25. public OnPlayerConnect(playerid)
  26. {
  27. return 1;
  28. }
  29.  
  30. public OnPlayerDisconnect(playerid, reason)
  31. {
  32. if(GetPVarInt(playerid,"geseilt") == 1)
  33. {
  34. for(new destr=0;destr<=ropelength;destr++)
  35. {
  36. DestroyObject(r0pes[playerid][destr]);
  37. }
  38. }
  39. return 1;
  40. }
  41.  
  42. public OnPlayerDeath(playerid, killerid, reason)
  43. {
  44. if(GetPVarInt(playerid,"geseilt") == 1)
  45. {
  46. for(new destr2=0;destr2<=ropelength;destr2++)
  47. {
  48. DestroyObject(r0pes[playerid][destr2]);
  49. }
  50. SetPVarInt(playerid,"geseilt",0);
  51. DisablePlayerCheckpoint(playerid);
  52. }
  53. return 1;
  54. }
  55.  
  56. public OnVehicleDeath(vehicleid, killerid)
  57. {
  58. if(GetVehicleModel(vehicleid) == chopperid)
  59. {
  60. for(new shg=0;shg<=MAX_PLAYERS;shg++)
  61. {
  62. if(GetPVarInt(shg,"chop_id") == vehicleid && GetPVarInt(shg,"geseilt") == 1)
  63. {
  64. DisablePlayerCheckpoint(shg);
  65. SetPVarInt(shg,"geseilt",0);
  66. DisablePlayerCheckpoint(shg);
  67. ClearAnimations(shg);
  68. TogglePlayerControllable(shg,1);
  69. for(new destr3=0;destr3<=ropelength;destr3++)
  70. {
  71. DestroyObject(r0pes[shg][destr3]);
  72. }
  73. }
  74. }
  75. }
  76. return 1;
  77. }
  78.  
  79. forward syncanim(playerid);
  80. public syncanim(playerid)
  81. {
  82. if(GetPVarInt(playerid,"geseilt") == 0) return 0;
  83. SetTimerEx("syncanim",dur,0,"i",playerid);
  84. ApplyAnimation(playerid,"ped","abseil",4.0,0,0,0,1,0);
  85. return 1;
  86. }
  87.  
  88. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  89. {
  90. if(GetVehicleModel(vehicleid) == chopperid && ispassenger)
  91. {
  92. SetPVarInt(playerid,"chop_id",GetPlayerVehicleID(playerid));
  93. SetPVarInt(playerid,"geseilt",0);
  94. }
  95. else SetPVarInt(playerid,"chop_id",0);
  96. return 1;
  97. }
  98.  
  99. public OnPlayerEnterCheckpoint(playerid)
  100. {
  101. if(GetPVarInt(playerid,"geseilt") == 1 && GetPlayerSkin(playerid) == skinid)
  102. {
  103. SetPVarInt(playerid,"geseilt",0);
  104. SetPVarInt(playerid,"chop_id",0);
  105. ClearAnimations(playerid);
  106. TogglePlayerControllable(playerid,0);
  107. TogglePlayerControllable(playerid,1);
  108. DisablePlayerCheckpoint(playerid);
  109. for(new destr4=0;destr4<=ropelength;destr4++)
  110. {
  111. DestroyObject(r0pes[playerid][destr4]);
  112. }
  113. }
  114.  
  115. return 1;
  116. }
  117.  
  118. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  119. {
  120. if(GetPlayerSkin(playerid) == skinid && GetPVarInt(playerid,"geseilt") == 0 && GetPlayerVehicleSeat(playerid) != 0 && IsPlayerInAnyVehicle(playerid) && (newkeys & KEY_SUBMISSION || newkeys == KEY_SUBMISSION))
  121. {
  122. GetPlayerPos(playerid,pl_pos[playerid][0],pl_pos[playerid][1],pl_pos[playerid][2]);
  123. MapAndreas_FindZ_For2DCoord(pl_pos[playerid][0],pl_pos[playerid][1],pl_pos[playerid][3]);
  124. pl_pos[playerid][4] = floatsub(pl_pos[playerid][2],pl_pos[playerid][3]);
  125. if(pl_pos[playerid][4] >= ropelength) return SendClientMessage(playerid,0xAA3333AA,"Du hast zuviel Angst, um von dieser Höhe zu springen.");
  126. if(pl_pos[playerid][4] <= 2) return RemovePlayerFromVehicle(playerid);
  127. SetPVarInt(playerid,"geseilt",1);
  128. SetPlayerCheckpoint(playerid,pl_pos[playerid][0],pl_pos[playerid][1],floatsub(pl_pos[playerid][3],offsetz),20);
  129. SetPlayerPos(playerid,pl_pos[playerid][0],pl_pos[playerid][1],floatsub(pl_pos[playerid][2],2));
  130. SetPlayerVelocity(playerid,0,0,0);
  131. for(new rep=0;rep!=10;rep++) ApplyAnimation(playerid,"ped","abseil",4.0,0,0,0,1,0);
  132. for(new cre=0;cre<=pl_pos[playerid][4];cre++)
  133. {
  134. r0pes[playerid][cre] = CreateObject(3004,pl_pos[playerid][0],pl_pos[playerid][1],floatadd(pl_pos[playerid][3],cre),87.640026855469,342.13500976563, 350.07507324219);
  135. }
  136. SetTimerEx("syncanim",dur,0,"i",playerid);
  137. }
  138. return 1;
  139. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement