Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.98 KB | None | 0 0
  1. CMD:risti(playerid,params[])
  2. {
  3. if (!playerDB[playerid][virve])
  4. return SendClientMessage(playerid, RED, "Jūs neturite virvės.");
  5.  
  6. new id;
  7.  
  8. if (sscanf(params, "u", id))
  9. return SendClientMessage(playerid, BLUE, "Surišti/atrišti žaidėją: /risti [vardo_dalis]");
  10.  
  11. if (id == playerid || id == INVALID_PLAYER_ID)
  12. return SendClientMessage(playerid, RED, "Tokio žaidėjo nėra!");
  13.  
  14. if ((IsPlayerInAnyVehicle(playerid) && GetPlayerState(id) == PLAYER_STATE_ONFOOT)
  15. || (IsPlayerInAnyVehicle(id) && GetPlayerState(playerid) == PLAYER_STATE_ONFOOT))
  16. return SendClientMessage(playerid, RED, "Tiek jūs, tiek žaidėjas turi būti ant kojų/mašinoje");
  17.  
  18. new Float: risPos[3];
  19. GetPlayerPos(id, risPos[0], risPos[1], risPos[2]);
  20.  
  21. if (!IsPlayerInRangeOfPoint(playerid, 5, risPos[0], risPos[1], risPos[2]))
  22. return SendClientMessage(playerid, RED, "Jūs esate per toli.");
  23.  
  24. new cuffPlayer[71];
  25.  
  26. if (IsPlayerInAnyVehicle(playerid) && IsPlayerInVehicle(id, GetPlayerVehicleID(playerid)))
  27. {
  28. new Seat[2];
  29.  
  30. Seat[0] = GetPlayerVehicleSeat(playerid);
  31. Seat[1] = GetPlayerVehicleSeat(id);
  32.  
  33. if ((Seat[0] == 2 || Seat[1] == 3) && (Seat[1] == 2 || Seat[1] == 3))
  34. {
  35. format(cuffPlayer, 70, "%s {FFFFFF}jus bando {FF0000}%s.", PlayerName(playerid), (playerDB[id][gcuffed]) ? ("bando atrišti") : ("bando surišti"));
  36. SendClientMessage(id, 0xFF0000FF, cuffPlayer);
  37.  
  38. format(cuffPlayer, 70, "Jūs bandote {FF0000}%s {FFFFFF}%s", PlayerName(id), (!playerDB[id][gcuffed]) ? ("surišti") : ("atrišti"));
  39. SendClientMessage(playerid, 0xFFFFFFFF, cuffPlayer);
  40.  
  41. SetTimerEx("CuffPlayer", 5000, false, "dddfff", playerid, id, (playerDB[id][gcuffed]) ? (true) : (false), 0.0, 0.0, 0.0);
  42. }
  43. else
  44. SendClientMessage(playerid, COLOR_RED, "Jus arba žaidėjas kurį norite surakinti nesėdi tr. priemonės gale.");
  45. }
  46. else if (GetPlayerState(playerid) == PLAYER_STATE_ONFOOT && GetPlayerState(id) == PLAYER_STATE_ONFOOT)
  47. {
  48. format(cuffPlayer, 70, "%s {FFFFFF}jus bando {FF0000}%s.", PlayerName(playerid), (playerDB[id][gcuffed]) ? ("bando atrišti") : ("bando surišti"));
  49. SendClientMessage(id, 0xFF0000FF, cuffPlayer);
  50.  
  51. format(cuffPlayer, 70, "Bandote {FF0000}%s {FFFFFF}%s", PlayerName(id), (!playerDB[id][gcuffed]) ? ("surišti") : ("atrišti"));
  52. SendClientMessage(playerid, 0xFFFFFFFF, cuffPlayer);
  53.  
  54. SetTimerEx("CuffPlayer", 5000, false, "dddfff", playerid, id, (playerDB[id][gcuffed]) ? (true) : (false), Pos[0], Pos[1], Pos[2]);
  55. }
  56. return true;
  57. }
  58.  
  59. forward CuffPlayer(playerid, id, bool: ristate, Float: risX, Float: risY, Float: risZ);
  60. public CuffPlayer(playerid, id, bool: ristate, Float: risX , Float: risY, Float: risZ)
  61. {
  62. new cuffPlayer[39];
  63. if (ristate)
  64. {
  65. playerDB[playerid][virve] = true;
  66. playerDB[id][gcuffed] = false;
  67.  
  68. if (GetPlayerSpecialAction(id) == SPECIAL_ACTION_CUFFED)
  69. {
  70. SetPlayerSpecialAction(id, SPECIAL_ACTION_NONE);
  71. }
  72.  
  73. TogglePlayerControllable(id, true);
  74.  
  75. format(cuffPlayer, 36, "Atrišote %s.", PlayerName(id));
  76. SendClientMessage(playerid, GREEN, cuffPlayer);
  77.  
  78. format(cuffPlayer, 38, "Jus atrišo %s.", PlayerName(playerid));
  79. SendClientMessage(id, RED, cuffPlayer);
  80. }
  81. else
  82. {
  83. new Float: risPos[3];
  84. GetPlayerPos(id, risPos[0], risPos[1], risPos[2]);
  85.  
  86. if ((risPos[0] != risX || risPos[1] != risY || risPos[2] != risZ) || !IsPlayerInRangeOfPoint(playerid, 5, risPos[0], risPos[1], risPos[2]))
  87. return SendClientMessage(playerid, RED, "ˇaidejo surišti nepavyko, rišant tiek jus tiek rišamas ˛aidejas turi nejudeti.");
  88.  
  89. playerDB[playerid][virve] = false;
  90. playerDB[id][gcuffed] = true;
  91.  
  92. if (GetPlayerState(id) == PLAYER_STATE_ONFOOT)
  93. {
  94. SetPlayerSpecialAction(id, SPECIAL_ACTION_CUFFED);
  95. }
  96.  
  97. TogglePlayerControllable(id, false);
  98.  
  99. format(cuffPlayer, 36, "Surišote %s.", PlayerName(id));
  100. SendClientMessage(playerid, GREEN, cuffPlayer);
  101.  
  102. format(cuffPlayer, 38, "Jus surišo %s.", PlayerName(playerid));
  103. SendClientMessage(id, RED, cuffPlayer);
  104. }
  105. return true;
  106. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement