Guest User

VUP by Zh3r0

a guest
Aug 23rd, 2010
1,271
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.28 KB | None | 0 0
  1.  
  2.  
  3. #include <a_samp>
  4.  
  5.  
  6. #define VUP\
  7. 2008
  8. #define VUP2\
  9. 2009
  10. #define VUPSELKEY\
  11. 2010
  12. #define COLOR_RED\
  13. 0xAA3333AA
  14.  
  15. new
  16. VupKey[MAX_PLAYERS],
  17. Vup[MAX_PLAYERS],
  18. JumpSize[MAX_PLAYERS],
  19. E[2] = "3",
  20. H[2] = "h",
  21. Z[2] = "Z",
  22. R[2] = "r",
  23. O[2] = "0"
  24. ;
  25. stock IsNumeric(string[])
  26. {
  27. for (new i = 0, j = strlen(string); i < j; i++){if (string[i] > '9' || string[i] < '0')
  28. return 0;}
  29. return 1;
  30. }
  31. public OnFilterScriptInit(){printf("[[/vup by %s%s%s%s%s]]",Z,H,E,R,O); return 1;}
  32. public OnFilterScriptExit(){return 1;}
  33. public OnPlayerConnect(playerid){Vup[playerid] = 0;JumpSize[playerid] = 0;VupKey[playerid] = 0; return 1;}
  34. public OnPlayerDisconnect(playerid){Vup[playerid] = 0;JumpSize[playerid] = 0;VupKey[playerid] = 0; return 1;}
  35. public OnPlayerCommandText(playerid, cmdtext[])
  36. {
  37. if(!strcmp(cmdtext, "/vup",true) || !strcmp(cmdtext, "/vhop",true))
  38. {
  39. if(IsPlayerInAnyVehicle(playerid))
  40. {
  41. ShowPlayerDialog(playerid, VUP, DIALOG_STYLE_INPUT, "Size:", "Please insert the height that your car will hop!\nValues are: 1-4","Ok","Exit");
  42. }
  43. else
  44. {
  45. SendClientMessage(playerid, COLOR_RED, "Error: You are not in a vehicle.");
  46. return 1;
  47. }
  48. return 1;
  49. }
  50. if(!strcmp(cmdtext, "/vupoff",true) || !strcmp(cmdtext, "/vhopoff",true)){
  51. if(IsPlayerInAnyVehicle(playerid)){
  52. if(Vup[playerid] == 1){
  53. Vup[playerid] = 0;
  54. JumpSize[playerid] = 0;
  55. ShowPlayerDialog(playerid, VUP2, DIALOG_STYLE_MSGBOX, "Disabled:", "You stopped from using /vup.Type /vup again to HOP AGAIN!\n Current value: 0","Ok","Exit");
  56. }else ShowPlayerDialog(playerid, VUP2, DIALOG_STYLE_MSGBOX, "/VUP:", "/vup is currently OFF! \nTo enable it type /vup and type the requested numbers.","Ok","Exit");
  57. }else SendClientMessage(playerid, COLOR_RED, "Error: You are not in a vehicle.");
  58. return 1;}
  59. return 0;
  60. }
  61.  
  62. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  63. {
  64. if (IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER && Vup[playerid] == 1){
  65. if (newkeys & KEY_CROUCH && VupKey[playerid] == 1){
  66. new Float:xx, Float:xy, Float:xz;
  67. GetVehicleVelocity(GetPlayerVehicleID(playerid), xx, xy, xz);
  68. if(JumpSize[playerid] == 1){SetVehicleVelocity(GetPlayerVehicleID(playerid), xx, xy, xz + 0.1);}
  69. if(JumpSize[playerid] == 2){SetVehicleVelocity(GetPlayerVehicleID(playerid), xx, xy, xz + 0.2);}
  70. if(JumpSize[playerid] == 3){SetVehicleVelocity(GetPlayerVehicleID(playerid), xx, xy, xz + 0.3);}
  71. if(JumpSize[playerid] == 4){SetVehicleVelocity(GetPlayerVehicleID(playerid), xx, xy, xz + 0.4);}
  72. return 1;}
  73. if (newkeys & KEY_ACTION && VupKey[playerid] == 2){
  74. new Float:xx, Float:xy, Float:xz;
  75. GetVehicleVelocity(GetPlayerVehicleID(playerid), xx, xy, xz);
  76. if(JumpSize[playerid] == 1){SetVehicleVelocity(GetPlayerVehicleID(playerid), xx, xy, xz + 0.1);}
  77. if(JumpSize[playerid] == 2){SetVehicleVelocity(GetPlayerVehicleID(playerid), xx, xy, xz + 0.2);}
  78. if(JumpSize[playerid] == 3){SetVehicleVelocity(GetPlayerVehicleID(playerid), xx, xy, xz + 0.3);}
  79. if(JumpSize[playerid] == 4){SetVehicleVelocity(GetPlayerVehicleID(playerid), xx, xy, xz + 0.4);}
  80. return 1;}
  81. if (newkeys & KEY_FIRE && VupKey[playerid] == 3){
  82. new Float:xx, Float:xy, Float:xz;
  83. GetVehicleVelocity(GetPlayerVehicleID(playerid), xx, xy, xz);
  84. if(JumpSize[playerid] == 1){SetVehicleVelocity(GetPlayerVehicleID(playerid), xx, xy, xz + 0.1);}
  85. if(JumpSize[playerid] == 2){SetVehicleVelocity(GetPlayerVehicleID(playerid), xx, xy, xz + 0.2);}
  86. if(JumpSize[playerid] == 3){SetVehicleVelocity(GetPlayerVehicleID(playerid), xx, xy, xz + 0.3);}
  87. if(JumpSize[playerid] == 4){SetVehicleVelocity(GetPlayerVehicleID(playerid), xx, xy, xz + 0.4);}
  88. return 1;}
  89. }
  90. return 1;
  91. }
  92.  
  93. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  94. {
  95. if (dialogid == VUPSELKEY){
  96. if(response == 1){
  97. if(inputtext[0]){
  98. if(IsNumeric(inputtext[0])){
  99. new KeyString[256],
  100. KeyString2[50]
  101. ;
  102. if(inputtext[0] > '3')
  103. {
  104. format(KeyString, sizeof(KeyString), "ERROR!There is no number %d in the list below!\nWrite:\n\t1 - (H)Horn Key\n\t2 - (CTRL)Left CTRL\n\t3 - (FIRE)Left Click",inputtext,JumpSize[playerid]);
  105. ShowPlayerDialog(playerid, VUPSELKEY, DIALOG_STYLE_INPUT, "Succes:", KeyString,"Ok","Exit");
  106. }else{
  107. if(inputtext[0] == '1'){VupKey[playerid] = 1;KeyString2 = "(H)Horn Key";}
  108. if(inputtext[0] == '2'){VupKey[playerid] = 2;KeyString2 = "(CTRL)Left CTRL";}
  109. if(inputtext[0] == '3'){VupKey[playerid] = 3;KeyString2 = "(Fire)Left Click";}
  110. format(KeyString, sizeof(KeyString), "Succes!!\bYou selected %s, now press it to jump!\nType /vupoff to disable it!",KeyString2);
  111. ShowPlayerDialog(playerid, VUP2, DIALOG_STYLE_MSGBOX,"Succes!", KeyString,"Ok","Exit");
  112. }
  113. }
  114. }else{
  115. new JumpString[256];
  116. format(JumpString, sizeof(JumpString), "ERROR!No number found in the input!\nWrite:\n\t1 - (H)Horn Key\n\t2 - (CTRL)Left CTRL\n\t3 - (FIRE)Left Click",JumpSize[playerid]);
  117. ShowPlayerDialog(playerid, VUPSELKEY, DIALOG_STYLE_INPUT, "Succes:", JumpString,"Ok","Exit");
  118. }
  119. }
  120. if(response == 0)
  121. {
  122. Vup[playerid] = 0;
  123. JumpSize[playerid] = 0;
  124. VupKey[playerid] = 0;
  125. SendClientMessage(playerid, COLOR_RED, "You just disabled /vup.Type again to activate!");
  126. return 0;
  127. }
  128. }
  129. if (dialogid == VUP){
  130. if(response == 1){
  131. if(inputtext[0]){
  132. if(IsNumeric(inputtext[0])){
  133. if(inputtext[0] > '4'){ShowPlayerDialog(playerid, VUP, DIALOG_STYLE_INPUT, "Size:", "Please insert the height that your car will hop!\nValues are: 1-4","Ok","Exit");
  134. }else{
  135. new JumpString[256],
  136. InSetValue = strval(inputtext)
  137.  
  138. ;
  139.  
  140. Vup[playerid] = 1;
  141. JumpSize[playerid] = InSetValue;
  142. format(JumpString, sizeof(JumpString), "Succes!\nYou selected value %d!\nNow, select the number to select the button with wich\nyou will have to press to jump\nWrite:\n\t1 - (H)Horn Key\n\t2 - (CTRL)Left CTRL\n\t3 - (Fire)Left Click",JumpSize[playerid]);
  143. ShowPlayerDialog(playerid, VUPSELKEY, DIALOG_STYLE_INPUT, "Succes:", JumpString,"Ok","Exit");
  144. }
  145. if(inputtext[0] > 'E'){
  146. if(Vup[playerid] == 1){
  147. Vup[playerid] = 0;
  148. JumpSize[playerid] = 0;
  149. ShowPlayerDialog(playerid, VUP2, DIALOG_STYLE_MSGBOX, "Succes:", "Succes!\nYou disabled /VUP by typing E in the dialog..","Ok","Exit");}}
  150. if(inputtext[0] > '0'){
  151. }else ShowPlayerDialog(playerid, VUP, DIALOG_STYLE_INPUT, "Size:", "ERROR! Value 0 is incorrect!\nPlease insert again!Values are: 1-4","Ok","Exit");
  152. }else ShowPlayerDialog(playerid, VUP, DIALOG_STYLE_INPUT, "Size:", "ERROR!Only numbers allowed!\nPlease insert the height that your car will hop!\nValues are: 1-4","Ok","Exit");
  153. }else ShowPlayerDialog(playerid, VUP, DIALOG_STYLE_INPUT, "Size:", "Please insert the height that your car will hop!\nValues are: 1-4","Ok","Exit");
  154. }
  155. }
  156. return 1;
  157. }
Advertisement
Add Comment
Please, Sign In to add comment