LeXuZ_

[HELP] Spec

Nov 8th, 2014
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.80 KB | None | 0 0
  1. ACMD:spec(playerid, params[])
  2. {
  3. new Float:x, Float:y, Float:z;
  4. if(SpecStats == 0)
  5. {
  6. new id;
  7. if(pInfo[playerid][Adminlevel] < 2) return 0;
  8. if(sscanf(params,"u", id))
  9. if(id == INVALID_PLAYER_ID)return SCM(playerid, red, "Player not connected!");
  10. GetPlayerPos(playerid,SpecX[playerid],SpecY[playerid],SpecZ[playerid]);
  11. Inter[playerid] = GetPlayerInterior(playerid);
  12. vWorld[playerid] = GetPlayerVirtualWorld(playerid);
  13. TogglePlayerSpectating(playerid, true);
  14. if(IsPlayerInAnyVehicle(id))
  15. {
  16. if(GetPlayerInterior(id) > 0)
  17. {
  18. SetPlayerInterior(playerid,GetPlayerInterior(id));
  19. }
  20. if(GetPlayerVirtualWorld(id) > 0)
  21. {
  22. SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(id));
  23. }
  24. PlayerSpectateVehicle(playerid,GetPlayerVehicleID(id));
  25. }
  26. else
  27. {
  28. if(GetPlayerInterior(id) > 0)
  29. {
  30. SetPlayerInterior(playerid,GetPlayerInterior(id));
  31. }
  32. if(GetPlayerVirtualWorld(id) > 0)
  33. {
  34. SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(id));
  35. }
  36. PlayerSpectatePlayer(playerid,id);
  37. }
  38. GetPlayerName(id, Name, sizeof(Name));
  39. GetPlayerPos(playerid, Float:x,Float:y,Float:z);
  40. format(String, sizeof(String),"You are spectating {33CCFF}%s.",Name);
  41. SCM(playerid, -1,String);
  42. IsSpecing[playerid] = 1;
  43. IsBeingSpeced[id] = 1;
  44. spectatorid[playerid] = id;
  45. SpecStats = 1;
  46. }
  47. else if(SpecStats == 1)
  48. {
  49. if(isnull(params))
  50. {
  51. if (pInfo[playerid][Adminlevel] < 2)
  52. if(IsSpecing[playerid] == 0)
  53. TogglePlayerSpectating(playerid, 0);
  54. SetPlayerPos(playerid, Float:x,Float:y,Float:z);
  55. SpecStats = 0;
  56. }
  57. }
  58. return 1;
  59. }
Advertisement
Add Comment
Please, Sign In to add comment