AloneZ

Sistema de Selfie SAMP

Sep 10th, 2015
340
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 4.63 KB | None | 0 0
  1. #define FILTERSCRIPT
  2.  
  3. #include <a_samp>
  4. #include <zcmd>
  5.  
  6. #define PRESSED(%0) \
  7.     (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
  8.    
  9. new takingselfie[MAX_PLAYERS];
  10. new Float:Degree[MAX_PLAYERS];
  11. const Float: Radius = 1.4; //do not edit this
  12. const Float: Speed  = 1.25; //do not edit this
  13. const Float: Height = 1.0; // do not edit this
  14. new Text:Textdraw2;
  15. new Float:lX[MAX_PLAYERS];
  16. new Float:lY[MAX_PLAYERS];
  17. new Float:lZ[MAX_PLAYERS];
  18. new hiden[MAX_PLAYERS];
  19.  
  20. #define COLOR_WHITE 0xFFFFFFAA
  21. #define COLOR_RED 0xFF0000AA
  22.  
  23. #if defined FILTERSCRIPT
  24.  
  25. public OnFilterScriptInit()
  26. {
  27.     print("\n--------------------------------------");
  28.     print(" Selfie FilterScript By: JFF");
  29.     print("--------------------------------------\n");
  30.     for(new i =0; i<MAX_PLAYERS;i++)
  31.         takingselfie[i] = 0;
  32.     Textdraw2 = TextDrawCreate(227.000000, 10.000000, "~r~Press F8 to take a selfie.~n~~n~~y~Num 6/Num 4 to move the camera.~n~~n~~p~/td to hide/show the textdraws.~n~~n~~g~/selfie to stop taking selfies.~n~~n~~w~/headmove to disable the head movement.");
  33.     TextDrawBackgroundColor(Textdraw2, 255);
  34.     TextDrawFont(Textdraw2, 1);
  35.     TextDrawLetterSize(Textdraw2, 0.500000, 1.300000);
  36.     TextDrawColor(Textdraw2, -16776961);
  37.     TextDrawSetOutline(Textdraw2, 0);
  38.     TextDrawSetProportional(Textdraw2, 1);
  39.     TextDrawSetShadow(Textdraw2, 1);
  40.     TextDrawSetSelectable(Textdraw2, 0);
  41.     return 1;
  42. }
  43.  
  44. public OnFilterScriptExit()
  45. {
  46.     for(new i =0; i<MAX_PLAYERS;i++)
  47.         takingselfie[i] = 0;
  48.     return 1;
  49. }
  50.  
  51. #else
  52.  
  53. main()
  54. {
  55.     print("\n--------------------------------------");
  56.     print(" Selfie FilterScript By: JFF");
  57.     print("--------------------------------------\n");
  58. }
  59.  
  60. #endif
  61.  
  62. public OnPlayerConnect(playerid)
  63. {
  64.     takingselfie[playerid] = 0;
  65.     return 1;
  66. }
  67.  
  68. public OnPlayerDisconnect(playerid, reason)
  69. {
  70.     takingselfie[playerid] = 0;
  71.     return 1;
  72. }
  73.  
  74. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  75. {
  76.     if(takingselfie[playerid] == 1)
  77.     {
  78.         if(PRESSED(KEY_ANALOG_RIGHT))
  79.         {
  80.             GetPlayerPos(playerid,lX[playerid],lY[playerid],lZ[playerid]);
  81.             static Float: n1X, Float: n1Y;
  82.             if(Degree[playerid] >= 360) Degree[playerid] = 0;
  83.             Degree[playerid] += Speed;
  84.             n1X = lX[playerid] + Radius * floatcos(Degree[playerid], degrees);
  85.             n1Y = lY[playerid] + Radius * floatsin(Degree[playerid], degrees);
  86.             SetPlayerCameraPos(playerid, n1X, n1Y, lZ[playerid] + Height);
  87.             SetPlayerCameraLookAt(playerid, lX[playerid], lY[playerid], lZ[playerid]+1);
  88.             SetPlayerFacingAngle(playerid, Degree[playerid] - 90.0);
  89.         }
  90.         if(PRESSED(KEY_ANALOG_LEFT))
  91.         {
  92.             GetPlayerPos(playerid,lX[playerid],lY[playerid],lZ[playerid]);
  93.             static Float: n1X, Float: n1Y;
  94.             if(Degree[playerid] >= 360) Degree[playerid] = 0;
  95.             Degree[playerid] -= Speed;
  96.             n1X = lX[playerid] + Radius * floatcos(Degree[playerid], degrees);
  97.             n1Y = lY[playerid] + Radius * floatsin(Degree[playerid], degrees);
  98.             SetPlayerCameraPos(playerid, n1X, n1Y, lZ[playerid] + Height);
  99.             SetPlayerCameraLookAt(playerid, lX[playerid], lY[playerid], lZ[playerid]+1);
  100.             SetPlayerFacingAngle(playerid, Degree[playerid] - 90.0);
  101.         }
  102.     }
  103.     return 1;
  104. }
  105.  
  106. CMD:selfie(playerid,params[])
  107. {
  108.     if(takingselfie[playerid] == 0)
  109.     {
  110.         GetPlayerPos(playerid,lX[playerid],lY[playerid],lZ[playerid]);
  111.         static Float: n1X, Float: n1Y;
  112.         if(Degree[playerid] >= 360) Degree[playerid] = 0;
  113.         Degree[playerid] += Speed;
  114.         n1X = lX[playerid] + Radius * floatcos(Degree[playerid], degrees);
  115.         n1Y = lY[playerid] + Radius * floatsin(Degree[playerid], degrees);
  116.         SetPlayerCameraPos(playerid, n1X, n1Y, lZ[playerid] + Height);
  117.         SetPlayerCameraLookAt(playerid, lX[playerid], lY[playerid], lZ[playerid]+1);
  118.         SetPlayerFacingAngle(playerid, Degree[playerid] - 90.0);
  119.         takingselfie[playerid] = 1;
  120.         ApplyAnimation(playerid, "PED", "gang_gunstand", 4.1, 1, 1, 1, 1, 1, 1);
  121.         TextDrawShowForPlayer(playerid,Textdraw2);
  122.         return 1;
  123.     }
  124.     if(takingselfie[playerid] == 1)
  125.     {
  126.         TogglePlayerControllable(playerid,1);
  127.         SetCameraBehindPlayer(playerid);
  128.         TextDrawHideForPlayer(playerid,Textdraw2);
  129.         takingselfie[playerid] = 0;
  130.         ApplyAnimation(playerid, "PED", "ATM", 4.1, 0, 1, 1, 0, 1, 1);
  131.         return 1;
  132.     }
  133.     return 1;
  134. }
  135.  
  136. CMD:td(playerid,params[])
  137. {
  138.     if(takingselfie[playerid] == 0) return SendClientMessage(playerid,COLOR_RED,"ERROR: This command works only while taking a selfie");
  139.     if(hiden[playerid] == 0)
  140.     {
  141.         TextDrawHideForPlayer(playerid,Textdraw2);
  142.         hiden[playerid] = 1;
  143.         return 1;
  144.     }
  145.     if(hiden[playerid] == 1)
  146.     {
  147.         TextDrawShowForPlayer(playerid,Textdraw2);
  148.         hiden[playerid] = 0;
  149.         return 1;
  150.     }
  151.     return 1;
  152. }
Advertisement
Add Comment
Please, Sign In to add comment