Guest User

/spec

a guest
Mar 25th, 2018
309
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.14 KB | None | 0 0
  1. CMD:spec(playerid, params[])
  2. {
  3. if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to login first.");
  4. if(IsPlayerConnected(playerid))
  5. {
  6. if(PlayerInfo[playerid][pAdmin] >= 1 || PlayerInfo[playerid][pHelper] >= 2)
  7. {
  8. new id,giveplayer[25],string[256],sendername[25];
  9. if(sscanf(params, "u", id)) return SCM(playerid,COLOR_WHITE,"{FF9900}Scrie: {33CCFF}/spec <Name/Playerid>");
  10. {
  11. if(IsPlayerConnected(id))
  12. {
  13. if(id != INVALID_PLAYER_ID)
  14. {
  15. if(id == playerid) return SendClientMessage(playerid, 0xFFFFFFFF, "Nu poti folosi /spec pe tine.");
  16. if(PlayerInfo[id][pAdmin] >= 6 && PlayerInfo[playerid][pAdmin] < 6) return SendClientMessage(playerid, 0xFFFFFFFF, "Nu poti folosi /spec pe admini de level 6+");
  17. if(Spectate[playerid] == -1)
  18. {
  19. BeforeSpectate[playerid][pState] = GetPlayerState(playerid);
  20. BeforeSpectate[playerid][pWorld] = GetPlayerVirtualWorld(playerid);
  21. BeforeSpectate[playerid][pInt] = GetPlayerInterior(playerid);
  22. BeforeSpectate[playerid][pSpectating] = true;
  23. new Float: x, Float: y, Float: z;
  24. GetPlayerPos(playerid, x, y, z);
  25.  
  26. if(!IsPlayerInAnyVehicle(playerid))
  27. {
  28. BeforeSpectate[playerid][pOldPos][0] = x;
  29. BeforeSpectate[playerid][pOldPos][1] = y;
  30. BeforeSpectate[playerid][pOldPos][2] = z;
  31. }
  32. else
  33. BeforeSpectate[playerid][pInVehicle] = GetPlayerVehicleID(playerid);
  34. }
  35. Spectate[playerid] = id;
  36. new Float:health;
  37. GetPlayerHealthEx(Spectate[playerid], health);
  38. GetPlayerName(Spectate[playerid], giveplayer, sizeof(giveplayer));
  39. GetPlayerName(playerid, sendername, sizeof(sendername));
  40. if(reportreason[id] == 0 && HaveCheats[id] == 0)
  41. {
  42. format(string, sizeof(string), "Admin/Helper %s is now spectating %s.",sendername,giveplayer);
  43. }
  44. else if(reportreason[id] == 1 && PlayerInfo[playerid][pAdmin] >= 1)
  45. {
  46. format(string, sizeof(string), "Admin %s is now spectating %s (reported for being stuck).",sendername,giveplayer);
  47. ReportTime[id] = 0;
  48. format(reporttext[id], 30, "NULL");
  49. format(cheattext[id], 30, "NULL");
  50. reportcheater[id] = -1;
  51. reportreason[id] = 0;
  52. PlayerInfo[playerid][pCrPlayers]++;
  53. Update(playerid, pCrPlayersx);
  54. if(playerreported[id] != -1)
  55. {
  56. reportreason[playerreported[id]] = 0;
  57. }
  58. playerreported[id] = -1;
  59. }
  60. else if(reportreason[id] == 2 && PlayerInfo[playerid][pAdmin] >= 1)
  61. {
  62. format(string, sizeof(string), "Admin %s is now spectating %s (reported for DM).",sendername,giveplayer);
  63. ReportTime[id] = 0;
  64. format(reporttext[id], 30, "NULL");
  65. format(cheattext[id], 30, "NULL");
  66. reportcheater[id] = -1;
  67. reportreason[id] = 0;
  68. PlayerInfo[playerid][pCrPlayers]++;
  69. Update(playerid, pCrPlayersx);
  70. if(playerreported[id] != -1)
  71. {
  72. reportreason[playerreported[id]] = 0;
  73. }
  74. playerreported[id] = -1;
  75. }
  76. else if(reportreason[id] == 3 && PlayerInfo[playerid][pAdmin] >= 1 || HaveCheats[id] == 1 && PlayerInfo[playerid][pAdmin] >= 1)
  77. {
  78. format(string, sizeof(string), "Admin %s is now spectating %s (reported for cheats).",sendername,giveplayer);
  79. ReportTime[id] = 0;
  80. format(reporttext[id], 30, "NULL");
  81. format(cheattext[id], 30, "NULL");
  82. reportcheater[id] = -1;
  83. reportreason[id] = 0;
  84. HaveCheats[id] = 0;
  85. CheatsReason[id] = "NULL";
  86. Citsreas[id] = "NULL";
  87. PlayerInfo[playerid][pCrPlayers]++;
  88. Update(playerid, pCrPlayersx);
  89. if(playerreported[id] != -1)
  90. {
  91. reportreason[playerreported[id]] = 0;
  92. }
  93. playerreported[id] = -1;
  94. }
  95. KillTimer(timerreport[id]);
  96. ABroadCast(COLOR_YELLOW,string,1);
  97. format(string, sizeof(string), "(%d) %s | Level: %d | Health: %.0f | AFK: %d | Duty: %d | Ping: %d",Spectate[playerid],giveplayer,PlayerInfo[Spectate[playerid]][pLevel],health,IsPlayerAFK[Spectate[playerid]],OnDuty[Spectate[playerid]],GetPlayerPing(Spectate[playerid]));
  98. SendClientMessage(playerid, COLOR_DARKPINK, string);
  99. TogglePlayerSpectating(playerid, 1);
  100. if(IsPlayerInAnyVehicle(Spectate[playerid]))
  101. {
  102. new carid = GetPlayerVehicleID(Spectate[playerid]);
  103. PlayerSpectateVehicle(playerid, carid);
  104. SpectateState[id] = 2;
  105. }
  106. else
  107. {
  108. PlayerSpectatePlayer(playerid, Spectate[playerid]);
  109. SpectateState[id] = 1;
  110. }
  111. PlayerTextDrawSetString(playerid, TextDrawSpec[playerid][1], "LOADING...");
  112. PlayerTextDrawShow(playerid, TextDrawSpec[playerid][1]);
  113. }
  114. }
  115. else
  116. {
  117. SendClientMessage(playerid, COLOR_WHITE, "{FFFFCC}Error: Player not connected.");
  118. }
  119. }
  120. }
  121. else
  122. {
  123. SendClientMessage(playerid, COLOR_DARKNICERED, AdminOnly);
  124. return 1;
  125. }
  126. }
  127. return 1;
  128. }
Advertisement
Add Comment
Please, Sign In to add comment