Advertisement
Gamer_Z

Untitled

Nov 15th, 2011
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.84 KB | None | 0 0
  1. #include <a_samp>
  2. /*******************************************************/
  3. /* Experimental Cursor FilterScript for SA-MP */
  4. /* Made by iPLEOMAX ©. */
  5. /* > Works well when player is aiming wtih a */
  6. /* Sniper Rifle/HeatSeeker/RPG. */
  7. /* > I gave sniper so that they can't */
  8. /* boom themselves.. xD */
  9. /* WARNING! You are not allowed to remove any credits! */
  10. /*******************************************************/
  11.  
  12. #include < a_samp >
  13.  
  14. #define frc(%0) floatround(%0*100, floatround_ceil)
  15.  
  16. #define iM_MODE_CREATE 1
  17. #define iM_MODE_UPDATE 2
  18.  
  19. new Text:CursorBG;
  20.  
  21. enum iM_Configs
  22. {
  23. bool:Enabled,
  24. Timer,
  25. CX, CY,
  26. Text:PointerP1,
  27. Text:PointerP2
  28. };
  29. new iM[MAX_PLAYERS][iM_Configs];
  30.  
  31. public OnFilterScriptExit() { print(" * On-Screen Cursor FS exited."); return true; }
  32.  
  33. public OnPlayerDisconnect( playerid, reason ) { return DisableCursor( playerid ); }
  34.  
  35. public OnPlayerCommandText( playerid, cmdtext[] )
  36. {
  37. if (!strcmp("/cursor", cmdtext, true))
  38. {
  39. if(!iM[playerid][Enabled]) { EnableCursor( playerid ); }
  40. else { DisableCursor( playerid ); }
  41. return true;
  42. }
  43. if (!strcmp("/backgr", cmdtext, true))
  44. {
  45. TextDrawShowForPlayer( playerid, CursorBG );
  46. return true;
  47. }
  48. return false;
  49. }
  50.  
  51. public OnPlayerKeyStateChange( playerid, newkeys, oldkeys )
  52. {
  53. if(newkeys & KEY_FIRE && iM[playerid][Enabled])
  54. {
  55. new str[64];
  56. format(str, sizeof(str), "Mouse Location - X: %i, Y: %i", iM[playerid][CX], iM[playerid][CY]);
  57. SendClientMessage(playerid, -1, str);
  58. }
  59. }
  60.  
  61. forward EnableCursor( playerid );
  62. public EnableCursor( playerid )
  63. {
  64. if(GetPlayerState(playerid) != 1) return SendClientMessage(playerid, -1, "You need to be on-foot to use this command.");
  65.  
  66. TextDrawShowForPlayer( playerid, CursorBG );
  67. GivePlayerWeapon( playerid, 34, -1 );
  68. //SetPlayerInterior(playerid, 1);
  69. SetPlayerVirtualWorld( playerid, playerid+MAX_PLAYERS );
  70. iM[playerid][CX] = 320; iM[playerid][CY] = 240;
  71. //iM[playerid][Timer] = SetTimerEx( "CursorCheck", 100, true, "d", playerid );
  72. iM[playerid][Enabled] = true;
  73. return true;
  74. }
  75.  
  76. forward DisableCursor( playerid );
  77. public DisableCursor( playerid )
  78. {
  79. KillTimer( iM[playerid][Timer] );
  80. TextDrawDestroy( iM[playerid][PointerP1] );
  81. TextDrawDestroy( iM[playerid][PointerP2] );
  82. TextDrawHideForPlayer( playerid, CursorBG );
  83. SpawnPlayer( playerid );
  84. SetPlayerInterior( playerid, 0 );
  85. SetPlayerVirtualWorld( playerid, 0 );
  86. iM[playerid][Enabled] = false;
  87. return true;
  88. }
  89.  
  90. stock Cursor( playerid, X, Y )
  91. {
  92. if(X>640) X=640; if(Y>480) Y=480;
  93. if(X<0) X=0; if(Y<0) Y=0;
  94.  
  95. iM[playerid][CX]=X;
  96. iM[playerid][CY]=Y;
  97.  
  98. TextDrawDestroy( iM[playerid][PointerP1] );
  99. TextDrawDestroy( iM[playerid][PointerP2] );
  100.  
  101. iM[playerid][PointerP1] = TextDrawCreate(X, Y, "\\_");
  102. TextDrawBackgroundColor(iM[playerid][PointerP1], 255);
  103. TextDrawFont(iM[playerid][PointerP1], 1);
  104. TextDrawLetterSize(iM[playerid][PointerP1], 0.670000, 1.200000);
  105. TextDrawColor(iM[playerid][PointerP1], -1);
  106. TextDrawSetOutline(iM[playerid][PointerP1], 0);
  107. TextDrawSetProportional(iM[playerid][PointerP1], 1);
  108. TextDrawSetShadow(iM[playerid][PointerP1], 0);
  109.  
  110. iM[playerid][PointerP2] = TextDrawCreate(X-2.000000, Y-1.000000, "\\_");
  111. TextDrawBackgroundColor(iM[playerid][PointerP2], 255);
  112. TextDrawFont(iM[playerid][PointerP2], 2);
  113. TextDrawLetterSize(iM[playerid][PointerP2], 1.120000, 1.200000);
  114. TextDrawColor(iM[playerid][PointerP2], -1);
  115. TextDrawSetOutline(iM[playerid][PointerP2], 0);
  116. TextDrawSetProportional(iM[playerid][PointerP2], 1);
  117. TextDrawSetShadow(iM[playerid][PointerP2], 0);
  118.  
  119. TextDrawShowForPlayer( playerid, iM[playerid][PointerP1] );
  120. TextDrawShowForPlayer( playerid, iM[playerid][PointerP2] );
  121. }
  122.  
  123. public OnGameModeInit()
  124. {
  125. AddPlayerClass(0,0,0,0,0,0,0,0,0,0,0);
  126. print("\n * On-Screen Cursor FS Loaded! - iPLEOMAX \n");
  127.  
  128. CursorBG = TextDrawCreate(665.000000, 0.000000, "ScreenB");
  129. TextDrawBackgroundColor(CursorBG, 255);
  130. TextDrawFont(CursorBG, 1);
  131. TextDrawLetterSize(CursorBG, 0.000000, 50.800003);
  132. TextDrawColor(CursorBG, -1);
  133. TextDrawSetOutline(CursorBG, 0);
  134. TextDrawSetProportional(CursorBG, 1);
  135. TextDrawSetShadow(CursorBG, 1);
  136. TextDrawUseBox(CursorBG, 1);
  137. TextDrawBoxColor(CursorBG, 255);
  138. TextDrawTextSize(CursorBG, -65.000000, 0.000000);
  139.  
  140. return 1;
  141. }
  142.  
  143. main()
  144. {
  145.  
  146. }
  147.  
  148. public OnPlayerUpdate(playerid)
  149. {
  150. static x = 9;
  151. if (++x == 10)
  152. {
  153. SetPlayerPos(playerid, 1946.195800, 1302.83012, 9.109375);
  154. SetPlayerFacingAngle(playerid, 0.0);
  155. SetCameraBehindPlayer(playerid);
  156. new Float:P[3];
  157. GetPlayerCameraFrontVector( playerid, P[0], P[1], P[2] );
  158. Cursor( playerid, iM[playerid][CX]+frc(P[0])-1, iM[playerid][CY]+(frc(P[2])+4)*-1 );
  159. x = 0;
  160. }
  161. SetPlayerVelocity(playerid, 0.2, 0.0, 0.0);
  162. }
  163.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement