Adoniiz

aJumpCar + ZCMD/Y_CMD + SSCANF

Jan 2nd, 2013
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. #include <a_samp>
  2. #include <zcmd>
  3. #include <sscanf2>
  4.  
  5.  
  6. #define Rojo 0xFF0000FF
  7. #define VerdeC 0x00FF00FF
  8.  
  9. new Float:Jumping[MAX_PLAYERS];
  10.  
  11. public OnFilterScriptInit()
  12. {
  13. for (new i = 0; i < MAX_PLAYERS; i++)
  14. {
  15. if (IsPlayerConnected(i) && !IsPlayerNPC(i))
  16. {
  17. Jumping[i] = 0.2;
  18. }
  19. }
  20. return 1;
  21. }
  22.  
  23. public OnFilterScriptExit()
  24. {
  25. return 1;
  26. }
  27.  
  28. public OnPlayerConnect(playerid)
  29. {
  30. Jumping[playerid] = 0.2;
  31. return 1;
  32. }
  33. CMD:jumpcar(playerid,params[])
  34. {
  35. new string[128]; new Float:jumping;
  36. if(sscanf(params, "f", jumping)) return SendClientMessage(playerid, Rojo, "Uso: /jumpcar [0.0 - 0.5]");
  37. if(jumping < 0.0 || jumping > 0.5) return SendClientMessage(playerid, Rojo, "Uso: /jumpcar [0.0 - 0.5]");
  38. Jumping[playerid] = jumping;
  39. format(string,128, "* Has puesto el salto de tu vehiculo en %0.2f", Jumping[playerid]);
  40. SendClientMessage(playerid, VerdeC, string);
  41. return 1;
  42. }
  43.  
  44.  
  45. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  46. {
  47. if (IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
  48. {
  49. if (newkeys & KEY_CROUCH)
  50. {
  51. new Float:x, Float:y, Float:z;
  52. GetVehicleVelocity(GetPlayerVehicleID(playerid), x, y, z);
  53. SetVehicleVelocity(GetPlayerVehicleID(playerid), x, y, z + Jumping[playerid]);
  54. return 1;
  55. }
  56. }
  57. return 1;
  58. }
Advertisement
Add Comment
Please, Sign In to add comment