Advertisement
Guest User

Untitled

a guest
Nov 19th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.44 KB | None | 0 0
  1. if (strcmp(cmd, "/tv", true) == 0)
  2. {
  3. if (IsPlayerConnected(playerid))
  4. {
  5. if (PlayerInfo[playerid][pAdmin] >= 1)
  6. {
  7. tmp = strtok(cmdtext, idx);
  8. if (!strlen(tmp))
  9. {
  10. if (TVInfo[playerid][istv] == 1)
  11. {
  12. EndSpectate(playerid);
  13.  
  14. format(string, sizeof(string), "> %s hat das Beobachten beendet.", FullName(playerid));
  15. ABroadCast(COLOR_ADMINBLUE, string, PlayerInfo[playerid][pAdmin]);
  16. UCBroadCast(COLOR_ADMINBLUE, string, 1);
  17. return 1;
  18. }
  19. else
  20. {
  21. SendClientMessage(playerid, COLOR_GRAD2, "Befehl: /tv [playerid]");
  22. return 1;
  23. }
  24. }
  25.  
  26. new pid;
  27. pid = ReturnUser(tmp);
  28.  
  29. if (!IsPlayerConnected(pid)) return SendClientMessage(playerid, COLOR_GREY, "Der angegebene Spieler ist nicht verbunden.");
  30. if (!gPlayerLogged[pid]) return SendClientMessage(playerid, COLOR_GREY, "Der angegebene Spieler ist nicht eingeloggt.");
  31. if (pid == playerid) return SendClientMessage(playerid, COLOR_GREY, "Du kannst dich nicht selbst beobachten.");
  32. if (GetPlayerState(pid) == PLAYER_STATE_SPECTATING)
  33. {
  34. if (PlayerInfo[pid][pUCAdmin] == 1)
  35. {
  36. SendClientMessage(playerid, COLOR_WHITE, " ");
  37. return 1;
  38. }
  39. else
  40. {
  41. SendClientMessage(playerid, COLOR_GREY, "Der Spieler beobachtet aktuell jemanden.");
  42. return 1;
  43. }
  44. }
  45.  
  46. TVInfo[playerid][tvdeath] = 0;
  47. TVInfo[playerid][tvplayer] = pid;
  48. TVInfo[playerid][tvadmin] = playerid;
  49. TVInfo[playerid][tvint] = GetPlayerInterior(pid);
  50. TVInfo[playerid][tvvir] = GetPlayerVirtualWorld(pid);
  51.  
  52. if (TVInfo[playerid][istv] != 1)
  53. {
  54. new Float:pos[3];
  55. GetPlayerPos(playerid, pos[0],pos[1],pos[2]);
  56.  
  57. new Float:health, Float:armour;
  58. GetPlayerHealth(playerid, health);
  59. GetPlayerArmour(playerid, armour);
  60.  
  61. TVInfo[playerid][tvhp] = health;
  62. TVInfo[playerid][tvam] = armour;
  63.  
  64. TVInfo[playerid][tvx] = pos[0];
  65. TVInfo[playerid][tvy] = pos[1];
  66. TVInfo[playerid][tvz] = pos[2];
  67.  
  68. TVInfo[playerid][tvoldint] = GetPlayerInterior(playerid);
  69. TVInfo[playerid][tvoldvir] = GetPlayerVirtualWorld(playerid);
  70.  
  71. for (new i; i < 13; i++)
  72. {
  73. SpectateWeaponID[playerid][i] = 0;
  74. SpectateWeaponAMMO[playerid][i] = 0;
  75.  
  76. GetPlayerWeaponData(playerid, i, SpectateWeaponID[playerid][i], SpectateWeaponAMMO[playerid][i]);
  77. }
  78.  
  79. SetPlayerInterior(playerid, GetPlayerInterior(pid));
  80. SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(pid));
  81.  
  82. TogglePlayerSpectating(playerid, 1);
  83.  
  84. if (IsPlayerInAnyVehicle(pid))
  85. {
  86. TVInfo[playerid][tvstate] = 1;
  87. PlayerSpectateVehicle(playerid, GetPlayerVehicleID(pid));
  88. }
  89. else
  90. {
  91. TVInfo[playerid][tvstate] = 0;
  92. PlayerSpectatePlayer(playerid, pid);
  93. }
  94.  
  95. format(string, sizeof(string), "> %s beobachtet nun %s.", FullName(playerid), FullName(pid));
  96. ABroadCast(COLOR_ADMINBLUE, string, PlayerInfo[playerid][pAdmin]);
  97. UCBroadCast(COLOR_ADMINBLUE, string, 1);
  98.  
  99. for (new i; i < MAX_PLAYERS; i ++)
  100. {
  101. if (!gPlayerLogged[i]) continue;
  102. if (!PlayerInfo[i][pAdmin]) continue;
  103. if (!TVInfo[i][istv]) continue;
  104.  
  105. if (playerid == TVInfo[i][tvplayer])
  106. {
  107. EndSpectate(i);
  108. }
  109. }
  110.  
  111. TVInfo[playerid][istv] = 1;
  112. }
  113. else
  114. {
  115. SetPlayerInterior(playerid, GetPlayerInterior(pid));
  116. SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(pid));
  117.  
  118. TogglePlayerSpectating(playerid, 1);
  119.  
  120. if (IsPlayerInAnyVehicle(pid))
  121. {
  122. TVInfo[playerid][tvstate] = 1;
  123. PlayerSpectateVehicle(playerid, GetPlayerVehicleID(pid));
  124. }
  125. else
  126. {
  127. TVInfo[playerid][tvstate] = 0;
  128. PlayerSpectatePlayer(playerid, pid);
  129. }
  130.  
  131. format(string, sizeof(string), "> %s beobachtet nun %s.", FullName(playerid), FullName(pid));
  132. ABroadCast(COLOR_ADMINBLUE, string, PlayerInfo[playerid][pAdmin]);
  133. UCBroadCast(COLOR_ADMINBLUE, string, 1);
  134.  
  135. for (new i; i < MAX_PLAYERS; i ++)
  136. {
  137. if (!gPlayerLogged[i]) continue;
  138. if (!PlayerInfo[i][pAdmin]) continue;
  139. if (!TVInfo[i][istv]) continue;
  140.  
  141. if (playerid == TVInfo[i][tvplayer])
  142. {
  143. EndSpectate(i);
  144. }
  145. }
  146.  
  147. TVInfo[playerid][istv] = 1;
  148. }
  149. }
  150.  
  151. return 1;
  152. }
  153. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement