Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*===================================================================================================*\
- ||===================================================================================================||
- || ________ ________ ___ _ ______ ______ ________ ||
- || \ | _____| | ____ | | \ | | | _ \ | _ \ | ____ | / ||
- || ======== \ | |_____ | |____| | | |\ \ | | | | | | | |_| / | |____| | / ======== ||
- || | | _____ | | ____ | | | \ \| | | | | | | _ \ | ____ | | ||
- || ======== / ______| | | | | | | | \ \ | | |_| | | | \ \ | | | | \ ======== ||
- || / |________| |_| |_| |_| \__| |______/ |_| \_| |_| |_| \ ||
- || ||
- ||===================================================================================================||
- || Created on the 10th of March 2009 by =>Sandra<= ||
- || Do NOT remove my credits!! ||
- \*===================================================================================================*/
- #include <a_samp>
- #define MAX_CCTVS 100
- #define MAX_CCTVMENUS 10 //(This number should be MAX_CCTVS divided by 10 (round up))
- #define COLOR_RED 0xAA3333AA
- forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
- enum pInfo{pKey[128],pLevel,pAdmin,pHelper,pVIP,pSocio,pGrampo,gPupgrade,pConnectTime,pReg,pSex,pAge,pMuted,
- pSequestrado,pExp,pCash,pConta,pCrimes,pKills,pDeaths,pPhoneBook,pLottoNr,pFishes,pBiggestFish,pEmprego,
- pSalario,pHeadValue,pHeadValueT,pJailed,pJailTime,pMats,pDrogas,pDrogas2,pDrogas3,pLider,pMembro,pCargo,
- pSkin,pContractTime,pDetSkill,pSexSkill,pBoxSkill,pLawSkill,pMechSkill,pNewsSkill,pDrogasSkill,pCookSkill,
- pFishSkill,Float:pSHealth,pInt,pCapacete,pLocal,pTeam,pPnumber,pPHousekey,pPbiskey,Float:pPos_x,Float:pPos_y,
- Float:pPos_z,pCarLic,pFlyLic,pBoatLic,pFishLic,pGunLic,pPayDay,pCDPlayer,pWins,pLoses,pAlcoholPerk,pDrugPerk,
- pMiserPerk,pPainPerk,pTraderPerk,pTut,pWarns,pMarried,pParedao,pRequestingBackup,pMask,pMaskuse,pBarraca,
- pMarriedTo[64],pSpawn,pSafeDrogas,pSafeDrogas2,pSafeDrogas3,pVeiculo,pVeiculo2,pVeiculo3,pCarKey,pCarKey2,
- psMats,pPHouseCarkey,pLuta,pDorgado,pDorgado2,pDoenca,pCreditos,pLastLogin[20],pGun1,pGun2,pGun3,pGun4,pGun5,
- pGun6,pGun7,pGun8,pGun9,pGun10,pGun11,pGun12,pAmmo1,pAmmo2,pAmmo3,pAmmo4,pAmmo5,pAmmo6, pAmmo7,pAmmo8,pAmmo9,
- pAmmo10,pAmmo11,pAmmo12,pCheckInfoOrg,pCaixinha,pBan,};
- //CameraInfo
- new TotalCCTVS;
- new CameraName[MAX_CCTVS][32];
- new Float:CCTVLA[MAX_PLAYERS][3]; //CCTV LookAt
- new Float:CCTVLAO[MAX_CCTVS][3];
- new Float:CCTVRadius[MAX_PLAYERS]; //CCTV Radius
- new Float:CCTVDegree[MAX_PLAYERS] = 0.0;
- new Float:CCTVCP[MAX_CCTVS][4]; //CCTV CameraPos
- new CurrentCCTV[MAX_PLAYERS] = -1;
- //TextDraw
- new Text:TD;
- //Menus:
- new Menu:CCTVMenu[MAX_CCTVMENUS];
- new MenuType[MAX_CCTVMENUS];
- new TotalMenus;
- new PlayerMenu[MAX_PLAYERS];
- enum LP
- {
- Float:LX,
- Float:LY,
- Float:LZ,
- Float:LA,
- LInterior
- }
- new Spawned[MAX_PLAYERS];
- new LastPos[MAX_PLAYERS][LP];
- new KeyTimer[MAX_PLAYERS];
- public OnFilterScriptInit()
- {
- //Put All AddCCTV-lines here below:
- //======================================================
- //======================================================
- AddCCTV("Posto Sul", 1929.9230,-1738.3425,22.5919, 0.0);
- AddCCTV("Saida LS", 1-15.8403,-1521.7112,9.3724, 180.0);
- AddCCTV("DP LS", 1509.7046,-1681.9382,19.2422, 90.0);
- AddCCTV("Prefeitura", 1519.3434,-1724.9624,22.8507, 0.0);
- AddCCTV("Praca DP", 1451.3877,-1655.5955,24.6834, 90.0);
- AddCCTV("Banco", 1456.7614,-1042.7587,36.6236, 150.0);
- AddCCTV("Loja de Armas", 1792.9620,-1190.6348,40.7203, 270.0);
- AddCCTV("Ammnu Nation", 1333.0316,-1292.9337,29.0600, 270.0);
- AddCCTV("Loterica", 1671.4789,-1137.9192,37.8054, 270.0);
- AddCCTV("Binco", 2256.9570,-1644.5586,20.5150, 0.0);
- AddCCTV("ZIP", 1442.2295,-1176.3035,48.8760, 310.0);
- AddCCTV("VICTIM", 436.5767,-1535.5353,42.0033, 270.0);
- AddCCTV("Hospital", 2035.8033,-1410.3185,24.4542, 90.0);
- //======================================================
- //======================================================
- //Creating Textdraw
- TD = TextDrawCreate(160, 400, "~y~Comandos:~n~Setas: ~w~Move a Camera~n~~y~Espaco: ~w~Aumenta velocidade~n~~y~Agachar: ~w~/saircamera");
- TextDrawLetterSize(TD, 0.4, 0.9);
- TextDrawSetShadow(TD, 0);
- TextDrawUseBox(TD,1);
- TextDrawBoxColor(TD,0x00000055);
- TextDrawTextSize(TD, 380, 400);
- //Creating Menu's
- new Count, Left = TotalCCTVS;
- for(new menu; menu<MAX_CCTVMENUS; menu++)
- {
- if(Left > 12)
- {
- CCTVMenu[menu] = CreateMenu("Escolha Camera:", 1, 200, 100, 220);
- TotalMenus++;
- MenuType[menu] = 1;
- for(new i; i<11; i++)
- {
- AddMenuItem(CCTVMenu[menu], 0, CameraName[Count]);
- Count++;
- Left--;
- }
- AddMenuItem(CCTVMenu[menu], 0, "Proximo");
- }
- else if(Left<13 && Left > 0)
- {
- CCTVMenu[menu] = CreateMenu("Escolha Camera:", 1, 200, 100, 220);
- TotalMenus++;
- MenuType[menu] = 2;
- new tmp = Left;
- for(new i; i<tmp; i++)
- {
- AddMenuItem(CCTVMenu[menu], 0, CameraName[Count]);
- Count++;
- Left--;
- }
- }
- }
- print("\n\n-----------------------------------------------");
- print(" Remote CCTV Filterscript by =>Sandra<= Loaded!");
- print("-----------------------------------------------\n\n");
- return 1;
- }
- public OnFilterScriptExit()
- {
- TextDrawHideForAll(TD);
- TextDrawDestroy(TD);
- for(new i; i<TotalMenus; i++)
- {
- DestroyMenu(CCTVMenu[i]);
- }
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- Spawned[playerid] = 0;
- CurrentCCTV[playerid] = -1;
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- if(CurrentCCTV[playerid] > -1)
- {
- KillTimer(KeyTimer[playerid]);
- TextDrawHideForPlayer(playerid, TD);
- }
- CurrentCCTV[playerid] = -1;
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- Spawned[playerid] = 1;
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- Spawned[playerid] = 0;
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if (strcmp("/camera", cmdtext, true) == 0)
- {
- if(PlayerToPoint(5.0,playerid,217.3896,81.3217,1005.0391))
- {
- PlayerMenu[playerid] = 0;
- TogglePlayerControllable(playerid, 0);
- ShowMenuForPlayer(CCTVMenu[0], playerid);
- }
- return 1;
- }
- if (strcmp("/saircamera", cmdtext, true) == 0)
- {
- if(CurrentCCTV[playerid] > -1)
- {
- SetPlayerPos(playerid, LastPos[playerid][LX], LastPos[playerid][LY], LastPos[playerid][LZ]);
- SetPlayerFacingAngle(playerid, LastPos[playerid][LA]);
- SetPlayerInterior(playerid, LastPos[playerid][LInterior]);
- TogglePlayerControllable(playerid, 1);
- KillTimer(KeyTimer[playerid]);
- SetCameraBehindPlayer(playerid);
- TextDrawHideForPlayer(playerid, TD);
- CurrentCCTV[playerid] = -1;
- return 1;
- }
- }
- return 0;
- }
- forward CheckKeyPress(playerid);
- public CheckKeyPress(playerid)
- {
- new keys, updown, leftright;
- GetPlayerKeys(playerid, keys, updown, leftright);
- if(CurrentCCTV[playerid] > -1 && PlayerMenu[playerid] == -1)
- {
- if(leftright == KEY_RIGHT)
- {
- if(keys == KEY_SPRINT)
- {
- CCTVDegree[playerid] = (CCTVDegree[playerid] - 2.0);
- }
- else
- {
- CCTVDegree[playerid] = (CCTVDegree[playerid] - 0.5);
- }
- if(CCTVDegree[playerid] < 0)
- {
- CCTVDegree[playerid] = 359;
- }
- MovePlayerCCTV(playerid);
- }
- if(leftright == KEY_LEFT)
- {
- if(keys == KEY_SPRINT)
- {
- CCTVDegree[playerid] = (CCTVDegree[playerid] + 2.0);
- }
- else
- {
- CCTVDegree[playerid] = (CCTVDegree[playerid] + 0.5);
- }
- if(CCTVDegree[playerid] >= 360)
- {
- CCTVDegree[playerid] = 0;
- }
- MovePlayerCCTV(playerid);
- }
- if(updown == KEY_UP)
- {
- if(CCTVRadius[playerid] < 25)
- {
- if(keys == KEY_SPRINT)
- {
- CCTVRadius[playerid] = (CCTVRadius[playerid] + 0.5);
- MovePlayerCCTV(playerid);
- }
- else
- {
- CCTVRadius[playerid] = (CCTVRadius[playerid] + 0.1);
- MovePlayerCCTV(playerid);
- }
- }
- }
- if(updown == KEY_DOWN)
- {
- if(keys == KEY_SPRINT)
- {
- if(CCTVRadius[playerid] >= 0.6)
- {
- CCTVRadius[playerid] = (CCTVRadius[playerid] - 0.5);
- MovePlayerCCTV(playerid);
- }
- }
- else
- {
- if(CCTVRadius[playerid] >= 0.2)
- {
- CCTVRadius[playerid] = (CCTVRadius[playerid] - 0.1);
- MovePlayerCCTV(playerid);
- }
- }
- }
- if(keys == KEY_CROUCH)
- {
- OnPlayerCommandText(playerid, "/saircamera");
- }
- }
- MovePlayerCCTV(playerid);
- }
- stock MovePlayerCCTV(playerid)
- {
- CCTVLA[playerid][0] = CCTVLAO[CurrentCCTV[playerid]][0] + (floatmul(CCTVRadius[playerid], floatsin(-CCTVDegree[playerid], degrees)));
- CCTVLA[playerid][1] = CCTVLAO[CurrentCCTV[playerid]][1] + (floatmul(CCTVRadius[playerid], floatcos(-CCTVDegree[playerid], degrees)));
- SetPlayerCameraLookAt(playerid, CCTVLA[playerid][0], CCTVLA[playerid][1], CCTVLA[playerid][2]);
- }
- stock AddCCTV(name[], Float:X, Float:Y, Float:Z, Float:Angle)
- {
- if(TotalCCTVS >= MAX_CCTVS) return 0;
- format(CameraName[TotalCCTVS], 32, "%s", name);
- CCTVCP[TotalCCTVS][0] = X;
- CCTVCP[TotalCCTVS][1] = Y;
- CCTVCP[TotalCCTVS][2] = Z;
- CCTVCP[TotalCCTVS][3] = Angle;
- CCTVLAO[TotalCCTVS][0] = X;
- CCTVLAO[TotalCCTVS][1] = Y;
- CCTVLAO[TotalCCTVS][2] = Z-10;
- TotalCCTVS++;
- return TotalCCTVS-1;
- }
- SetPlayerToCCTVCamera(playerid, CCTV)
- {
- if(CCTV >= TotalCCTVS)
- {
- SendClientMessage(playerid, 0xFF0000AA, "Invald CCTV");
- return 1;
- }
- if(CurrentCCTV[playerid] == -1)
- {
- GetPlayerPos(playerid, LastPos[playerid][LX], LastPos[playerid][LY], LastPos[playerid][LZ]);
- GetPlayerFacingAngle(playerid, LastPos[playerid][LA]);
- LastPos[playerid][LInterior] = GetPlayerInterior(playerid);
- SetPlayerInterior(playerid, 6); //Troque o "A" pelo ID do interior da Origem 1.
- }
- else
- {
- KillTimer(KeyTimer[playerid]);
- }
- CurrentCCTV[playerid] = CCTV;
- TogglePlayerControllable(playerid, 0);
- //SetPlayerPos(playerid, CCTVCP[CCTV][0], CCTVCP[CCTV][1], (CCTVCP[CCTV][2]-50));
- SetPlayerPos(playerid, CCTVCP[CCTV][0], CCTVCP[CCTV][1], -100.0);
- SetPlayerCameraPos(playerid, CCTVCP[CCTV][0], CCTVCP[CCTV][1], CCTVCP[CCTV][2]);
- SetPlayerCameraLookAt(playerid, CCTVLAO[CCTV][0], (CCTVLAO[CCTV][1]+0.2), CCTVLAO[CCTV][2]);
- CCTVLA[playerid][0] = CCTVLAO[CCTV][0];
- CCTVLA[playerid][1] = CCTVLAO[CCTV][1]+0.2;
- CCTVLA[playerid][2] = CCTVLAO[CCTV][2];
- SetPlayerInterior(playerid, 0); //Troque o "A" pelo ID do interior da Origem 1.
- CCTVRadius[playerid] = 12.5;
- CCTVDegree[playerid] = CCTVCP[CCTV][3];
- MovePlayerCCTV(playerid);
- KeyTimer[playerid] = SetTimerEx("CheckKeyPress", 75, 1, "i", playerid);
- TextDrawShowForPlayer(playerid, TD);
- return 1;
- }
- public OnPlayerSelectedMenuRow(playerid, row)
- {
- new Menu:Current = GetPlayerMenu(playerid);
- for(new menu; menu<TotalMenus; menu++)
- {
- if(Current == CCTVMenu[menu])
- {
- if(MenuType[PlayerMenu[playerid]] == 1)
- {
- if(row == 11)
- {
- ShowMenuForPlayer(CCTVMenu[menu+1], playerid);
- TogglePlayerControllable(playerid, 0);
- PlayerMenu[playerid] = (menu+1);
- }
- else
- {
- if(PlayerMenu[playerid] == 0)
- {
- SetPlayerToCCTVCamera(playerid, row);
- PlayerMenu[playerid] = -1;
- }
- else
- {
- SetPlayerToCCTVCamera(playerid, ((PlayerMenu[playerid]*11)+row));
- PlayerMenu[playerid] = -1;
- }
- }
- }
- else
- {
- if(PlayerMenu[playerid] == 0)
- {
- SetPlayerToCCTVCamera(playerid, row);
- PlayerMenu[playerid] = -1;
- }
- else
- {
- SetPlayerToCCTVCamera(playerid, ((PlayerMenu[playerid]*11)+row));
- PlayerMenu[playerid] = -1;
- }
- }
- }
- }
- return 1;
- }
- public OnPlayerExitedMenu(playerid)
- {
- TogglePlayerControllable(playerid, 1);
- PlayerMenu[playerid] = -1;
- return 1;
- }
- public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
- {
- if(IsPlayerConnected(playerid))
- {
- new Float:oldposx, Float:oldposy, Float:oldposz;
- new Float:tempposx, Float:tempposy, Float:tempposz;
- GetPlayerPos(playerid, oldposx, oldposy, oldposz);
- tempposx = (oldposx -x);
- tempposy = (oldposy -y);
- tempposz = (oldposz -z);
- //printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,posz);
- if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
- {
- return 1;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment