Advertisement
Guest User

American Dream Roleplay Selfie System

a guest
May 24th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.39 KB | None | 0 0
  1. //American Dream Roleplay Selfie System
  2. #define FILTERSCRIPT
  3.  
  4. #include < a_samp >
  5. #include < zcmd >
  6.  
  7. //Defines
  8.  
  9. #define PRESSED(%0) \
  10. (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
  11.  
  12. //Variables
  13.  
  14. new
  15. bool:variable_selfie[ MAX_PLAYERS ],
  16. bool:variable_movehead[ MAX_PLAYERS ],
  17. Float:variable_degree[ MAX_PLAYERS ],
  18. Float:variable_x[ MAX_PLAYERS ],
  19. Float:variable_y[ MAX_PLAYERS ],
  20. Float:variable_z[ MAX_PLAYERS ]
  21. ;
  22.  
  23. const Float: constant_radius = 1.4,
  24. Float: constant_velocity = 1.25,
  25. Float: constant_height = 1.0
  26. ;
  27.  
  28. #define COLOR_WHITE 0xFFFFFFAA
  29. #define COLOR_RED 0xFF0000AA
  30.  
  31. public
  32. OnFilterScriptInit( )
  33. {
  34.  
  35.  
  36. print("\n--------------------------------------");
  37.  
  38.  
  39. for ( new i = 0; i < MAX_PLAYERS; i++ )
  40.  
  41. {
  42.  
  43. variable_selfie[i] = false;
  44.  
  45. }
  46.  
  47. return 1;
  48. }
  49.  
  50. public
  51. OnFilterScriptExit( )
  52. {
  53.  
  54.  
  55. for ( new i = 0; i < MAX_PLAYERS; i++)
  56.  
  57. {
  58.  
  59. variable_selfie[ i ] = false;
  60.  
  61. }
  62.  
  63.  
  64. return 1;
  65.  
  66.  
  67. }
  68.  
  69. public
  70. OnPlayerConnect( playerid )
  71. {
  72.  
  73.  
  74. variable_selfie[ playerid ] = false;
  75.  
  76.  
  77. return 1;
  78.  
  79.  
  80. }
  81.  
  82. public
  83. OnPlayerDisconnect( playerid, reason )
  84. {
  85.  
  86.  
  87. variable_selfie[ playerid ] = false;
  88.  
  89.  
  90. return 1;
  91.  
  92.  
  93. }
  94.  
  95. COMMAND:selfie( playerid, params[ ] )
  96. {
  97.  
  98.  
  99. if ( variable_selfie[ playerid ] == false )
  100. {
  101.  
  102.  
  103. GetPlayerPos (playerid, variable_x[ playerid ], variable_y[ playerid ], variable_z[ playerid ] );
  104.  
  105. static
  106. Float: n1X,
  107. Float: n1Y
  108. ;
  109.  
  110. if ( variable_degree[ playerid ] >= 360 ) variable_degree[ playerid ] = 0;
  111.  
  112. variable_degree[ playerid ] += constant_velocity;
  113.  
  114. n1X = variable_x[ playerid ] + constant_radius * floatcos ( variable_degree[ playerid ], degrees );
  115.  
  116. n1Y = variable_y[ playerid ] + constant_radius * floatsin ( variable_degree[ playerid ], degrees );
  117.  
  118. SetPlayerCameraPos ( playerid, n1X, n1Y, variable_z[ playerid ] + constant_height );
  119.  
  120. SetPlayerCameraLookAt ( playerid, variable_x[ playerid ], variable_y[ playerid ], variable_z[ playerid ] += 1 );
  121.  
  122. SetPlayerFacingAngle ( playerid, variable_degree[ playerid ] - 90.0 );
  123.  
  124. variable_selfie [ playerid ] = true;
  125.  
  126. ApplyAnimation ( playerid, "PED", "gang_gunstand", 4.1, 1, 1, 1, 1, 1, 1 );
  127.  
  128. SendClientMessage ( playerid, COLOR_WHITE, "<!> Use {ADC3E7}/selfie{FFFFFF} to return back to normal mode" );
  129.  
  130. SendClientMessage ( playerid, COLOR_WHITE, "<!> Press keys {ADC3E7}YES / NO{FFFFFF} to control the camera's position" );
  131.  
  132. SendClientMessage ( playerid, COLOR_WHITE, "<!> Use {ADC3E7}/stophead{FFFFFF} to stop your head from moving" );
  133.  
  134.  
  135. return 1;
  136.  
  137.  
  138. }
  139.  
  140.  
  141. if( variable_selfie[ playerid ] == true )
  142.  
  143.  
  144. {
  145.  
  146. TogglePlayerControllable ( playerid, 1);
  147.  
  148. SetCameraBehindPlayer ( playerid );
  149.  
  150. variable_selfie[ playerid ] = false;
  151.  
  152. ApplyAnimation ( playerid, "PED", "ATM", 4.1, 0, 1, 1, 0, 1, 1 );
  153.  
  154.  
  155. return 1;
  156.  
  157.  
  158. }
  159.  
  160.  
  161. return 1;
  162.  
  163.  
  164. }
  165.  
  166. COMMAND:sf( playerid, params[ ] )
  167. {
  168.  
  169.  
  170. return cmd_selfie( playerid, params );
  171.  
  172.  
  173. }
  174.  
  175.  
  176. COMMAND:stophead( playerid, params[ ] )
  177. {
  178.  
  179.  
  180. if( variable_selfie[ playerid ] == true && variable_movehead[ playerid ] == false)
  181.  
  182. {
  183.  
  184. TogglePlayerControllable ( playerid, 0);
  185.  
  186. variable_movehead[ playerid ] = true;
  187.  
  188. }
  189.  
  190.  
  191. return 1;
  192.  
  193. }
  194.  
  195. COMMAND:sh( playerid, params[ ] )
  196. {
  197.  
  198.  
  199. return cmd_stophead( playerid, params );
  200.  
  201.  
  202. }
  203.  
  204.  
  205.  
  206. public
  207. OnPlayerKeyStateChange( playerid, newkeys, oldkeys )
  208. {
  209.  
  210.  
  211. if ( variable_selfie [ playerid ] == true )
  212. {
  213.  
  214.  
  215. if( PRESSED( KEY_YES ) )
  216. {
  217.  
  218.  
  219. GetPlayerPos ( playerid, variable_x[ playerid ], variable_y[ playerid ], variable_z[ playerid ]);
  220.  
  221. static Float: n1X, Float: n1Y;
  222.  
  223. if ( variable_degree[ playerid ] >= 360 ) variable_degree[ playerid ] = 0;
  224.  
  225. variable_degree[ playerid ] += constant_velocity;
  226.  
  227. n1X = variable_x[ playerid ] + constant_radius * floatcos( variable_degree[ playerid ], degrees );
  228.  
  229. n1Y = variable_y[ playerid ] + constant_radius * floatsin( variable_degree[ playerid ], degrees );
  230.  
  231. SetPlayerCameraPos ( playerid, n1X, n1Y, variable_z[ playerid ] + constant_height );
  232.  
  233. SetPlayerCameraLookAt ( playerid, variable_x[ playerid ], variable_y[ playerid ], variable_z[ playerid ] += 1 );
  234.  
  235. SetPlayerFacingAngle ( playerid, variable_degree[ playerid ] - 90.0 );
  236.  
  237.  
  238. }
  239.  
  240.  
  241. if ( PRESSED( KEY_NO ) )
  242. {
  243.  
  244.  
  245. GetPlayerPos ( playerid, variable_x[ playerid ], variable_y[ playerid ], variable_z[ playerid ] );
  246.  
  247. static Float: n1X, Float: n1Y;
  248.  
  249. if ( variable_degree[ playerid ] >= 360 ) variable_degree[ playerid ] = 0;
  250.  
  251. variable_degree[ playerid ] -= constant_velocity;
  252.  
  253. n1X = variable_x[ playerid ] + constant_radius * floatcos ( variable_degree[ playerid ], degrees );
  254.  
  255. n1Y = variable_y[ playerid ] + constant_radius * floatsin( variable_degree[ playerid ], degrees );
  256.  
  257. SetPlayerCameraPos ( playerid, n1X, n1Y, variable_z[ playerid ] + constant_height );
  258.  
  259. SetPlayerCameraLookAt ( playerid, variable_x[ playerid ], variable_y[ playerid ], variable_z[ playerid ]+1 );
  260.  
  261. SetPlayerFacingAngle ( playerid, variable_degree[ playerid ] - 90.0 );
  262.  
  263.  
  264. }
  265.  
  266.  
  267. }
  268.  
  269.  
  270. return 1;
  271.  
  272.  
  273. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement