Advertisement
Guest User

Erros

a guest
Sep 2nd, 2012
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 36.01 KB | None | 0 0
  1. /*
  2.  *  Cinematic Camera Node Editor v2.6.1
  3.  *      Added in CameraMover version 2!
  4.  *      Allows server devs to easily edit camera nodes.
  5.  *      Now has a full project editor.
  6.  *
  7.  *  ~Southclaw
  8.  */
  9. #include <a_samp>
  10. #include <sscanf2>
  11. #include <CameraMover>
  12.  
  13. #define INDEX_FILE      "Cameras/index.txt"
  14. #define strcpy(%0,%1)   strcat((%0[0] = '\0', %0), %1)
  15.  
  16. // Set up your camera speed defaults here
  17. #define CAM_SPEED       (10.0)  // Standard speed
  18. #define CAM_HI_SPEED    (40.0)  // When pressing SPRINT (Space default)
  19. #define CAM_LO_SPEED    (3.0)   // When pressing WALK (Alt default)
  20.  
  21. new
  22.     SelectedCamera[MAX_PLAYERS],
  23.     bool:gPlayerEditing[MAX_PLAYERS],
  24.     bool:gPlayerEditingNode[MAX_PLAYERS],
  25.     freeCamUsed[MAX_PLAYERS],
  26.     freeCamObj[MAX_PLAYERS],
  27.  
  28.     indexData[MAX_CAMERAS][MAX_CAMFILE_LEN];
  29.  
  30. forward editor_OnCamMove(playerid, node, bool:cont);
  31.  
  32.  
  33. #define DIALOG_OFFSET 1000
  34. enum
  35. {
  36.     d_MainMenu = DIALOG_OFFSET,
  37.     d_NewCamName,
  38.     d_ProjectOptions,
  39.     d_ExportDialog,
  40.  
  41.     d_NodeID,
  42.     d_MoveTime,
  43.     d_WaitTime,
  44.     d_MoveType,
  45.  
  46.     d_confirmNodeCommit,
  47.  
  48.     d_ConfirmQuit
  49. }
  50.  
  51. new
  52.     PlayerText:cam_buttonBack,
  53.     PlayerText:cam_boxBackground,
  54.     PlayerText:cam_arrowLeft,
  55.     PlayerText:cam_arrowRight,
  56.  
  57.     PlayerText:cam_row1,
  58.     PlayerText:cam_row2,
  59.     PlayerText:cam_row3,
  60.     PlayerText:cam_row4,
  61.  
  62.     PlayerText:cam_row1Data,
  63.     PlayerText:cam_row2Data,
  64.     PlayerText:cam_row3Data,
  65.     PlayerText:cam_row4Data,
  66.  
  67.     PlayerText:cam_buttonEdit,
  68.     PlayerText:cam_buttonSave,
  69.     PlayerText:cam_buttonDelt,
  70.     PlayerText:cam_buttonPrev,
  71.     PlayerText:cam_buttonAddN;
  72.  
  73. public OnFilterScriptInit()
  74. {
  75.     FormatMainMenu(0);
  76. }
  77. stock FormatMainMenu(playerid)
  78. {
  79.     new
  80.         File:idxFile,
  81.         line[64],
  82.         idx,
  83.         strTitle[32],
  84.         strList[MAX_CAMERAS*(MAX_CAMFILE_LEN+1)];
  85.  
  86.     strList = "New Camera...\n";
  87.  
  88.     if(!fexist(INDEX_FILE))
  89.     {
  90.         idxFile = fopen(INDEX_FILE, io_write); // If the file doesn't exist, create it now in case it's used later
  91.         if(idxFile)fclose(idxFile);
  92.         else SendClientMessage(playerid, 0xFF0000FF, "ERROR: Directory Not Found. Please create a folder called \"Cameras\" inside \"scriptfiles\".");
  93.     }
  94.     else // But if it does, read each line and add that to the list
  95.     {
  96.         idxFile = fopen(INDEX_FILE, io_read);
  97.         while(fread(idxFile, line))
  98.         {
  99.             strcat(strList, line);
  100.             line[strlen(line)-2] = EOS; // Remove the "\n" this would need to be "-1" if using linux
  101.             strcpy(indexData[idx], line);
  102.             idx++;
  103.         }
  104.         fclose(idxFile);
  105.     }
  106.  
  107.     format(strTitle, 32, "Total Camera Projects: %d", idx);
  108.     ShowPlayerDialog(playerid, d_MainMenu, DIALOG_STYLE_LIST, strTitle, strList, "Accept", "Close");
  109. }
  110.  
  111. CreateCameraMover(playerid, camname[])
  112. {
  113.     new
  114.         File:idxFile,
  115.         File:camFile,
  116.         tmpStr[MAX_CAMFILE_LEN+2],
  117.         newData[128],
  118.         iLoop,
  119.  
  120.         Float:camX, Float:camY, Float:camZ,
  121.         Float:vecX, Float:vecY, Float:vecZ;
  122.  
  123.     if(!fexist(INDEX_FILE))idxFile = fopen(INDEX_FILE, io_write);
  124.     else idxFile = fopen(INDEX_FILE, io_append);
  125.  
  126.     strcat(tmpStr, camname);
  127.     strcat(tmpStr, "\r\n");
  128.  
  129.     while(strlen(indexData[iLoop][0]))iLoop++;
  130.     strcpy(indexData[iLoop], camname);
  131.     fwrite(idxFile, tmpStr);
  132.     fclose(idxFile);
  133.  
  134.  
  135.     GetPlayerCameraPos(playerid, camX, camY, camZ);
  136.     GetPlayerCameraFrontVector(playerid, vecX, vecY, vecZ);
  137.     vecX+=camX;
  138.     vecY+=camY;
  139.     vecZ+=camZ;
  140.  
  141.     format(tmpStr, MAX_CAMFILE_LEN+2, CAMERA_FILE, camname);
  142.     camFile = fopen(tmpStr, io_write);
  143.  
  144.     format(newData, 128, "%f, %f, %f, %f, %f, %f, %d, %d, %d", camX, camY, camZ, vecX, vecY, vecZ, DEFAULT_MOVETIME, DEFAULT_WAITTIME, DEFAULT_MOVETYPE);
  145.     fwrite(camFile, newData);
  146.     fclose(camFile);
  147. }
  148.  
  149. stock EditCameraMover(playerid, camera)
  150. {
  151.     gPlayerCamData[playerid][p_CamID] = camera;
  152.     gPlayerEditing[playerid]=true;
  153.  
  154.     camera_LoadTextDraws(playerid); // Need a check to see if the player has textdraws loaded (Maybe checking if the first ID is an invalid textdraw ID)
  155.     SelectTextDraw(playerid, 0xFFFF00FF);
  156.     ToggleEditGUI(playerid, true);
  157.     JumpToNode(playerid, 0);
  158. }
  159. stock ExitEditing(playerid)
  160. {
  161.     gPlayerCamData[playerid][p_CamID] = -1;
  162.     gPlayerEditing[playerid] = false;
  163.     CancelSelectTextDraw(playerid);
  164.     SetCameraBehindPlayer(playerid);
  165.     ToggleEditGUI(playerid, false);
  166.     TogglePlayerControllable(playerid, true);
  167. }
  168.  
  169. public editor_OnCamMove(playerid, node, bool:cont)
  170. {
  171.     gPlayerCamData[playerid][p_Node]++;
  172.     UpdateGUI(playerid);
  173. }
  174.  
  175. SaveCameraMover(playerid, exportmode=0)
  176. {
  177.     new
  178.         tmpCam = gPlayerCamData[playerid][p_CamID],
  179.         tmpNode,
  180.         File:camFile_Main = fopen(camFilename[tmpCam], io_read),
  181.         File:camFile_Backup,
  182.         tmpFilename[64],
  183.         tmpLine[256],
  184.         tmpData[3];
  185.  
  186.     // Create the backup file, then write everything from the main one into the new one
  187.     format(tmpFilename, 64, "%s.bak", camFilename[tmpCam]);
  188.     camFile_Backup=fopen(tmpFilename, io_write);
  189.     while(fread(camFile_Main, tmpLine))fwrite(camFile_Backup, tmpLine);
  190.     fclose(camFile_Backup);
  191.     fclose(camFile_Main);
  192.  
  193.     // Now, close that backup file, write all the variable data into the main file
  194.  
  195.     camFile_Main = fopen(camFilename[tmpCam], io_write);
  196.     while (tmpNode <= camMaxNodes[tmpCam])
  197.     {
  198.         if(!exportmode)
  199.         {
  200.             if (camData[tmpCam][tmpNode][cam_moveTime] == tmpData[0] &&
  201.                 camData[tmpCam][tmpNode][cam_waitTime] == tmpData[1] &&
  202.                 camData[tmpCam][tmpNode][cam_moveType] == tmpData[2] )
  203.             { // All the data is the same as the last one, ignore it and leave optionals blank
  204.                 format(tmpLine, 256, "%f, %f, %f, %f, %f, %f\r\n",
  205.                     camData[tmpCam][tmpNode][cam_cPosX],
  206.                     camData[tmpCam][tmpNode][cam_cPosY],
  207.                     camData[tmpCam][tmpNode][cam_cPosZ],
  208.                     camData[tmpCam][tmpNode][cam_lPosX],
  209.                     camData[tmpCam][tmpNode][cam_lPosY],
  210.                     camData[tmpCam][tmpNode][cam_lPosZ] );
  211.             }
  212.             else
  213.             { // Data is different, write the new data to the line
  214.                 format(tmpLine, 256, "%f, %f, %f, %f, %f, %f, %d, %d, %d\r\n",
  215.                     camData[tmpCam][tmpNode][cam_cPosX],
  216.                     camData[tmpCam][tmpNode][cam_cPosY],
  217.                     camData[tmpCam][tmpNode][cam_cPosZ],
  218.                     camData[tmpCam][tmpNode][cam_lPosX],
  219.                     camData[tmpCam][tmpNode][cam_lPosY],
  220.                     camData[tmpCam][tmpNode][cam_lPosZ],
  221.                     camData[tmpCam][tmpNode][cam_moveTime],
  222.                     camData[tmpCam][tmpNode][cam_waitTime],
  223.                     camData[tmpCam][tmpNode][cam_moveType] );
  224.  
  225.                 tmpData[0] = camData[tmpCam][tmpNode][cam_moveTime];
  226.                 tmpData[1] = camData[tmpCam][tmpNode][cam_waitTime];
  227.                 tmpData[2] = camData[tmpCam][tmpNode][cam_moveType];
  228.             }
  229.         }
  230.         else
  231.         {
  232.             if(tmpNode == camMaxNodes[tmpCam])strcpy(tmpLine, "\r\n");
  233.             else
  234.             {
  235.                 format(tmpLine, 256,
  236.                     "InterpolateCameraPos(playerid, %f, %f, %f, %f, %f, %f, %d, %d);\r\n\
  237.                     InterpolateCameraLookAt(playerid, %f, %f, %f, %f, %f, %f, %d, %d);\r\n",
  238.  
  239.                     camData[tmpCam][tmpNode][cam_cPosX],
  240.                     camData[tmpCam][tmpNode][cam_cPosY],
  241.                     camData[tmpCam][tmpNode][cam_cPosZ],
  242.                     camData[tmpCam][tmpNode+1][cam_cPosX],
  243.                     camData[tmpCam][tmpNode+1][cam_cPosY],
  244.                     camData[tmpCam][tmpNode+1][cam_cPosZ],
  245.                     camData[tmpCam][tmpNode][cam_moveTime],
  246.                     camData[tmpCam][tmpNode][cam_moveType],
  247.  
  248.                     camData[tmpCam][tmpNode][cam_lPosX],
  249.                     camData[tmpCam][tmpNode][cam_lPosY],
  250.                     camData[tmpCam][tmpNode][cam_lPosZ],
  251.                     camData[tmpCam][tmpNode+1][cam_lPosX],
  252.                     camData[tmpCam][tmpNode+1][cam_lPosY],
  253.                     camData[tmpCam][tmpNode+1][cam_lPosZ],
  254.                     camData[tmpCam][tmpNode][cam_moveTime],
  255.                     camData[tmpCam][tmpNode][cam_moveType] );
  256.             }
  257.         }
  258.         fwrite(camFile_Main, tmpLine);
  259.         tmpNode++;
  260.     }
  261.     fclose(camFile_Main);
  262. }
  263. ToggleEditGUI(playerid, toggle)
  264. {
  265.     if(toggle)
  266.     {
  267.         PlayerTextDrawShow(playerid, cam_buttonBack);
  268.         PlayerTextDrawShow(playerid, cam_boxBackground);
  269.         PlayerTextDrawShow(playerid, cam_arrowLeft);
  270.         PlayerTextDrawShow(playerid, cam_arrowRight);
  271.  
  272.         PlayerTextDrawShow(playerid, cam_row1);
  273.         PlayerTextDrawShow(playerid, cam_row2);
  274.         PlayerTextDrawShow(playerid, cam_row3);
  275.         PlayerTextDrawShow(playerid, cam_row4);
  276.  
  277.         PlayerTextDrawShow(playerid, cam_row1Data);
  278.         PlayerTextDrawShow(playerid, cam_row2Data);
  279.         PlayerTextDrawShow(playerid, cam_row3Data);
  280.         PlayerTextDrawShow(playerid, cam_row4Data);
  281.  
  282.         PlayerTextDrawShow(playerid, cam_buttonEdit);
  283.         PlayerTextDrawShow(playerid, cam_buttonSave);
  284.         PlayerTextDrawShow(playerid, cam_buttonDelt);
  285.         PlayerTextDrawShow(playerid, cam_buttonPrev);
  286.         PlayerTextDrawShow(playerid, cam_buttonAddN);
  287.     }
  288.     else
  289.     {
  290.         PlayerTextDrawHide(playerid, cam_buttonBack);
  291.         PlayerTextDrawHide(playerid, cam_boxBackground);
  292.         PlayerTextDrawHide(playerid, cam_arrowLeft);
  293.         PlayerTextDrawHide(playerid, cam_arrowRight);
  294.  
  295.         PlayerTextDrawHide(playerid, cam_row1);
  296.         PlayerTextDrawHide(playerid, cam_row2);
  297.         PlayerTextDrawHide(playerid, cam_row3);
  298.         PlayerTextDrawHide(playerid, cam_row4);
  299.  
  300.         PlayerTextDrawHide(playerid, cam_row1Data);
  301.         PlayerTextDrawHide(playerid, cam_row2Data);
  302.         PlayerTextDrawHide(playerid, cam_row3Data);
  303.         PlayerTextDrawHide(playerid, cam_row4Data);
  304.  
  305.         PlayerTextDrawHide(playerid, cam_buttonEdit);
  306.         PlayerTextDrawHide(playerid, cam_buttonSave);
  307.         PlayerTextDrawHide(playerid, cam_buttonDelt);
  308.         PlayerTextDrawHide(playerid, cam_buttonPrev);
  309.         PlayerTextDrawHide(playerid, cam_buttonAddN);
  310.     }
  311. }
  312. UpdateGUI(playerid)
  313. {
  314.     new
  315.         tmpCam = gPlayerCamData[playerid][p_CamID],
  316.         tmpNode = gPlayerCamData[playerid][p_Node],
  317.         dataStr[16],
  318.         MoveTypeName[3][5]={"NONE", "MOVE", "CUT"};
  319.  
  320.     format(dataStr, 16, "%d/%d", tmpNode, camMaxNodes[tmpCam]);
  321.     PlayerTextDrawSetString(playerid, cam_row1Data, dataStr);
  322.     PlayerTextDrawShow(playerid, cam_row1Data);
  323.  
  324.     format(dataStr, 16, "%d", camData[tmpCam][tmpNode][cam_moveTime]);
  325.     PlayerTextDrawSetString(playerid, cam_row2Data, dataStr);
  326.     PlayerTextDrawShow(playerid, cam_row2Data);
  327.  
  328.     format(dataStr, 16, "%d", camData[tmpCam][tmpNode][cam_waitTime]);
  329.     PlayerTextDrawSetString(playerid, cam_row3Data, dataStr);
  330.     PlayerTextDrawShow(playerid, cam_row3Data);
  331.  
  332.     format(dataStr, 16, "%s(%d)", MoveTypeName[ _:camData[tmpCam][tmpNode][cam_moveType] ], camData[tmpCam][tmpNode][cam_moveType]);
  333.     PlayerTextDrawSetString(playerid, cam_row4Data, dataStr);
  334.     PlayerTextDrawShow(playerid, cam_row4Data);
  335. }
  336. JumpToNode(playerid, node)
  337. {
  338.     new
  339.         camera = gPlayerCamData[playerid][p_CamID];
  340.  
  341.     SetPlayerCameraPos(playerid, camData[camera][node][cam_cPosX], camData[camera][node][cam_cPosY], camData[camera][node][cam_cPosZ]);
  342.     SetPlayerCameraLookAt(playerid, camData[camera][node][cam_lPosX], camData[camera][node][cam_lPosY], camData[camera][node][cam_lPosZ]);
  343.  
  344.     gPlayerCamData[playerid][p_Node] = node;
  345.     UpdateGUI(playerid);
  346. }
  347.  
  348. EditCurrentNode(playerid)
  349. {
  350.     gPlayerEditingNode[playerid] = true;
  351.     EnterFreeCam(playerid);
  352. }
  353. CommitCurrentNode(playerid)
  354. {
  355.     new
  356.         tmpCam = gPlayerCamData[playerid][p_CamID],
  357.         tmpNode = gPlayerCamData[playerid][p_Node],
  358.         Float:vecX, Float:vecY, Float:vecZ;
  359.  
  360.     GetPlayerCameraPos(playerid, camData[tmpCam][tmpNode][cam_cPosX], camData[tmpCam][tmpNode][cam_cPosY], camData[tmpCam][tmpNode][cam_cPosZ]);
  361.     GetPlayerCameraFrontVector(playerid, vecX, vecY, vecZ);
  362.  
  363.     camData[tmpCam][tmpNode][cam_lPosX] = camData[tmpCam][tmpNode][cam_cPosX]+(vecX*4); // x4 just to give the LookAt node a little distance, I didn't know if this would affect anything
  364.     camData[tmpCam][tmpNode][cam_lPosY] = camData[tmpCam][tmpNode][cam_cPosY]+(vecY*4);
  365.     camData[tmpCam][tmpNode][cam_lPosZ] = camData[tmpCam][tmpNode][cam_cPosZ]+(vecZ*4);
  366.  
  367.     gPlayerEditingNode[playerid] = false;
  368.     ExitFreeCam(playerid);
  369.     UpdateGUI(playerid);
  370. }
  371. CancelCurrentNodeEdit(playerid)
  372. {
  373.     JumpToNode(playerid, gPlayerCamData[playerid][p_Node]);
  374.  
  375.     gPlayerEditingNode[playerid] = false;
  376.     ExitFreeCam(playerid);
  377. }
  378.  
  379. EnterFreeCam(playerid)
  380. {
  381.     new
  382.         tmpCam = gPlayerCamData[playerid][p_CamID],
  383.         tmpNode = gPlayerCamData[playerid][p_Node];
  384.  
  385.     freeCamUsed[playerid] = true;
  386.     TogglePlayerControllable(playerid, true);
  387.     SetCameraBehindPlayer(playerid);
  388.     ApplyAnimation(playerid, "CARRY", "crry_prtial", 1.0, 0, 0, 0, 1, 0);
  389.     CancelSelectTextDraw(playerid);
  390.     ToggleEditGUI(playerid, false);
  391.  
  392.     freeCamObj[playerid] = CreateObject(19300, camData[tmpCam][tmpNode][cam_cPosX], camData[tmpCam][tmpNode][cam_cPosY], camData[tmpCam][tmpNode][cam_cPosZ], 0.0, 0.0, 0.0);
  393.     AttachCameraToObject(playerid, freeCamObj[playerid]);
  394. }
  395. ExitFreeCam(playerid)
  396. {
  397.     JumpToNode(playerid, gPlayerCamData[playerid][p_Node]);
  398.  
  399.     freeCamUsed[playerid] = false;
  400.     DestroyObject(freeCamObj[playerid]);
  401.     ToggleEditGUI(playerid, true);
  402.     SelectTextDraw(playerid, 0xFFFF00FF);
  403. }
  404.  
  405.  
  406. EditNewNode(playerid)
  407. {
  408.     new
  409.         tmpCam = gPlayerCamData[playerid][p_CamID],
  410.         tmpNode = gPlayerCamData[playerid][p_Node];
  411.  
  412.     ShiftNodeArray(tmpCam, tmpNode);
  413.     EditCurrentNode(playerid);
  414.     gPlayerCamData[playerid][p_Node]++;
  415. }
  416. DeleteCurrentNode(playerid)
  417. {
  418.     new
  419.         tmpCam = gPlayerCamData[playerid][p_CamID],
  420.         tmpNode = gPlayerCamData[playerid][p_Node];
  421.  
  422.     ShiftNodeArray(tmpCam, tmpNode, 1);
  423.     JumpToNode(playerid, tmpNode);
  424. }
  425. ShiftNodeArray(camera, startnode, direction=0)
  426. {
  427.     if(direction == 0)
  428.     {
  429.         new iLoop = camMaxNodes[camera]++; // Assign the value then increment it because we are adding another cell
  430.         while(iLoop>=startnode) // Loop from the last node to the startnode
  431.         {
  432.             for(new e;e<MAX_CAMDATA;e++) // Shift all the data to the next node cell
  433.             {
  434.                 camData[camera][iLoop+1][CAM_DATA_ENUM:e] = camData[camera][iLoop][CAM_DATA_ENUM:e];
  435.             }
  436.             iLoop--;
  437.         }
  438.     }
  439.     else
  440.     {
  441.         new iLoop = startnode;
  442.         while(iLoop<=camMaxNodes[camera]) // Loop from the startnode to the last node
  443.         {
  444.             for(new e;e<MAX_CAMDATA;e++)
  445.                 camData[camera][iLoop][CAM_DATA_ENUM:e] = camData[camera][iLoop+1][CAM_DATA_ENUM:e];
  446.  
  447.             iLoop++;
  448.         }
  449.         for(new e;e<MAX_CAMDATA;e++)camData[camera][camMaxNodes[camera]][CAM_DATA_ENUM:e] = 0;
  450.         // I didn't want to have to call two loops
  451.         // But I'm not sure how do to it otherwise!
  452.         // I'll try a backwards loop when I'm more awake!
  453.         // A backwards loop would be able to blank the last cell easier
  454.         camMaxNodes[camera]--; // Decrement the max value, we just removed a cell
  455.     }
  456. }
  457. /* Debugging!
  458.     I used it to test the above function to ensure it
  459.     was shifting the right data without deleting stuff!
  460.  
  461. PRINTALLNODE(c)
  462. {
  463.     new n;
  464.     while(n<MAX_CAMNODE)
  465.     {
  466.         printf("%02d: %d, %d, %d", n, camData[c][n][cam_moveTime], camData[c][n][cam_waitTime], camData[c][n][cam_moveType]);
  467.         n++;
  468.     }
  469. }
  470. */
  471.  
  472. public OnPlayerUpdate(playerid)
  473. {
  474.     if(gPlayerEditingNode[playerid] && freeCamUsed[playerid])
  475.     {
  476.         new
  477.             k,
  478.             ud,
  479.             lr,
  480.             Float:camX,
  481.             Float:camY,
  482.             Float:camZ,
  483.             Float:vecX,
  484.             Float:vecY,
  485.             Float:vecZ,
  486.  
  487.             Float:angR,
  488.             Float:angE,
  489.  
  490.             Float:speed = CAM_SPEED;
  491.  
  492.         GetPlayerKeys(playerid, k, ud, lr);
  493.         GetPlayerCameraPos(playerid, camX, camY, camZ);
  494.         GetPlayerCameraFrontVector(playerid, vecX, vecY, vecZ);
  495.  
  496.         angR = 90-(atan2(vecY, vecX));
  497.         if(angR<0.0)angR=360.0+angR;
  498.         angE = -(floatabs(atan2(floatsqroot(floatpower(vecX, 2.0) + floatpower(vecY, 2.0)), vecZ))-90.0);
  499.  
  500.         if(k==KEY_JUMP)
  501.         {
  502.             speed = CAM_HI_SPEED;
  503.         }
  504.         if(k==KEY_WALK)
  505.         {
  506.             speed = CAM_LO_SPEED;
  507.         }
  508.  
  509.         if(ud==KEY_UP)
  510.         {
  511.             GetXYZFromAngle(camX, camY, camZ, angR, angE, 50.0);
  512.             MoveObject(freeCamObj[playerid], camX, camY, camZ, speed);
  513.         }
  514.         if(ud==KEY_DOWN)
  515.         {
  516.             GetXYZFromAngle(camX, camY, camZ, angR, angE, -50.0);
  517.             MoveObject(freeCamObj[playerid], camX, camY, camZ, speed);
  518.         }
  519.         if(lr==KEY_LEFT)
  520.         {
  521.             GetXYFromAngle(camX, camY, -angR+90.0, 50.0);
  522.             MoveObject(freeCamObj[playerid], camX, camY, camZ, speed);
  523.         }
  524.         if(lr==KEY_RIGHT)
  525.         {
  526.             GetXYFromAngle(camX, camY, -angR+90.0, -50.0);
  527.             MoveObject(freeCamObj[playerid], camX, camY, camZ, speed);
  528.         }
  529.         if(k==KEY_SPRINT)
  530.         {
  531.             MoveObject(freeCamObj[playerid], camX, camY, camZ+50.0, speed);
  532.         }
  533.         if(k==KEY_CROUCH)
  534.         {
  535.             MoveObject(freeCamObj[playerid], camX, camY, camZ-50.0, speed);
  536.         }
  537.         if(ud!=KEY_UP && ud!=KEY_DOWN && lr!=KEY_LEFT && lr!=KEY_RIGHT && k!=KEY_SPRINT && k!=KEY_CROUCH)StopObject(freeCamObj[playerid]);
  538.     }
  539.     return 1;
  540. }
  541. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  542. {
  543.     if(gPlayerEditingNode[playerid])
  544.     {
  545.         if(newkeys & KEY_FIRE)
  546.         {
  547.             new strInfo[64];
  548.             format(strInfo, 64, "Apply changes to node %d?", gPlayerCamData[playerid][p_Node]);
  549.             ShowPlayerDialog(playerid, d_confirmNodeCommit, DIALOG_STYLE_MSGBOX, "Confirm changes?", strInfo, "Apply", "Reset");
  550.         }
  551.         if(newkeys & 16)CancelCurrentNodeEdit(playerid);
  552.     }
  553. }
  554. public OnPlayerClickPlayerTextDraw(playerid, PlayerText:playertextid)
  555. {
  556.     if(playertextid == cam_buttonBack)ShowPlayerDialog(playerid, d_ConfirmQuit, DIALOG_STYLE_MSGBOX, "Exit Editing", "Are you sure you want to quit? All unsaved data will be lost!", "Ok", "Cancel");
  557.  
  558.     if(playertextid == cam_buttonEdit)EditCurrentNode(playerid);
  559.     if(playertextid == cam_buttonSave)ShowPlayerDialog(playerid, d_ExportDialog, DIALOG_STYLE_LIST, "Export Camera As...", "Sequencer Data File\nInterpolate Functions", "Accept", "Cancel");
  560.     if(playertextid == cam_buttonDelt)DeleteCurrentNode(playerid);
  561.     if(playertextid == cam_buttonPrev)MoveCameraToNextNode(playerid, true);
  562.     if(playertextid == cam_buttonAddN)
  563.     {
  564.         if(GetCameraMaxNodes(gPlayerCamData[playerid][p_CamID]) < MAX_CAMNODE-1)EditNewNode(playerid);
  565.         else SendClientMessage(playerid, 0xFF0000FF, "Node limit reached, increase constant <MAX_CAMNODE> in script.");
  566.     }
  567.  
  568.     if(playertextid == cam_arrowLeft)
  569.     {
  570.         new
  571.             tmpCam = gPlayerCamData[playerid][p_CamID],
  572.             tmpNode = gPlayerCamData[playerid][p_Node] - 1;
  573.  
  574.         if(tmpNode < 0)tmpNode = camMaxNodes[tmpCam];
  575.         JumpToNode(playerid, tmpNode);
  576.     }
  577.     if(playertextid == cam_arrowRight)
  578.     {
  579.         new
  580.             tmpCam = gPlayerCamData[playerid][p_CamID],
  581.             tmpNode = gPlayerCamData[playerid][p_Node] + 1;
  582.  
  583.         if(tmpNode > camMaxNodes[tmpCam])tmpNode = 0;
  584.         JumpToNode(playerid, tmpNode);
  585.     }
  586.     if(playertextid == cam_row1Data)ShowPlayerDialog(playerid, d_NodeID, DIALOG_STYLE_INPUT, "Node ID", "Type a node ID to jump to", "Back", "Accept");
  587.     if(playertextid == cam_row2Data)ShowPlayerDialog(playerid, d_MoveTime, DIALOG_STYLE_INPUT, "Move Time", "Time to move to next node (in milliseconds)", "Back", "Accept");
  588.     if(playertextid == cam_row3Data)ShowPlayerDialog(playerid, d_WaitTime, DIALOG_STYLE_INPUT, "Wait Time", "Time to wait before moving to next node (in milliseconds)", "Back", "Accept");
  589.     if(playertextid == cam_row4Data)ShowPlayerDialog(playerid, d_MoveType, DIALOG_STYLE_MSGBOX, "Cut Type", "Select a Camera Cut Type\nMove: Smoothly moves to the next node.\nJump: Jumps to the next node.", "Move", "Jump");
  590. }
  591. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  592. {
  593.     if(dialogid == d_MainMenu)
  594.     {
  595.         if(response)
  596.         {
  597.             if(listitem==0)ShowPlayerDialog(playerid, d_NewCamName, DIALOG_STYLE_INPUT, "New Camera", "Enter the new camera name below.\nDo not use spaces.", "Accept", "Back");
  598.             else
  599.             {
  600.                 SelectedCamera[playerid] = listitem-1;
  601.                 ShowPlayerDialog(playerid, d_ProjectOptions, DIALOG_STYLE_LIST, "Options", "Edit Camera\nPreview Camera", "Accept", "Back");
  602.             }
  603.         }
  604.     }
  605.     if(dialogid == d_NewCamName)
  606.     {
  607.         if(response)
  608.         {
  609.             if(strfind(inputtext, " ") == -1)
  610.             {
  611.                 CreateCameraMover(playerid, inputtext);
  612.                 FormatMainMenu(playerid);
  613.             }
  614.             else ShowPlayerDialog(playerid, d_NewCamName, DIALOG_STYLE_INPUT, "New Camera", "Enter the new camera name below.\n{FF0000}Do not use spaces.", "Accept", "Back");
  615.         }
  616.         else FormatMainMenu(playerid);
  617.     }
  618.     if(dialogid == d_ProjectOptions)
  619.     {
  620.         if(response)
  621.         {
  622.             if(listitem == 0)EditCameraMover(playerid, LoadCameraMover(indexData[SelectedCamera[playerid]]));
  623.             if(listitem == 1)PlayCameraMover(playerid, LoadCameraMover(indexData[SelectedCamera[playerid]]));
  624.         }
  625.         else FormatMainMenu(playerid);
  626.     }
  627.     if(dialogid == d_ExportDialog)
  628.     {
  629.         if(response)
  630.         {
  631.             SaveCameraMover(playerid, listitem);
  632.             SendClientMessage(playerid, 0xFFFF00FF, "Camera saved!");
  633.         }
  634.     }
  635.  
  636.     if(dialogid == d_NodeID)
  637.     {
  638.         new
  639.             tmpCam = gPlayerCamData[playerid][p_CamID],
  640.             nextNode = strval(inputtext);
  641.         if(0 <= nextNode < camMaxNodes[tmpCam])JumpToNode(playerid, nextNode);
  642.         else
  643.         {
  644.             SendClientMessage(playerid, 0xFF1100FF, "Invalid value entered");
  645.             ShowPlayerDialog(playerid, d_NodeID, DIALOG_STYLE_INPUT, "Node ID", "Type a node ID to jump to", "Back", "Accept");
  646.         }
  647.     }
  648.     if(dialogid == d_MoveTime)
  649.     {
  650.         new
  651.             tmpCam = gPlayerCamData[playerid][p_CamID],
  652.             tmpNode = gPlayerCamData[playerid][p_Node],
  653.             tmpMoveTime = strval(inputtext);
  654.  
  655.         if(tmpMoveTime > 0)
  656.         {
  657.             camData[tmpCam][tmpNode][cam_moveTime] = tmpMoveTime;
  658.             UpdateGUI(playerid);
  659.         }
  660.         else
  661.         {
  662.             SendClientMessage(playerid, 0xFF1100FF, "Invalid value entered");
  663.             ShowPlayerDialog(playerid, d_MoveTime, DIALOG_STYLE_INPUT, "Move Time", "Time to move to next node (in milliseconds)", "Back", "Accept");
  664.         }
  665.     }
  666.     if(dialogid == d_WaitTime)
  667.     {
  668.         new
  669.             tmpCam = gPlayerCamData[playerid][p_CamID],
  670.             tmpNode = gPlayerCamData[playerid][p_Node],
  671.             tmpWaitTime = strval(inputtext);
  672.  
  673.         if(tmpWaitTime > 0)
  674.         {
  675.             camData[tmpCam][tmpNode][cam_waitTime] = tmpWaitTime;
  676.             UpdateGUI(playerid);
  677.         }
  678.         else
  679.         {
  680.             SendClientMessage(playerid, 0xFF1100FF, "Invalid value entered");
  681.             ShowPlayerDialog(playerid, d_WaitTime, DIALOG_STYLE_INPUT, "Wait Time", "Time to wait before moving to next node (in milliseconds)", "Back", "Accept");
  682.         }
  683.     }
  684.     if(dialogid == d_MoveType)
  685.     {
  686.         new
  687.             tmpCam = gPlayerCamData[playerid][p_CamID],
  688.             tmpNode = gPlayerCamData[playerid][p_Node];
  689.  
  690.         if(!response)
  691.         {
  692.             camData[tmpCam][tmpNode][cam_moveType] = CAMERA_MOVE;
  693.             UpdateGUI(playerid);
  694.         }
  695.         else
  696.         {
  697.             camData[tmpCam][tmpNode][cam_moveType] = CAMERA_CUT;
  698.             UpdateGUI(playerid);
  699.         }
  700.     }
  701.  
  702.     if(dialogid == d_confirmNodeCommit)
  703.     {
  704.         new
  705.             tmpCam = gPlayerCamData[playerid][p_CamID],
  706.             tmpNode = gPlayerCamData[playerid][p_Node];
  707.  
  708.         if(response)CommitCurrentNode(playerid);
  709.         else
  710.         {
  711.             SetObjectPos(freeCamObj[playerid],
  712.                 camData[tmpCam][tmpNode][cam_cPosX],
  713.                 camData[tmpCam][tmpNode][cam_cPosY],
  714.                 camData[tmpCam][tmpNode][cam_cPosZ]);
  715.         }
  716.     }
  717.  
  718.     if(dialogid == d_ConfirmQuit)
  719.     {
  720.         if(response)
  721.         {
  722.             ExitEditing(playerid);
  723.             FormatMainMenu(playerid);
  724.         }
  725.     }
  726. }
  727.  
  728. public OnPlayerConnect(playerid)
  729. {
  730.     camera_LoadTextDraws(playerid);
  731.     return 1;
  732. }
  733. camera_LoadTextDraws(playerid)
  734. {
  735.     // Background
  736.  
  737.     cam_boxBackground = CreatePlayerTextDraw(playerid, 320.000000, 320.000000, "~n~~n~~n~~n~");
  738.     PlayerTextDrawAlignment(playerid, cam_boxBackground, 2);
  739.     PlayerTextDrawBackgroundColor(playerid, cam_boxBackground, 255);
  740.     PlayerTextDrawFont(playerid, cam_boxBackground, 1);
  741.     PlayerTextDrawLetterSize(playerid, cam_boxBackground, 0.500000, 2.200000);
  742.     PlayerTextDrawColor(playerid, cam_boxBackground, -1);
  743.     PlayerTextDrawSetOutline(playerid, cam_boxBackground, 0);
  744.     PlayerTextDrawSetProportional(playerid, cam_boxBackground, 1);
  745.     PlayerTextDrawSetShadow(playerid, cam_boxBackground, 1);
  746.     PlayerTextDrawUseBox(playerid, cam_boxBackground, 1);
  747.     PlayerTextDrawBoxColor(playerid, cam_boxBackground, 128);
  748.     PlayerTextDrawTextSize(playerid, cam_boxBackground, 380.000000, 300.000000);
  749.  
  750.  
  751.     // Node Switch
  752.  
  753.     cam_arrowLeft = CreatePlayerTextDraw(playerid, 174.000000, 339.000000, "~<~");
  754.     PlayerTextDrawBackgroundColor(playerid, cam_arrowLeft, 255);
  755.     PlayerTextDrawFont(playerid, cam_arrowLeft, 1);
  756.     PlayerTextDrawLetterSize(playerid, cam_arrowLeft, 0.000000, 4.800001);
  757.     PlayerTextDrawColor(playerid, cam_arrowLeft, -1);
  758.     PlayerTextDrawSetOutline(playerid, cam_arrowLeft, 0);
  759.     PlayerTextDrawSetProportional(playerid, cam_arrowLeft, 1);
  760.     PlayerTextDrawSetShadow(playerid, cam_arrowLeft, 1);
  761.     PlayerTextDrawUseBox(playerid, cam_arrowLeft, 1);
  762.     PlayerTextDrawBoxColor(playerid, cam_arrowLeft, 6618980);
  763.     PlayerTextDrawTextSize(playerid, cam_arrowLeft, 210.000000, 58.000000);
  764.     PlayerTextDrawSetSelectable(playerid, cam_arrowLeft, true);
  765.  
  766.     cam_arrowRight = CreatePlayerTextDraw(playerid, 432.000000, 339.000000, "~>~");
  767.     PlayerTextDrawBackgroundColor(playerid, cam_arrowRight, 255);
  768.     PlayerTextDrawFont(playerid, cam_arrowRight, 1);
  769.     PlayerTextDrawLetterSize(playerid, cam_arrowRight, 0.000000, 4.800001);
  770.     PlayerTextDrawColor(playerid, cam_arrowRight, -1);
  771.     PlayerTextDrawSetOutline(playerid, cam_arrowRight, 0);
  772.     PlayerTextDrawSetProportional(playerid, cam_arrowRight, 1);
  773.     PlayerTextDrawSetShadow(playerid, cam_arrowRight, 1);
  774.     PlayerTextDrawUseBox(playerid, cam_arrowRight, 1);
  775.     PlayerTextDrawBoxColor(playerid, cam_arrowRight, 6618980);
  776.     PlayerTextDrawTextSize(playerid, cam_arrowRight, 466.000000, 58.000000);
  777.     PlayerTextDrawSetSelectable(playerid, cam_arrowRight, true);
  778.  
  779.  
  780.     // Info
  781.  
  782.     cam_row1 = CreatePlayerTextDraw(playerid, 240.000000, 325.000000, "Node:");
  783.     PlayerTextDrawBackgroundColor(playerid, cam_row1, 255);
  784.     PlayerTextDrawFont(playerid, cam_row1, 1);
  785.     PlayerTextDrawLetterSize(playerid, cam_row1, 0.300000, 1.000000);
  786.     PlayerTextDrawColor(playerid, cam_row1, -1);
  787.     PlayerTextDrawSetOutline(playerid, cam_row1, 0);
  788.     PlayerTextDrawSetProportional(playerid, cam_row1, 1);
  789.     PlayerTextDrawSetShadow(playerid, cam_row1, 1);
  790.     PlayerTextDrawUseBox(playerid, cam_row1, 1);
  791.     PlayerTextDrawBoxColor(playerid, cam_row1, 3955300);
  792.     PlayerTextDrawTextSize(playerid, cam_row1, 400.000000, 0.000000);
  793.  
  794.     cam_row2 = CreatePlayerTextDraw(playerid, 240.000000, 342.000000, "Move Time (ms):");
  795.     PlayerTextDrawBackgroundColor(playerid, cam_row2, 255);
  796.     PlayerTextDrawFont(playerid, cam_row2, 1);
  797.     PlayerTextDrawLetterSize(playerid, cam_row2, 0.300000, 1.000000);
  798.     PlayerTextDrawColor(playerid, cam_row2, -1);
  799.     PlayerTextDrawSetOutline(playerid, cam_row2, 0);
  800.     PlayerTextDrawSetProportional(playerid, cam_row2, 1);
  801.     PlayerTextDrawSetShadow(playerid, cam_row2, 1);
  802.     PlayerTextDrawUseBox(playerid, cam_row2, 1);
  803.     PlayerTextDrawBoxColor(playerid, cam_row2, 3955300);
  804.     PlayerTextDrawTextSize(playerid, cam_row2, 400.000000, 0.000000);
  805.  
  806.     cam_row3 = CreatePlayerTextDraw(playerid, 240.000000, 360.000000, "Wait Time (ms):");
  807.     PlayerTextDrawBackgroundColor(playerid, cam_row3, 255);
  808.     PlayerTextDrawFont(playerid, cam_row3, 1);
  809.     PlayerTextDrawLetterSize(playerid, cam_row3, 0.300000, 1.000000);
  810.     PlayerTextDrawColor(playerid, cam_row3, -1);
  811.     PlayerTextDrawSetOutline(playerid, cam_row3, 0);
  812.     PlayerTextDrawSetProportional(playerid, cam_row3, 1);
  813.     PlayerTextDrawSetShadow(playerid, cam_row3, 1);
  814.     PlayerTextDrawUseBox(playerid, cam_row3, 1);
  815.     PlayerTextDrawBoxColor(playerid, cam_row3, 3955300);
  816.     PlayerTextDrawTextSize(playerid, cam_row3, 400.000000, 0.000000);
  817.  
  818.     cam_row4 = CreatePlayerTextDraw(playerid, 240.000000, 378.000000, "Cut Type:");
  819.     PlayerTextDrawBackgroundColor(playerid, cam_row4, 255);
  820.     PlayerTextDrawFont(playerid, cam_row4, 1);
  821.     PlayerTextDrawLetterSize(playerid, cam_row4, 0.300000, 1.000000);
  822.     PlayerTextDrawColor(playerid, cam_row4, -1);
  823.     PlayerTextDrawSetOutline(playerid, cam_row4, 0);
  824.     PlayerTextDrawSetProportional(playerid, cam_row4, 1);
  825.     PlayerTextDrawSetShadow(playerid, cam_row4, 1);
  826.     PlayerTextDrawUseBox(playerid, cam_row4, 1);
  827.     PlayerTextDrawBoxColor(playerid, cam_row4, 3955300);
  828.     PlayerTextDrawTextSize(playerid, cam_row4, 400.000000, 0.000000);
  829.  
  830.  
  831.     // Data fields
  832.  
  833.     cam_row1Data = CreatePlayerTextDraw(playerid, 335.000000, 325.000000, "00");
  834.     PlayerTextDrawBackgroundColor(playerid, cam_row1Data, 255);
  835.     PlayerTextDrawFont(playerid, cam_row1Data, 1);
  836.     PlayerTextDrawLetterSize(playerid, cam_row1Data, 0.300000, 1.000000);
  837.     PlayerTextDrawColor(playerid, cam_row1Data, -1);
  838.     PlayerTextDrawSetOutline(playerid, cam_row1Data, 0);
  839.     PlayerTextDrawSetProportional(playerid, cam_row1Data, 1);
  840.     PlayerTextDrawSetShadow(playerid, cam_row1Data, 1);
  841.     PlayerTextDrawUseBox(playerid, cam_row1Data, 1);
  842.     PlayerTextDrawBoxColor(playerid, cam_row1Data, 3955300);
  843.     PlayerTextDrawTextSize(playerid, cam_row1Data, 400.000000, 14.000000);
  844.     PlayerTextDrawSetSelectable(playerid, cam_row1Data, true);
  845.  
  846.     cam_row2Data = CreatePlayerTextDraw(playerid, 335.000000, 342.000000, "00000");
  847.     PlayerTextDrawBackgroundColor(playerid, cam_row2Data, 255);
  848.     PlayerTextDrawFont(playerid, cam_row2Data, 1);
  849.     PlayerTextDrawLetterSize(playerid, cam_row2Data, 0.300000, 1.000000);
  850.     PlayerTextDrawColor(playerid, cam_row2Data, -1);
  851.     PlayerTextDrawSetOutline(playerid, cam_row2Data, 0);
  852.     PlayerTextDrawSetProportional(playerid, cam_row2Data, 1);
  853.     PlayerTextDrawSetShadow(playerid, cam_row2Data, 1);
  854.     PlayerTextDrawUseBox(playerid, cam_row2Data, 1);
  855.     PlayerTextDrawBoxColor(playerid, cam_row2Data, 3955300);
  856.     PlayerTextDrawTextSize(playerid, cam_row2Data, 400.000000, 14.000000);
  857.     PlayerTextDrawSetSelectable(playerid, cam_row2Data, true);
  858.  
  859.     cam_row3Data = CreatePlayerTextDraw(playerid, 335.000000, 360.000000, "00000");
  860.     PlayerTextDrawBackgroundColor(playerid, cam_row3Data, 255);
  861.     PlayerTextDrawFont(playerid, cam_row3Data, 1);
  862.     PlayerTextDrawLetterSize(playerid, cam_row3Data, 0.300000, 1.000000);
  863.     PlayerTextDrawColor(playerid, cam_row3Data, -1);
  864.     PlayerTextDrawSetOutline(playerid, cam_row3Data, 0);
  865.     PlayerTextDrawSetProportional(playerid, cam_row3Data, 1);
  866.     PlayerTextDrawSetShadow(playerid, cam_row3Data, 1);
  867.     PlayerTextDrawUseBox(playerid, cam_row3Data, 1);
  868.     PlayerTextDrawBoxColor(playerid, cam_row3Data, 3955300);
  869.     PlayerTextDrawTextSize(playerid, cam_row3Data, 400.000000, 14.000000);
  870.     PlayerTextDrawSetSelectable(playerid, cam_row3Data, true);
  871.  
  872.     cam_row4Data = CreatePlayerTextDraw(playerid, 335.000000, 378.000000, "MOVE");
  873.     PlayerTextDrawBackgroundColor(playerid, cam_row4Data, 255);
  874.     PlayerTextDrawFont(playerid,cam_row4Data, 1);
  875.     PlayerTextDrawLetterSize(playerid, cam_row4Data, 0.300000, 1.000000);
  876.     PlayerTextDrawColor(playerid, cam_row4Data, 16777215);
  877.     PlayerTextDrawSetOutline(playerid, cam_row4Data, 0);
  878.     PlayerTextDrawSetProportional(playerid, cam_row4Data, 1);
  879.     PlayerTextDrawSetShadow(playerid, cam_row4Data, 1);
  880.     PlayerTextDrawUseBox(playerid, cam_row4Data, 1);
  881.     PlayerTextDrawBoxColor(playerid, cam_row4Data, 3955300);
  882.     PlayerTextDrawTextSize(playerid, cam_row4Data, 400.000000, 14.000000);
  883.     PlayerTextDrawSetSelectable(playerid, cam_row4Data, true);
  884.  
  885.  
  886.     // Edit Controls
  887.  
  888.     cam_buttonEdit = CreatePlayerTextDraw(playerid, 250.000000, 290.000000, "E");
  889.     PlayerTextDrawBackgroundColor(playerid, cam_buttonEdit, 255);
  890.     PlayerTextDrawFont(playerid, cam_buttonEdit, 1);
  891.     PlayerTextDrawLetterSize(playerid, cam_buttonEdit, 1.000000, 2.499999);
  892.     PlayerTextDrawColor(playerid, cam_buttonEdit, -1);
  893.     PlayerTextDrawSetOutline(playerid, cam_buttonEdit, 0);
  894.     PlayerTextDrawSetProportional(playerid, cam_buttonEdit, 1);
  895.     PlayerTextDrawSetShadow(playerid, cam_buttonEdit, 1);
  896.     PlayerTextDrawUseBox(playerid, cam_buttonEdit, 1);
  897.     PlayerTextDrawBoxColor(playerid, cam_buttonEdit, 100);
  898.     PlayerTextDrawTextSize(playerid, cam_buttonEdit, 270.000000, 14.0);
  899.     PlayerTextDrawSetSelectable(playerid, cam_buttonEdit, true);
  900.  
  901.     cam_buttonSave = CreatePlayerTextDraw(playerid, 280.000000, 290.000000, "S");
  902.     PlayerTextDrawBackgroundColor(playerid, cam_buttonSave, 255);
  903.     PlayerTextDrawFont(playerid, cam_buttonSave, 1);
  904.     PlayerTextDrawLetterSize(playerid, cam_buttonSave, 0.829999, 2.499999);
  905.     PlayerTextDrawColor(playerid, cam_buttonSave, -1);
  906.     PlayerTextDrawSetOutline(playerid, cam_buttonSave, 0);
  907.     PlayerTextDrawSetProportional(playerid, cam_buttonSave, 1);
  908.     PlayerTextDrawSetShadow(playerid, cam_buttonSave, 1);
  909.     PlayerTextDrawUseBox(playerid, cam_buttonSave, 1);
  910.     PlayerTextDrawBoxColor(playerid, cam_buttonSave, 100);
  911.     PlayerTextDrawTextSize(playerid, cam_buttonSave, 300.000000, 14.0);
  912.     PlayerTextDrawSetSelectable(playerid, cam_buttonSave, true);
  913.  
  914.     cam_buttonDelt = CreatePlayerTextDraw(playerid, 310.000000, 290.000000, "X");
  915.     PlayerTextDrawBackgroundColor(playerid, cam_buttonDelt, 255);
  916.     PlayerTextDrawFont(playerid, cam_buttonDelt, 1);
  917.     PlayerTextDrawLetterSize(playerid, cam_buttonDelt, 0.890000, 2.499999);
  918.     PlayerTextDrawColor(playerid, cam_buttonDelt, -1);
  919.     PlayerTextDrawSetOutline(playerid, cam_buttonDelt, 0);
  920.     PlayerTextDrawSetProportional(playerid, cam_buttonDelt, 1);
  921.     PlayerTextDrawSetShadow(playerid, cam_buttonDelt, 1);
  922.     PlayerTextDrawUseBox(playerid, cam_buttonDelt, 1);
  923.     PlayerTextDrawBoxColor(playerid, cam_buttonDelt, 100);
  924.     PlayerTextDrawTextSize(playerid, cam_buttonDelt, 330.000000, 14.0);
  925.     PlayerTextDrawSetSelectable(playerid, cam_buttonDelt, true);
  926.  
  927.     cam_buttonPrev = CreatePlayerTextDraw(playerid, 340.000000, 290.000000, ">>");
  928.     PlayerTextDrawBackgroundColor(playerid, cam_buttonPrev, 255);
  929.     PlayerTextDrawFont(playerid, cam_buttonPrev, 1);
  930.     PlayerTextDrawLetterSize(playerid, cam_buttonPrev, 0.389999, 2.499999);
  931.     PlayerTextDrawColor(playerid, cam_buttonPrev, -1);
  932.     PlayerTextDrawSetOutline(playerid, cam_buttonPrev, 0);
  933.     PlayerTextDrawSetProportional(playerid, cam_buttonPrev, 1);
  934.     PlayerTextDrawSetShadow(playerid, cam_buttonPrev, 1);
  935.     PlayerTextDrawUseBox(playerid, cam_buttonPrev, 1);
  936.     PlayerTextDrawBoxColor(playerid, cam_buttonPrev, 100);
  937.     PlayerTextDrawTextSize(playerid, cam_buttonPrev, 360.000000, 14.0);
  938.     PlayerTextDrawSetSelectable(playerid, cam_buttonPrev, true);
  939.  
  940.     cam_buttonAddN = CreatePlayerTextDraw(playerid, 370.000000, 290.000000, "+");
  941.     PlayerTextDrawBackgroundColor(playerid, cam_buttonAddN, 255);
  942.     PlayerTextDrawFont(playerid, cam_buttonAddN, 1);
  943.     PlayerTextDrawLetterSize(playerid, cam_buttonAddN, 0.860000, 2.499999);
  944.     PlayerTextDrawColor(playerid, cam_buttonAddN, -1);
  945.     PlayerTextDrawSetOutline(playerid, cam_buttonAddN, 0);
  946.     PlayerTextDrawSetProportional(playerid, cam_buttonAddN, 1);
  947.     PlayerTextDrawSetShadow(playerid, cam_buttonAddN, 1);
  948.     PlayerTextDrawUseBox(playerid, cam_buttonAddN, 1);
  949.     PlayerTextDrawBoxColor(playerid, cam_buttonAddN, 100);
  950.     PlayerTextDrawTextSize(playerid, cam_buttonAddN, 390.000000, 14.0);
  951.     PlayerTextDrawSetSelectable(playerid, cam_buttonAddN, true);
  952.  
  953.     cam_buttonBack = CreatePlayerTextDraw(playerid, 500.000000, 110.000000, "Back");
  954.     PlayerTextDrawBackgroundColor(playerid, cam_buttonBack, 255);
  955.     PlayerTextDrawFont(playerid, cam_buttonBack, 1);
  956.     PlayerTextDrawLetterSize(playerid, cam_buttonBack, 0.759999, 2.499999);
  957.     PlayerTextDrawColor(playerid, cam_buttonBack, -16776961);
  958.     PlayerTextDrawSetOutline(playerid, cam_buttonBack, 1);
  959.     PlayerTextDrawSetProportional(playerid, cam_buttonBack, 1);
  960.     PlayerTextDrawUseBox(playerid, cam_buttonBack, 1);
  961.     PlayerTextDrawBoxColor(playerid, cam_buttonBack, 100);
  962.     PlayerTextDrawTextSize(playerid, cam_buttonBack, 560.000000, 14.000000);
  963.     PlayerTextDrawSetSelectable(playerid, cam_buttonBack, true);
  964. }
  965.  
  966.  
  967.  
  968. // Separate functions that are used
  969. stock GetXYFromAngle(&Float:x, &Float:y, Float:a, Float:distance)
  970.     x+=(distance*floatsin(-a,degrees)),y+=(distance*floatcos(-a,degrees));
  971.  
  972. stock GetXYZFromAngle(&Float:x, &Float:y, &Float:z, Float:angle, Float:elevation, Float:distance)
  973.     x += ( distance*floatsin(angle,degrees)*floatcos(elevation,degrees) ),y += ( distance*floatcos(angle,degrees)*floatcos(elevation,degrees) ),z += ( distance*floatsin(elevation,degrees) );
  974.  
  975.  
  976.  
  977.  
  978. // Debugging Commands
  979.  
  980. new temp_camid;
  981. public OnPlayerCommandText(playerid, cmdtext[])
  982. {
  983.     new
  984.         cmd[30],
  985.         params[98];
  986.     sscanf(cmdtext, "s[30]s[98]", cmd, params);
  987.  
  988.     if(!strcmp(cmd, "/cameras"))
  989.     {
  990.         FormatMainMenu(playerid);
  991.         return 1;
  992.     }
  993.     if(!strcmp(cmd, "/mouse")) // Just in case you exit mouse mode by accident!
  994.     {
  995.         SelectTextDraw(playerid, 0xFFFF00FF);
  996.         return 1;
  997.     }
  998.  
  999.     // Some debug commands - Not really needed now the editor is here, but they might come in useful if it glitches.
  1000.  
  1001.     if(!strcmp(cmd, "/loadcam"))
  1002.     {
  1003.         temp_camid = LoadCameraMover(params);
  1004.         return 1;
  1005.     }
  1006.     if(!strcmp(cmd, "/playcam"))
  1007.     {
  1008.         PlayCameraMover(playerid, temp_camid, 0, false);
  1009.         return 1;
  1010.     }
  1011.     if(!strcmp(cmd, "/editcam"))
  1012.     {
  1013.         EditCameraMover(playerid, temp_camid);
  1014.         return 1;
  1015.     }
  1016.     if(!strcmp(cmd, "/exitediting"))
  1017.     {
  1018.         ExitEditing(playerid);
  1019.         return 1;
  1020.     }
  1021.     if(!strcmp(cmd, "/loadtds")) // In case the textdraws bug up (Although this shouldn't happen now, textdraws now load every time you enter edit mode)
  1022.     {
  1023.         camera_LoadTextDraws(playerid);
  1024.         SendClientMessage(playerid, 0xFFFF00FF, "Textdraws Loaded!");
  1025.         return 1;
  1026.     }
  1027.     return 0;
  1028. }
  1029.  
  1030.  
  1031. public OnCameraReachNode(playerid, camera, node)
  1032. {
  1033.     if(node == camMaxNodes[camera])ApplyAnimation(0, "PED", "KO_shot_face", 5.0, 0, 1, 1, 1, 0, 1);
  1034. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement