Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //with love from Russia xD
- #include <a_samp>
- #define nomerok "Car Bond" // number
- #define DefaultPaswword "1234" // default password
- forward times();
- forward nevidim(playerid);
- new
- timer1, carbond, strin[25],
- Apec, AHTOXA, time,
- PlayerText3D:CarLabel[MAX_PLAYERS],
- bool:LabelActive[MAX_PLAYERS],
- Float:OldHealth[MAX_PLAYERS],
- Float:OldDamage[MAX_PLAYERS],
- Float:CDamage[MAX_PLAYERS],
- timercar[MAX_PLAYERS],
- Float:plocx,Float:plocy,Float:plocz,Float:ploca,
- ship, passon = 1, pass[32], hpon,
- engine,lights,alarm,doors,bonnet,boot,objective, panels, tires,
- smoketimer, smoke,smoke1,smoke2,
- shiptimer, boomtimer, boomertimer,bool:boomertimerOn,
- vvodpass, obj[46], id;
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" Blank Filterscript by your name here");
- print("--------------------------------------\n");
- time = SetTimer("times", 1000, true);
- carbond = AddStaticVehicle(555,-1944.19995117,265.89999390,35.90000153,90.00000000,0,0); //
- obj[0] = CreateObject(3438,-1943.00000000,266.00000000,34.79999924,0.00000000,90.00000000,0.00000000); //
- obj[1] = CreateObject(3440,-1948.40002441,266.00000000,32.50000000,0.00000000,0.00000000,0.00000000); //
- obj[2] = CreateObject(11472,-1943.59997559,266.00000000,29.10000038,90.00000000,0.00000000,270.00000000); //
- obj[3] = CreateObject(11472,-1943.59960938,266.00000000,29.10000038,90.00000000,0.00000000,242.00000000); //
- obj[4] = CreateObject(11472,-1943.59960938,266.00000000,29.10000038,90.00000000,0.00000000,213.99584961); //
- obj[5] = CreateObject(11472,-1943.59960938,266.00000000,29.10000038,90.00000000,0.00000000,185.99169922); //
- obj[6] = CreateObject(11472,-1941.00000000,266.20001221,29.10000038,90.00000000,0.00000000,185.73559570); //
- obj[7] = CreateObject(11472,-1943.59960938,266.00000000,29.10000038,90.00000000,0.00000000,298.00000000); //
- obj[8] = CreateObject(11472,-1943.59960938,266.00000000,29.10000038,90.00000000,0.00000000,325.99865723); //
- obj[9] = CreateObject(11472,-1943.59960938,266.00000000,29.10000038,90.00000000,0.00000000,353.74731445); //
- obj[10] = CreateObject(11472,-1942.29980469,266.09960938,29.10000038,90.00000000,0.00000000,182.73754883); //
- obj[11] = CreateObject(11472,-1942.30004883,265.89999390,29.10000038,90.00000000,0.00000000,357.49328613); //
- obj[12] = CreateObject(11472,-1941.19995117,265.79998779,29.10000038,90.00000000,0.00000000,352.48962402); //
- obj[13] = CreateObject(3440,-1946.19995117,266.00000000,34.70000076,0.00000000,90.00000000,180.25000000); //
- obj[14] = CreateObject(3440,-1945.80004883,267.70001221,34.70000076,0.00000000,90.00000000,315.00000000); //
- obj[15] = CreateObject(3440,-1945.80004883,264.29998779,34.70000076,0.00000000,90.00000000,45.00000000); //
- obj[16] = CreateObject(1649,-1943.09997559,269.20001221,34.90000153,270.00000000,0.00000000,90.00000000); //
- obj[17] = CreateObject(1649,-1943.09997559,262.79998779,34.90000153,270.00000000,0.00000000,90.00000000); //
- obj[18] = CreateObject(3440,-1941.69995117,269.00000000,34.70000076,0.00000000,90.00000000,90.00000000); //
- obj[19] = CreateObject(3440,-1944.80004883,268.79998779,34.70000076,0.00000000,90.00000000,90.00000000); //
- obj[20] = CreateObject(3440,-1944.80004883,263.20001221,34.70000076,0.00000000,90.00000000,270.00000000); //
- obj[21] = CreateObject(3440,-1941.69995117,262.89999390,34.70000076,0.00000000,90.00000000,270.00000000); //
- obj[22] = CreateObject(3440,-1944.80004883,271.10000610,32.40000153,0.00000000,0.00000000,0.00000000); //
- obj[23] = CreateObject(3440,-1941.59997559,271.10000610,32.40000153,0.00000000,0.00000000,0.00000000); //
- obj[24] = CreateObject(3440,-1941.69995117,260.70001221,32.40000153,0.00000000,0.00000000,0.00000000); //
- obj[25] = CreateObject(3440,-1944.80004883,260.89999390,32.40000153,0.00000000,0.00000000,0.00000000); //
- obj[26] = CreateObject(3440,-1947.40002441,262.70001221,32.40000153,0.00000000,0.00000000,0.00000000); //
- obj[27] = CreateObject(3440,-1947.40002441,269.29998779,32.40000153,0.00000000,0.00000000,0.00000000); //
- obj[28] = CreateObject(1649,-1946.27001953,266.00000000,34.90000153,270.00000000,0.00000000,0.00000000); //
- obj[29] = CreateObject(2707,-1945.90002441,267.79998779,35.11999893,0.00000000,179.99450684,179.99450684); //
- obj[30] = CreateObject(2707,-1944.80004883,268.70001221,35.11999893,0.00000000,179.99450684,179.99450684); //
- obj[31] = CreateObject(2707,-1944.80004883,263.29998779,35.11999893,0.00000000,179.99450684,179.99450684); //
- obj[32] = CreateObject(2707,-1945.93005371,264.29998779,35.11999893,0.00000000,179.99450684,179.99450684); //
- obj[33] = CreateObject(2707,-1946.50000000,266.01953125,35.11999893,0.00000000,179.99450684,179.99450684); //
- obj[34] = CreateObject(19284,-1946.50000000,266.00000000,35.20000076,0.00000000,0.00000000,0.00000000); //
- obj[35] = CreateObject(19284,-1945.90002441,267.79998779,35.20000076,0.00000000,0.00000000,0.00000000); //
- obj[36] = CreateObject(19284,-1944.80004883,268.70001221,35.20000076,0.00000000,0.00000000,0.00000000); //
- obj[37] = CreateObject(19284,-1944.80004883,263.29998779,35.20000076,0.00000000,0.00000000,0.00000000); //
- obj[38] = CreateObject(19284,-1946.00000000,264.29998779,35.20000076,0.00000000,0.00000000,0.00000000); //
- obj[39] = CreateObject(19279,-1947.40002441,262.60000610,35.09999847,0.00000000,0.00000000,312.25000000); //
- obj[40] = CreateObject(19279,-1947.50000000,269.39999390,35.09999847,0.00000000,0.00000000,232.24792480); //
- obj[41] = CreateObject(19279,-1944.80004883,271.20001221,35.09999847,0.00000000,0.00000000,182.24548340); //
- obj[42] = CreateObject(19279,-1944.80004883,260.79998779,35.09999847,0.00000000,0.00000000,0.00000000); //
- obj[43] = CreateObject(9123,-1943.19995117,266.00000000,9.50000000,0.00000000,90.00000000,0.00000000); //
- obj[44] = CreateObject(9129,-1940.69995117,265.79998779,34.79999924,0.00000000,0.00000000,270.00000000); //
- obj[45] = CreateObject(9129,-1940.69995117,265.79998779,32.90000153,0.00000000,0.00000000,270.00000000); //
- SetVehicleNumberPlate(carbond,nomerok);
- SetVehicleToRespawn(carbond);
- AddVehicleComponent(carbond, 1010);
- strmid(pass,DefaultPaswword,0,32);
- return 1;
- }
- public OnFilterScriptExit()
- {
- DestroyVehicle(carbond);
- DestroyObject(smoke); DestroyObject(smoke1); DestroyObject(smoke2);
- DestroyObject(ship);
- KillTimer(time);
- for(new i; i < 46; i++)
- {
- DestroyObject(obj[i]);
- }
- return 1;
- }
- public times()// таймер не трогать
- {
- if(shiptimer >= 1) { shiptimer -= 1; }
- if(smoketimer >= 1) { smoketimer -= 1; }
- else { DestroyObject(smoke); DestroyObject(smoke1); DestroyObject(smoke2); }
- if(AHTOXA >= 1) { AHTOXA -= 1; }
- if(boomtimer >= 1) { boomtimer -= 1; }
- if(boomertimerOn == true && boomertimer >= 1) { format(strin,sizeof(strin),"~r~Wait %d",boomertimer); GameTextForPlayer(id, strin, 1000, 4); boomertimer -= 1; }
- else {
- if(boomertimerOn == true) {
- new Float:Coord[3]; GetVehiclePos(carbond,Coord[0],Coord[1],Coord[2]); SetVehicleToRespawn(carbond);
- CreateExplosion(Coord[0],Coord[1],Coord[2],2,10); CreateExplosion(Coord[0]-5,Coord[1],Coord[2],2,10);
- CreateExplosion(Coord[0]+5,Coord[1],Coord[2],2,10); CreateExplosion(Coord[0],Coord[1]-5,Coord[2],2,10);
- CreateExplosion(Coord[0],Coord[1]+5,Coord[2],2,10); boomertimerOn = false;
- }
- }
- return 0;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER) return 1;
- if(newkeys & 2048)
- {
- if(!vvodpass && passon) return SendClientMessage(playerid, 0xFFFFFFF,"functional car blocked access the menu / bond");
- if(GetPlayerVehicleID(playerid) == carbond)
- {
- if(!shiptimer)
- {
- DestroyObject(ship);
- GetVehicleZAngle(carbond,ploca);
- GetVehiclePos(carbond,plocx,plocy,plocz);
- ship = CreateObject(2899, plocx+10.0*floatsin(ploca,degrees),plocy-4.0*floatcos(ploca,degrees),plocz-0.65, 0, 0, ploca-90);
- shiptimer = 180;
- }
- else
- {
- format(strin,sizeof(strin),"wait %d reload",shiptimer);
- SendClientMessage(playerid, 0xFFFFFFF,strin);
- }
- }
- return 1;
- }
- if(newkeys & 8192)
- {
- if(!vvodpass && passon) return SendClientMessage(playerid, 0xFFFFFFF,"functional car blocked access the menu / bond");
- if(GetPlayerVehicleID(playerid) == carbond)
- {
- if(!AHTOXA)
- {
- AHTOXA = 120; smoketimer = 30;
- smoke = CreateObject(18715,0,0,0,0,0,0);
- smoke1 = CreateObject(18715,0,0,0,0,0,0);
- smoke2 = CreateObject(18715,0,0,0,0,0,0);
- AttachObjectToVehicle(smoke, carbond, 0, -1, -1, -90, 0, 180);
- AttachObjectToVehicle(smoke1, carbond, 0, 1, 1, -90, 0, 180);
- AttachObjectToVehicle(smoke2, carbond, 0, 2, 2, -90, 0, 180);
- }
- else
- {
- format(strin,sizeof(strin),"wait %d reload",AHTOXA);
- SendClientMessage(playerid, 0xFFFFFFF,strin);
- }
- }
- }
- if(newkeys & 4096)
- {
- if(!vvodpass && passon) return SendClientMessage(playerid, 0xFFFFFFF,"functional car blocked access the menu / bond");
- if(GetPlayerVehicleID(playerid) == carbond)
- {
- if(!boomtimer)
- {
- new AHTOXA1;
- AHTOXA1 = CreateObject(18730, 0, 0, 0, 0, 0, 0);
- AttachObjectToVehicle(AHTOXA1, carbond, 0, -1, 2, -90, 0, 180);
- new Float:Cord[4];
- GetVehicleZAngle(carbond,Cord[3]);
- GetVehiclePos(carbond,Cord[0],Cord[1],Cord[2]);
- CreateExplosion(Cord[0]+10.0*floatsin(Cord[3],degrees),Cord[1]-4.0*floatcos(Cord[3],degrees),Cord[2]-0.65, 11, 10.0);
- boomtimer = 240;
- }
- else
- {
- format(strin,sizeof(strin),"wait %d reload",boomtimer);
- SendClientMessage(playerid, 0xFFFFFFF,strin);
- }
- }
- }
- if(newkeys & 16384 && GetPlayerVehicleID(playerid) == carbond) { OnPlayerCommandText(playerid,"/bond"); }
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if(strcmp(cmdtext, "/bond",true) == 0)
- {
- if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER) return 1;
- if(GetPlayerVehicleID(playerid) == carbond)
- {
- if(passon == 1 && !vvodpass)
- {
- ShowPlayerDialog(playerid,3425,DIALOG_STYLE_INPUT,"Computer", "This machine is password protected","OK","Cancel");
- }
- else
- {
- ShowPlayerDialog(playerid,3422,DIALOG_STYLE_LIST,"Computer","[1]Hiding\n[2]Change color\n[3] sensors Damage ON|OFF\n[4]fix the tire\n[5]password\n[6]self-destruction","OK","Cancel");
- }
- }
- else return SendClientMessage(playerid, 0xFFFFFFFF, "You are not in the car");
- return 1;
- }
- if(strcmp(cmdtext, "/getbondcar", true) == 0)
- {
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFFFFFF, "This car is strongly Out of My League xD");
- new Float:x,Float:y,Float:z;
- GetPlayerPos(playerid,x,y,z);
- SetVehiclePos(carbond,x,y,z);
- PutPlayerInVehicle(playerid,carbond,0);
- return 1;
- }
- if(strcmp(cmdtext, "/getpass", true) == 0)
- {
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFFFFFF, "Вы не админ");
- SendClientMessage(playerid, 0xFFFFFF,"The default password is 1234");
- format(strin,sizeof(strin),"password now - %s", pass);
- SendClientMessage(playerid, 0xFFFFFF, strin);
- return 1;
- }
- return false;
- }
- public nevidim(playerid)
- {
- if(GetVehicleSpeed() != 0)
- {
- LinkVehicleToInterior(carbond, 0);
- }
- else
- {
- LinkVehicleToInterior(carbond, 1);
- }
- return 0;
- }
- new oldcar;
- public OnPlayerStateChange(playerid, newstate, oldstate)
- {
- if(newstate == PLAYER_STATE_DRIVER && GetPlayerVehicleID(playerid) == carbond)
- {
- for(new i = 0; i < GetMaxPlayers(); i++)
- {
- ShowPlayerNameTagForPlayer(i, playerid, 0);
- }
- oldcar = carbond;
- }
- if(newstate == PLAYER_STATE_ONFOOT && oldcar)
- {
- LinkVehicleToInterior(carbond, 0);
- KillTimer(timer1);
- vvodpass = 0;
- oldcar = 0;
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- ShowPlayerNameTagForPlayer(i, playerid, 1);
- }
- }
- return 0;
- }
- public OnPlayerUpdate(playerid)
- {
- if(hpon == 1) UpdateHP(playerid);
- if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
- {
- if(IsPlayerInRangeOfPoint(playerid, 3.0, plocx+10.0*floatsin(ploca,degrees),plocy-4.0*floatcos(ploca,degrees),plocz-0.65))
- {
- GetVehicleDamageStatus(GetPlayerVehicleID(playerid), panels, doors, lights, tires);
- tires = encode_tires(1, 1, 1, 1);
- UpdateVehicleDamageStatus(GetPlayerVehicleID(playerid), panels, doors, lights, tires);
- return 0;
- }
- }
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- switch(dialogid)
- {
- case 3422:
- {
- if(response)
- {
- if(GetPlayerVehicleID(playerid) != carbond) return SendClientMessage(playerid, 0xFFFFFFFF, "you are not in the car");
- if(listitem == 0)
- {
- ShowPlayerDialog(playerid,3423,DIALOG_STYLE_MSGBOX ,"Computer","disguise","ON","OFF");
- }
- if(listitem == 1)
- {
- if(Apec == 1)
- {
- ChangeVehicleColor(carbond, 0, 0);
- Apec = 0;
- }
- else
- {
- ChangeVehicleColor(carbond, 1, 1);
- Apec = 1;
- }
- }
- if(listitem == 2)
- {
- if(hpon == 0)
- {
- CarLabel[playerid] = CreatePlayer3DTextLabel(playerid," ",-1,0,0,0.9,10.0,INVALID_PLAYER_ID,carbond,1);
- UpdateBar(playerid);
- hpon = 1;
- }
- else
- {
- DeletePlayer3DTextLabel(playerid,CarLabel[playerid]);
- hpon = 0;
- }
- }
- if(listitem == 3)
- {
- new carid = GetPlayerVehicleID(playerid);
- GetVehicleDamageStatus(carid, panels, doors, lights, tires);
- tires = encode_tires(0, 0, 0, 0);
- UpdateVehicleDamageStatus(carid, panels, doors, lights, tires);
- }
- if(listitem == 4)
- {
- ShowPlayerDialog(playerid,3426,DIALOG_STYLE_LIST ,"Computer","[1]ON/OFF password\n[2]change Password","OK","cancel");
- }
- if(listitem == 5)
- {
- ShowPlayerDialog(playerid,3428,DIALOG_STYLE_INPUT ,"self-destruction","set time","OK","cancel");
- }
- }
- }
- case 3423:
- {
- if(response)
- {
- timer1 = SetTimer("nevidim", 2000, true);
- }
- else
- {
- KillTimer(timer1);
- LinkVehicleToInterior(carbond, 0);
- }
- }
- case 3424:
- {
- if(response)
- {
- GetVehicleParamsEx(carbond,engine,lights,alarm,doors,bonnet,boot,objective);
- SetVehicleParamsEx(carbond,engine,lights,alarm,doors,bonnet,1,objective);
- }
- else
- {
- GetVehicleParamsEx(carbond,engine,lights,alarm,doors,bonnet,boot,objective);
- SetVehicleParamsEx(carbond,engine,lights,alarm,doors,bonnet,0,objective);
- }
- }
- case 3425:
- {
- if(response)
- {
- if(strcmp(pass, inputtext, false, strlen(inputtext))==0 && strlen(inputtext) == strlen(pass))
- {
- vvodpass = 1;
- }
- else
- {
- ShowPlayerDialog(playerid,3425,DIALOG_STYLE_INPUT,"computer","This machine is password protected","OK","cancel");
- return 1;
- }
- }
- else
- {
- RemovePlayerFromVehicle(playerid);
- }
- }
- case 3426:
- {
- if(response)
- {
- if(listitem == 0)
- {
- if(passon == 0)
- {
- passon = 1;
- SendClientMessage(playerid, 0xFFFFFF, "password protected");
- }
- else
- {
- passon = 0;
- SendClientMessage(playerid, 0xFFFFFF, "Тprotection is removed");
- }
- return 1;
- }
- if(listitem == 1)
- {
- ShowPlayerDialog(playerid,3427,DIALOG_STYLE_INPUT,"computer","enter a new password","yes","no");
- return 1;
- }
- }
- }
- case 3427:
- {
- if(response)
- {
- if(!strlen(inputtext)) return SendClientMessage(playerid, 0xFFFFFFFF, "no password");
- new message[61];
- strmid(pass,inputtext,0,32);
- format(message,sizeof(message),"new password - %s",inputtext);
- SendClientMessage(playerid, 0xFFFFFFFF, message);
- }
- }
- case 3428:
- {
- if(response)
- {
- if(boomertimerOn == true) return SendClientMessage(playerid, 0xFFFFFFFF, "timer is already running!");
- if(strval(inputtext) > 60 || strval(inputtext) < 0) return SendClientMessage(playerid, 0xFFFFFFFF, "No more than 60 and not less than 0");
- boomertimer = strval(inputtext);
- boomertimerOn = true;
- id = playerid;
- }
- }
- }
- return 0;
- }
- stock GetVehicleSpeed()
- {
- new Float:ST[4];
- GetVehicleVelocity(carbond,ST[0],ST[1],ST[2]);
- ST[3] = floatsqroot(floatpower(floatabs(ST[0]), 2.0) + floatpower(floatabs(ST[1]), 2.0) + floatpower(floatabs(ST[2]), 2.0)) * 150.3;
- return floatround(ST[3]);
- }
- encode_tires(tire1, tire2, tire3, tire4) return tire1 | (tire2 << 1) | (tire3 << 2) | (tire4 << 3);
- public OnPlayerConnect(playerid) { LabelActive[playerid] = false; SetPlayerColor(playerid, 0xFFFFFF00); }
- stock UpdateHP(playerid)
- {
- if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return 1;
- new Float:HP,veh;
- veh = carbond;
- GetVehicleHealth(veh, HP);
- if(HP != OldHealth[playerid])
- {
- OldDamage[playerid]=OldHealth[playerid]-HP;
- OldHealth[playerid] = HP;
- if(OldDamage[playerid] > 0)
- {
- new texts[128];
- if(LabelActive[playerid])
- {
- CDamage[playerid]+=OldDamage[playerid];
- format(texts,sizeof(texts),"{ffd800}-%.0f\n%s",CDamage[playerid],UpdateString(HP));
- KillTimer(timercar[playerid]);
- timercar[playerid] = SetTimerEx("DeleteText", 2000, 0, "i", playerid);
- }
- else
- {
- LabelActive[playerid] = true;
- format(texts,sizeof(texts),"{ffd800}-%.0f\n%s",OldDamage[playerid],UpdateString(HP));
- timercar[playerid] = SetTimerEx("DeleteText", 2000, 0, "i", playerid);
- }
- UpdatePlayer3DTextLabelText(playerid, CarLabel[playerid], -1, texts);
- }
- }
- return 1;
- }
- stock UpdateBar(playerid)
- {
- new Float:HP,veh;
- veh = carbond;
- GetVehicleHealth(veh, HP);
- UpdateString(HP);
- UpdatePlayer3DTextLabelText(playerid, CarLabel[playerid], -1, UpdateString(HP));
- return 1;
- }
- stock UpdateString(Float:HP)
- {
- new str[30];
- if(HP == 1000) format(str,sizeof(str),"{00ff00}••••••••••");
- else if(HP >= 900) format(str,sizeof(str),"{66ff00}•••••••••{ffffff}•");
- else if(HP >= 800) format(str,sizeof(str),"{7fff00}••••••••{ffffff}••");
- else if(HP >= 700) format(str,sizeof(str),"{ccff00}•••••••{ffffff}•••");
- else if(HP >= 600) format(str,sizeof(str),"{f7f21a}••••••{ffffff}••••");
- else if(HP >= 500) format(str,sizeof(str),"{f4c430}•••••{ffffff}•••••");
- else if(HP >= 400) format(str,sizeof(str),"{e49b0f}••••{ffffff}••••••");
- else if(HP >= 300) format(str,sizeof(str),"{e4650e}•••{ffffff}•••••••");
- else if(HP >= 250) format(str,sizeof(str),"{ff2400}••{ffffff}••••••••");
- else format(str,sizeof(str),"{ff2400}Boom!");
- return str;
- }
- forward DeleteText(playerid);
- public DeleteText(playerid)
- {
- KillTimer(timercar[playerid]);
- LabelActive[playerid] = false;
- UpdateBar(playerid);
- CDamage[playerid]=0;
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment