Advertisement
Guest User

SpiderPork

a guest
Mar 28th, 2009
4,851
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.86 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. #define FILTERSCRIPT
  4.  
  5. #define YELLOW 0xFFFF00FF
  6.  
  7. #if defined FILTERSCRIPT
  8.  
  9. new FPS;
  10. new FPSTurned[MAX_PLAYERS];
  11.  
  12. stock Float:GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
  13. {
  14. new Float:a;
  15. GetPlayerPos(playerid, x, y, a);
  16. if (IsPlayerInAnyVehicle(playerid))
  17. GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
  18. else
  19. GetPlayerFacingAngle(playerid, a);
  20. x += (distance * floatsin(-a, degrees));
  21. y += (distance * floatcos(-a, degrees));
  22. return a;
  23. }
  24.  
  25. new Text:CrossHair1;
  26. new Text:CrossHair2;
  27. new Text:CrossHair3;
  28. new Text:CrossHair4;
  29.  
  30. enum cInfo
  31. {
  32. Float:camPosLookX,
  33. Float:camPosLookY,
  34. Float:camPosLookZ
  35. }
  36.  
  37. new CameraInfo[MAX_PLAYERS][cInfo];
  38.  
  39. forward GetCameraLookAt(playerid, &Float:x, &Float:y, &Float:z);
  40. public GetCameraLookAt(playerid, &Float:x, &Float:y, &Float:z)
  41. {
  42. x = CameraInfo[playerid][camPosLookX];
  43. y = CameraInfo[playerid][camPosLookY];
  44. z = CameraInfo[playerid][camPosLookZ];
  45. return 1;
  46. }
  47.  
  48. public OnFilterScriptInit()
  49. {
  50. CrossHair1 = TextDrawCreate(313.000000,173.000000,"-");
  51. CrossHair2 = TextDrawCreate(298.000000,173.000000,"-");
  52. CrossHair3 = TextDrawCreate(310.000000,164.000000,"I");
  53. CrossHair4 = TextDrawCreate(310.000000,179.000000,"I");
  54. TextDrawAlignment(CrossHair1,0);
  55. TextDrawAlignment(CrossHair2,0);
  56. TextDrawAlignment(CrossHair3,0);
  57. TextDrawAlignment(CrossHair4,0);
  58. TextDrawBackgroundColor(CrossHair1,0x000000ff);
  59. TextDrawBackgroundColor(CrossHair2,0x000000ff);
  60. TextDrawBackgroundColor(CrossHair3,0x000000ff);
  61. TextDrawBackgroundColor(CrossHair4,0x000000ff);
  62. TextDrawFont(CrossHair1,1);
  63. TextDrawLetterSize(CrossHair1,1.000000,1.000000);
  64. TextDrawFont(CrossHair2,3);
  65. TextDrawLetterSize(CrossHair2,0.899999,1.000000);
  66. TextDrawFont(CrossHair3,1);
  67. TextDrawLetterSize(CrossHair3,0.299999,1.500000);
  68. TextDrawFont(CrossHair4,1);
  69. TextDrawLetterSize(CrossHair4,0.299999,1.600000);
  70. TextDrawColor(CrossHair1,0xffffffff);
  71. TextDrawColor(CrossHair2,0xffffffff);
  72. TextDrawColor(CrossHair3,0xffffffff);
  73. TextDrawColor(CrossHair4,0xffffffff);
  74. TextDrawSetOutline(CrossHair1,1);
  75. TextDrawSetOutline(CrossHair2,1);
  76. TextDrawSetOutline(CrossHair3,1);
  77. TextDrawSetOutline(CrossHair4,1);
  78. TextDrawSetProportional(CrossHair1,1);
  79. TextDrawSetProportional(CrossHair2,1);
  80. TextDrawSetProportional(CrossHair3,1);
  81. TextDrawSetProportional(CrossHair4,1);
  82. TextDrawSetShadow(CrossHair1,1);
  83. TextDrawSetShadow(CrossHair2,1);
  84. TextDrawSetShadow(CrossHair3,1);
  85. TextDrawSetShadow(CrossHair4,1);
  86. return 1;
  87. }
  88.  
  89. public OnFilterScriptExit()
  90. {
  91. return 1;
  92. }
  93.  
  94. #else
  95.  
  96. main()
  97. {
  98. print("\n----------------------------------");
  99. print("First Person Shooter View ");
  100. print("by SpiderPork ");
  101. print("----------------------------------\n");
  102. }
  103.  
  104. #endif
  105.  
  106. public OnPlayerSpawn(playerid)
  107. {
  108. return 1;
  109. }
  110.  
  111. public OnPlayerDisconnect(playerid, reason)
  112. {
  113. if(FPSTurned[playerid] == 1)
  114. {
  115. KillTimer(FPS);
  116. TextDrawHideForPlayer(playerid, CrossHair1);
  117. TextDrawHideForPlayer(playerid, CrossHair2);
  118. TextDrawHideForPlayer(playerid, CrossHair3);
  119. TextDrawHideForPlayer(playerid, CrossHair4);
  120. }
  121. return 1;
  122. }
  123.  
  124. public OnPlayerDeath(playerid, killerid, reason)
  125. {
  126. if(FPSTurned[playerid] == 1)
  127. {
  128. KillTimer(FPS);
  129. TextDrawHideForPlayer(playerid, CrossHair1);
  130. TextDrawHideForPlayer(playerid, CrossHair2);
  131. TextDrawHideForPlayer(playerid, CrossHair3);
  132. TextDrawHideForPlayer(playerid, CrossHair4);
  133. }
  134. return 1;
  135. }
  136.  
  137. public OnPlayerCommandText(playerid, cmdtext[])
  138. {
  139. if (strcmp("/stopfps", cmdtext, true, 10) == 0)
  140. {
  141. KillTimer(FPS);
  142. SendClientMessage(playerid, YELLOW, "You have successfully stopped the FPS view mode.");
  143. FPSTurned[playerid] = 0;
  144. SetCameraBehindPlayer(playerid);
  145. TextDrawHideForPlayer(playerid, CrossHair1);
  146. TextDrawHideForPlayer(playerid, CrossHair2);
  147. TextDrawHideForPlayer(playerid, CrossHair3);
  148. TextDrawHideForPlayer(playerid, CrossHair4);
  149. return 1;
  150. }
  151.  
  152. if (strcmp("/startfps", cmdtext, true, 10) == 0)
  153. {
  154. FPS = SetTimerEx("FPSTimer", 10, true, "i", playerid);
  155. SendClientMessage(playerid, YELLOW, "You have successfully started the FPS view mode.");
  156. FPSTurned[playerid] = 1;
  157. TextDrawShowForPlayer(playerid, CrossHair1);
  158. TextDrawShowForPlayer(playerid, CrossHair2);
  159. TextDrawShowForPlayer(playerid, CrossHair3);
  160. TextDrawShowForPlayer(playerid, CrossHair4);
  161. return 1;
  162. }
  163. return 0;
  164. }
  165.  
  166. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  167. {
  168. return 1;
  169. }
  170.  
  171. public OnPlayerExitVehicle(playerid, vehicleid)
  172. {
  173. return 1;
  174. }
  175.  
  176. forward FPSTimer(playerid);
  177. public FPSTimer(playerid)
  178. {
  179. new Float:X, Float:Y, Float:Z, Float:X2, Float:Y2;
  180. GetPlayerPos(playerid, X, Y, Z);
  181. GetXYInFrontOfPlayer(playerid, X2, Y2, 0.4);
  182. SetPlayerCameraPos(playerid, X2, Y2, Z+0.9);
  183. GetXYInFrontOfPlayer(playerid, X2, Y2, 5.0);
  184. SetPlayerCameraLookAt(playerid, X2, Y2, Z);
  185. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement