Gate Problem
#1

Hello I was wondering if there was a way in sa-mp to code a gate to only open for a certain player name like mark_hilt for example is this possible?
Reply
#2

because I am editing a gate script and I just wondered ifI could
Reply
#3

pawn Код:
new pName[24];
GetPlayerName(playerid,pName,sizeof(pName);
if(!strcmp(pName,"NameHere")) return MoveObject(.....);
Reply
#4

if I give you my pwn script could you maybe help me enter it in?
Reply
#5

pawn Код:
forward GateOpen();
public GateOpen()
{
    for(new i = 0; i < MAX_PLAYERS; i++) //Begin looping through players
    {
        if(IsPlayerConnected(i))
        {
            if(IsPlayerInRangeOfPoint(i, 5.0, ...) //If they are near the gate.
            {
                new name[MAX_PLAYER_NAME];
                GetPlayerName(i, name, MAX_PLAYER_NAME);
                if(strcmp(name, "Mark_Hilt", false) == 0)
                {
                    MoveObject(gate, .... //Open gate
                }
            }
        }
    }
    return 1;
}
NOTE: Rushed
Reply
#6

If you want me to, Of course.
Reply
#7

there are a few gates in this script all these gates are set to run as rcon admin and I don't want that
Код:
/*******************************************************************************
*                     Admin Secret and Protected Island                        *
*                               By Mark_Hilt                                   *
*******************************************************************************/

#include <a_samp>
#include <dini>

//------------------------------CONFIGURATION---------------------------------//
new DEFENCE_MODE=1;                      /*  Put "0" if no defence.
                                             Put "1" for Auto Kill In Area.
                                             Put "2" for Straight Missles on enemy.
                                             Put "3" for an automatic missle from SAM SITE.*/
new V_WORLD_OBJECTS=0;                   // the map will appear only to players in this Virtual World!
#define MAX_STREAM_OBJECTS 200           // Max Streamed Objects
#define MAX_SERVER_PLAYERS 100           // Max Players In Server. Put the same of "maxplayers" in server.cfg
#define STRAIGHT_MISSLES_SPEED 120
#define ADVANCED_MISSLES_SPEED 120
#define RestrictedAreaWarning "You can't go over there!!!"
#define InIslandMessage1 "YOU'RE IN MARK_HILT'S PRIVATE ISLAND!"
#define InIslandMessage2 "Killed! Private HOME Zone!"
#define InIslandMessage3 "MARK_HILT'S Private Island! Go Away!"
#define InIslandMessage4 "You entered in MARK_HILT'S Island! Die!"
//#define SHOW_WHAT_HAPPENS              //do not use this!
//----------------------------------------------------------------------------//
#define dcmd(%1,%2,%3) if((strcmp((%3)[1],#%1,true,(%2))==0)&&((((%3)[(%2)+1]==0)&&(dcmd_%1(playerid,"")))||(((%3)[(%2)+1]==32)&&(dcmd_%1(playerid,(%3)[(%2)+2]))))) return 1

new Float:MissleAng;
new Followed;
new Missle[10];
new AdvMissle;
new AdvMissleTimer;
new StopMissleTimer;
new MissleVar;
new Float:MissleX[10],Float:MissleY[10],Float:MissleZ[10];

new SamTimer[MAX_SERVER_PLAYERS];
new TimerMissles;
new TimerMissles2;
new bool:GatesOpened;
new bool:Spawned[MAX_SERVER_PLAYERS];
new bool:Timer1Active[MAX_SERVER_PLAYERS];
new bool:Timer2Active[MAX_SERVER_PLAYERS];
new Timer1[MAX_SERVER_PLAYERS];
new Timer2[MAX_SERVER_PLAYERS];
new Gate1,Gate2,Gate3,Sbarra1,Sbarra2;
new veh[24];
new Sam;

new SamAiming;
new bool:IsSamAiming;
new bool:IsSamTimerAimingOn[MAX_SERVER_PLAYERS];

enum object_enum{
  Smodelid,Float:Sx,Float:Sy,Float:Sz,Float:Srx,Float:Sry,Float:Srz,Float:Sviewdist,Sid}
enum player_enum{
  pobjects[MAX_STREAM_OBJECTS],
  bool:seen[MAX_STREAM_OBJECTS],}
new Objects[MAX_STREAM_OBJECTS][object_enum];
new PlayerObjects[MAX_SERVER_PLAYERS][player_enum];

Float:GetDistance(Float:x1,Float:y1,Float:z1,Float:xx,Float:yy,Float:zz){
  return Float:floatsqroot(floatpower(floatabs(floatsub(xx,x1)),2)+floatpower(floatabs(floatsub(yy,y1)),2)+floatpower(floatabs(floatsub(zz,z1)),2));}

#pragma unused ret_memcpy
forward UpdateObjects();
forward StreamObjectsForPlayer(b);
forward Core_CreateStreamObject(Smodelid2,Float:Sx2,Float:Sy2,Float:Sz2,Float:Srx2,Float:Sry2,Float:Srz2,Sviewdist2);
forward OpeningBarrier1(i);
forward OpeningBarrier2(i);
forward ClosingBarrier1(i);
forward ClosingBarrier2(i);
forward CheckPosFromBarriers();
forward CloseBar1(i);
forward CloseBar2(i);
forward ReActiveVar1(i);
forward ReActiveVar2(i);
forward CloseGatesTM();
forward CheckMisslesPos(playerid);
forward CheckAdvancedMisslePos(playerid);

public OnFilterScriptInit(){
if(DEFENCE_MODE<0 && DEFENCE_MODE>3)DEFENCE_MODE=1;
SetTimer("UpdateObjects",500,1);
SetTimer("CheckPosFromBarriers",2000,1);

for(new i=0;i<MAX_SERVER_PLAYERS;i++){
  Timer1Active[i]=false;
  Timer1Active[i]=false;
  if(IsPlayerConnected(i))Spawned[i]=true;}

MissleVar=0;
IsSamAiming=false;
SamAiming=MAX_SERVER_PLAYERS+1;
Followed=MAX_SERVER_PLAYERS+1;

print("\n*************************");
print("  Advanced Admin Island    ");
print("      By [ZFM]Zuc          ");
print("*************************\n");

veh[0]=CreateVehicle(482,2865.26147461,-2053.75903320,11.35183620,0.00000000,-1,6,15); //Burrito
veh[1]=CreateVehicle(476,3996.72875977,-1762.20812988,35.44984436,223.21722412,-1,6,15); //Rustler
veh[2]=CreateVehicle(520,4012.91674805,-1760.69628906,35.19926834,135.94897461,-1,-1,15); //Hydra
veh[3]=CreateVehicle(409,3970.65258789,-1711.47851562,34.71979904,180.00000000,-1,2,15); //Stretch
veh[4]=CreateVehicle(409,3976.80346680,-1697.18457031,34.71979904,180.00000000,-1,2,15); //Stretch
veh[5]=CreateVehicle(409,3944.15991211,-1724.56103516,34.71979904,84.23706055,-1,2,15); //Stretch
veh[6]=CreateVehicle(430,3913.01220703,-1622.87426758,0.64387751,90.00000000,2,-1,15); //Predator
veh[7]=CreateVehicle(430,3892.15283203,-1622.87402344,0.64387751,90.00000000,2,-1,15); //Predator
veh[8]=CreateVehicle(430,3892.15234375,-1622.87402344,0.64387751,90.00000000,2,-1,15); //Predator
veh[9]=CreateVehicle(409,3918.91918945,-1711.47851562,34.71979904,180.00000000,-1,2,15); //Stretch
veh[10]=CreateVehicle(535,3897.09838867,-1770.96630859,34.11969376,0.00000000,3,6,15); //Slamvan
veh[11]=CreateVehicle(535,3893.36669922,-1770.96582031,34.11969376,0.00000000,-1,2,15); //Slamvan
veh[12]=CreateVehicle(534,3900.14697266,-1763.75756836,34.10256958,90.00000000,79,93,15); //Remington
veh[13]=CreateVehicle(534,3900.14648438,-1760.15087891,34.10256958,90.00000000,-1,16,15); //Remington
veh[14]=CreateVehicle(575,3899.71069336,-1752.66821289,34.01969528,90.00000000,93,1,15); //Broadway
veh[15]=CreateVehicle(575,3899.70996094,-1749.06201172,34.01969528,90.00000000,3,1,15); //Broadway
veh[16]=CreateVehicle(425,3839.71972656,-1656.85302734,58.37832642,90.00000000,-1,-1,15); //Hunter
veh[17]=CreateVehicle(411,3899.97900391,-1739.46215820,34.07969284,90.00000000,-1,1,15); //Infernus
veh[18]=CreateVehicle(411,3899.97851562,-1735.72717285,34.07969284,90.00000000,-1,1,15); //Infernus
veh[19]=CreateVehicle(411,3899.97851562,-1731.99182129,34.07969284,90.00000000,-1,1,15); //Infernus
veh[20]=CreateVehicle(411,3899.97851562,-1728.12768555,34.07969284,90.00000000,-1,1,15); //Infernus
veh[21]=CreateVehicle(451,3899.92260742,-1720.84936523,34.04406738,90.00000000,43,3,15); //Turismo
veh[22]=CreateVehicle(451,3899.92187500,-1716.98510742,34.04406738,90.00000000,1,3,15); //Turismo
veh[23]=CreateVehicle(451,3899.92187500,-1712.99206543,34.04406738,90.00000000,2,16,15); //Turismo

CreateStreamObject(621,3871.17285156,-1861.80175781,38.51463318,0.00000000,0.00000000,0.00000000,250); //object(veg_palm02) (4)
CreateStreamObject(9551,3847.71191406,-1768.90820312,28.63344955,0.00000000,0.00000000,357.11608887,250); //object(sandbch_sfw04) (1)
CreateStreamObject(9551,3946.56982422,-1863.50219727,28.63344955,0.00000000,0.00000000,88.73776245,250); //object(sandbch_sfw04) (2)
CreateStreamObject(9551,4043.92895508,-1763.24108887,28.63344955,0.00000000,0.00000000,176.68878174,250); //object(sandbch_sfw04) (3)
CreateStreamObject(9551,3946.95532227,-1667.33300781,28.63344955,0.00000000,0.00000000,267.72842407,250); //object(sandbch_sfw04) (4)
CreateStreamObject(11486,3827.40039062,-1860.98986816,22.32763100,0.00000000,0.00000000,90.02655029,250); //object(dam_turbine_2) (1)
CreateStreamObject(11486,3850.86450195,-1885.37841797,22.32763100,0.00000000,0.00000000,177.54748535,250); //object(dam_turbine_2) (2)
CreateStreamObject(11486,3830.87426758,-1873.86767578,22.32763100,0.00000000,0.00000000,120.25769043,250); //object(dam_turbine_2) (3)
CreateStreamObject(11486,3839.49438477,-1882.36694336,22.32763100,0.00000000,0.00000000,149.05224609,250); //object(dam_turbine_2) (4)
CreateStreamObject(11486,4038.31372070,-1882.05102539,21.76699638,0.00000000,0.00000000,178.38116455,250); //object(dam_turbine_2) (5)
CreateStreamObject(11486,4061.05004883,-1857.17248535,21.76699638,0.00000000,0.00000000,267.95086670,250); //object(dam_turbine_2) (6)
CreateStreamObject(11486,4058.09057617,-1867.98974609,21.76699638,0.00000000,0.00000000,242.02922058,250); //object(dam_turbine_2) (7)
CreateStreamObject(11486,4049.85571289,-1877.51928711,21.76699638,0.00000000,0.00000000,209.89501953,250); //object(dam_turbine_2) (8)
CreateStreamObject(11486,4068.15478516,-1671.73913574,22.32796097,0.00000000,0.00000000,267.94555664,250); //object(dam_turbine_2) (9)
CreateStreamObject(11486,4042.04052734,-1648.37939453,22.32796097,0.00000000,0.00000000,358.35070801,250); //object(dam_turbine_2) (10)
CreateStreamObject(11486,4054.64892578,-1652.24243164,22.32796097,0.00000000,0.00000000,328.11083984,250); //object(dam_turbine_2) (11)
CreateStreamObject(11486,4063.65478516,-1660.35559082,22.32796097,0.00000000,0.00000000,297.87097168,250); //object(dam_turbine_2) (12)
CreateStreamObject(11486,3853.35644531,-1645.37207031,22.07263756,0.00000000,0.00000000,356.90673828,250); //object(dam_turbine_2) (13)
CreateStreamObject(11486,3830.33447266,-1672.00134277,22.07263756,0.00000000,0.00000000,89.58044434,250); //object(dam_turbine_2) (14)
CreateStreamObject(11486,3833.70727539,-1659.94836426,22.07263756,0.00000000,0.00000000,57.90148926,250); //object(dam_turbine_2) (15)
CreateStreamObject(11486,3842.86987305,-1651.55175781,22.07263756,0.00000000,0.00000000,27.66223145,250); //object(dam_turbine_2) (16)
CreateStreamObject(991,3854.67675781,-1662.31152344,38.07794952,0.00000000,0.00000000,267.85302734,250); //object(bar_barriergate1) (1)
CreateStreamObject(991,3854.93408203,-1655.74353027,38.07794952,0.00000000,0.00000000,267.85217285,250); //object(bar_barriergate1) (2)
CreateStreamObject(991,3854.93359375,-1655.74316406,35.75997162,0.00000000,0.00000000,267.85217285,250); //object(bar_barriergate1) (3)
CreateStreamObject(991,3854.93359375,-1655.74316406,33.31321716,0.00000000,0.00000000,267.84667969,250); //object(bar_barriergate1) (4)
CreateStreamObject(991,3854.67675781,-1662.31152344,35.75997162,0.00000000,0.00000000,267.85217285,250); //object(bar_barriergate1) (5)
CreateStreamObject(991,3843.34570312,-1674.41638184,38.06244278,0.00000000,0.00000000,359.99914551,250); //object(bar_barriergate1) (6)
CreateStreamObject(991,3843.34570312,-1674.41601562,35.74446487,0.00000000,0.00000000,359.99450684,250); //object(bar_barriergate1) (7)
CreateStreamObject(991,3840.00048828,-1674.41601562,38.06244278,0.00000000,0.00000000,359.99450684,250); //object(bar_barriergate1) (8)
CreateStreamObject(991,3840.00000000,-1674.41601562,35.74446487,0.00000000,0.00000000,359.99450684,250); //object(bar_barriergate1) (9)
CreateStreamObject(991,3841.33691406,-1669.76330566,40.04542542,270.00000000,180.00000000,165.60192871,250); //object(bar_barriergate1) (10)
CreateStreamObject(991,3841.72290039,-1668.47485352,40.04542542,270.00000000,180.00149536,156.96514893,250); //object(bar_barriergate1) (11)
CreateStreamObject(991,3845.32519531,-1663.37524414,40.04542542,270.00000000,180.00000000,146.88345337,250); //object(bar_barriergate1) (12)
CreateStreamObject(991,3845.32519531,-1663.37500000,40.04542542,270.00000000,179.99853516,120.96929932,250); //object(bar_barriergate1) (13)
CreateStreamObject(991,3849.98510742,-1659.38269043,40.04542542,270.00000000,179.99853516,106.57104492,250); //object(bar_barriergate1) (14)
CreateStreamObject(991,3843.74926758,-1858.75854492,38.26887131,0.00000000,0.00000000,359.99450684,250); //object(bar_barriergate1) (15)
CreateStreamObject(991,3837.18725586,-1858.75781250,38.26887131,0.00000000,0.00000000,359.99450684,250); //object(bar_barriergate1) (16)
CreateStreamObject(991,3837.18652344,-1858.75781250,35.95089340,0.00000000,0.00000000,359.99450684,250); //object(bar_barriergate1) (17)
CreateStreamObject(991,3843.74902344,-1858.75781250,35.95089340,0.00000000,0.00000000,359.99450684,250); //object(bar_barriergate1) (18)
CreateStreamObject(991,3837.18652344,-1858.75781250,33.50413895,0.00000000,0.00000000,359.99450684,250); //object(bar_barriergate1) (19)
CreateStreamObject(991,3853.64111328,-1870.57849121,38.00809479,0.00000000,0.00000000,87.82208252,250); //object(bar_barriergate1) (20)
CreateStreamObject(991,3853.38330078,-1877.14611816,38.00809479,0.00000000,0.00000000,87.81921387,250); //object(bar_barriergate1) (21)
CreateStreamObject(991,3853.38281250,-1877.14550781,35.56134033,0.00000000,0.00000000,87.81921387,250); //object(bar_barriergate1) (22)
CreateStreamObject(991,3853.38281250,-1877.14550781,33.24336243,0.00000000,0.00000000,87.81921387,250); //object(bar_barriergate1) (23)
CreateStreamObject(991,3853.64062500,-1870.57812500,35.56134033,0.00000000,0.00000000,87.81921387,250); //object(bar_barriergate1) (24)
CreateStreamObject(991,3841.79370117,-1872.41674805,40.34148407,270.00000000,180.00000000,214.55477905,250); //object(bar_barriergate1) (25)
CreateStreamObject(991,3840.63500977,-1870.74182129,40.34148407,270.00000000,179.99450684,214.55200195,250); //object(bar_barriergate1) (26)
CreateStreamObject(991,3843.72265625,-1869.83972168,40.34148407,270.00000000,179.99450684,214.55200195,250); //object(bar_barriergate1) (27)
CreateStreamObject(991,3841.02075195,-1863.91479492,40.34148407,270.00000000,180.00149536,197.28138733,250); //object(bar_barriergate1) (28)
CreateStreamObject(991,3837.41796875,-1866.48974609,40.34148407,270.00000000,180.00000000,197.27600098,250); //object(bar_barriergate1) (29)
CreateStreamObject(991,3836.77465820,-1864.29992676,40.34148407,270.00000000,180.00000000,197.27600098,250); //object(bar_barriergate1) (30)
CreateStreamObject(991,3848.61181641,-1874.34631348,40.34148407,270.00000000,179.99853516,267.82846069,250); //object(bar_barriergate1) (31)
CreateStreamObject(991,3846.68139648,-1874.34570312,40.34148407,270.00000000,179.99450684,267.82470703,250); //object(bar_barriergate1) (32)
CreateStreamObject(5002,3946.92871094,-1735.95214844,33.27969360,0.00000000,0.00000000,0.00000000,250); //object(lasrnway4_las) (4)
CreateStreamObject(5002,3946.92871094,-1796.16503906,33.25513840,0.00000000,0.00000000,180.00000000,250); //object(lasrnway4_las) (5)
CreateStreamObject(7586,4007.67773438,-1708.21301270,39.69871521,0.00000000,0.00000000,0.00000000,250); //object(miragebuild07) (1)
CreateStreamObject(9900,3881.54687500,-1763.65917969,-15.61547852,0.00000000,0.00000000,0.00000000,250); //object(landshit_09_sfe) (1)
CreateStreamObject(16770,3991.16357422,-1818.84240723,34.84569550,0.00000000,0.00000000,0.00000000,250); //object(des_gunbldg01) (2)
CreateStreamObject(7191,4016.31030273,-1826.46911621,35.23437119,0.00000000,0.00000000,270.20098877,250); //object(vegasnnewfence2b) (1)
CreateStreamObject(7191,4016.30957031,-1808.44018555,35.23437119,0.00000000,0.00000000,270.19775391,250); //object(vegasnnewfence2b) (2)
CreateStreamObject(7191,4018.28222656,-1810.39990234,35.87369919,0.00000000,270.00000000,90.00000000,250); //object(vegasnnewfence2b) (3)
CreateStreamObject(7191,4018.28222656,-1814.13415527,35.87369919,0.00000000,270.00000000,90.00000000,250); //object(vegasnnewfence2b) (4)
CreateStreamObject(7191,4018.28222656,-1817.86853027,35.87369919,0.00000000,270.00000000,90.00000000,250); //object(vegasnnewfence2b) (5)
CreateStreamObject(7191,4018.28222656,-1821.47412109,35.87369919,0.00000000,270.00000000,90.00000000,250); //object(vegasnnewfence2b) (6)
CreateStreamObject(7191,4018.28222656,-1824.56445312,35.87369919,0.00000000,270.00000000,90.00000000,250); //object(vegasnnewfence2b) (7)
CreateStreamObject(3277,3881.58618164,-1763.70312500,118.82678223,0.00000000,0.00000000,0.00000000,250); //object(mil_sambase) (1)
CreateStreamObject(3279,3852.70605469,-1853.75146484,41.15748978,0.00000000,0.00000000,90.00000000,250); //object(a51_spottower) (22)
CreateStreamObject(3268,4004.47021484,-1764.20837402,33.25513840,0.00000000,0.00000000,90.00000000,250); //object(mil_hangar1_) (1)
CreateStreamObject(3277,3881.60253906,-1763.70312500,117.28146362,0.00000000,179.99450684,90.00000000,250); //object(mil_sambase) (2)
CreateStreamObject(3753,3889.54199219,-1635.04064941,2.50886154,0.00000000,0.00000000,0.00000000,250); //object(dockwall_las2) (1)
CreateStreamObject(18450,3695.59619141,-1767.00097656,3.21938801,0.00000000,5.75918579,0.00000000,250); //object(cs_roadbridge04) (2)
CreateStreamObject(18450,3615.89965820,-1767.00097656,7.21143150,0.00000000,0.00000000,0.00000000,250); //object(cs_roadbridge04) (3)
CreateStreamObject(18450,3537.02319336,-1767.00097656,7.21143150,0.00000000,0.00000000,0.00000000,250); //object(cs_roadbridge04) (4)
CreateStreamObject(18450,3457.57934570,-1767.00097656,7.21143150,0.00000000,0.00000000,0.00000000,250); //object(cs_roadbridge04) (5)
CreateStreamObject(18450,3379.39843750,-1771.89477539,7.21143150,0.00000000,0.00000000,7.19897461,250); //object(cs_roadbridge04) (6)
CreateStreamObject(18450,3303.38476562,-1787.42480469,7.21143150,0.00000000,0.00000000,15.83483887,250); //object(cs_roadbridge04) (9)
CreateStreamObject(18450,3231.61694336,-1815.88366699,7.21143150,0.00000000,0.00000000,27.34967041,250); //object(cs_roadbridge04) (10)
CreateStreamObject(18450,3167.32250977,-1858.91845703,7.21143150,0.00000000,0.00000000,40.30313110,250); //object(cs_roadbridge04) (11)
CreateStreamObject(18450,3104.74951172,-1903.23962402,7.21143150,0.00000000,0.00000000,30.21926880,250); //object(cs_roadbridge04) (12)
CreateStreamObject(18450,3034.48461914,-1936.23034668,7.21143150,0.00000000,0.00000000,20.13931274,250); //object(cs_roadbridge04) (13)
CreateStreamObject(18450,2882.38061523,-1963.26831055,3.29826546,0.00000000,354.24084473,0.00000000,250); //object(cs_roadbridge04) (15)
CreateStreamObject(18450,2959.96240234,-1956.42077637,7.21143150,0.00000000,0.00000000,10.05935669,250); //object(cs_roadbridge04) (16)
CreateStreamObject(3502,2947.05517578,-1950.70422363,11.87500668,90.00000000,0.00000000,0.00000000,250); //object(vgsn_con_tube) (10)
CreateStreamObject(3502,2949.75659180,-1966.10559082,11.87500668,90.00000000,0.00000000,0.00000000,250); //object(vgsn_con_tube) (11)
CreateStreamObject(3502,2947.05468750,-1950.70410156,3.11826611,90.00000000,0.00000000,0.00000000,250); //object(vgsn_con_tube) (12)
CreateStreamObject(3502,2947.05468750,-1950.70410156,-5.50969505,90.00000000,0.00000000,0.00000000,250); //object(vgsn_con_tube) (13)
CreateStreamObject(3502,2947.05468750,-1950.70410156,-13.88010883,90.00000000,0.00000000,0.00000000,250); //object(vgsn_con_tube) (14)
CreateStreamObject(3502,2949.75585938,-1966.10546875,3.01541042,90.00000000,0.00000000,0.00000000,250); //object(vgsn_con_tube) (15)
CreateStreamObject(3502,2949.75585938,-1966.10546875,-5.35499954,90.00000000,0.00000000,0.00000000,250); //object(vgsn_con_tube) (16)
CreateStreamObject(3502,2949.75585938,-1966.10546875,-13.98296452,90.00000000,0.00000000,0.00000000,250); //object(vgsn_con_tube) (17)
CreateStreamObject(3502,2947.56933594,-1954.05249023,16.12460136,0.00000000,270.00000000,189.90411377,250); //object(vgsn_con_tube) (18)
CreateStreamObject(3502,2949.11279297,-1962.62768555,16.12460136,0.00000000,0.00000000,10.75585938,250); //object(vgsn_con_tube) (19)
CreateStreamObject(10827,3769.18750000,-1800.93054199,-8.27598381,0.00000000,0.00000000,90.00000000,250); //object(subbunker_ext_sfse) (1)
CreateStreamObject(3115,3780.71484375,-1773.98889160,4.12066555,14.39794922,0.00000000,180.00000000,250); //object(carrier_lift1_sfse) (1)
CreateStreamObject(3115,3780.71484375,-1791.99084473,8.75658703,14.39758301,0.00000000,179.99450684,250); //object(carrier_lift1_sfse) (4)
CreateStreamObject(3115,3780.71484375,-1802.39453125,11.43495464,14.39758301,0.00000000,179.99450684,250); //object(carrier_lift1_sfse) (5)
CreateStreamObject(3115,3778.14160156,-1820.73144531,13.88169098,0.00000000,0.00000000,179.99450684,250); //object(carrier_lift1_sfse) (6)
CreateStreamObject(1696,3788.66699219,-1814.51660156,14.32848167,0.00000000,0.00000000,90.00000000,250); //object(roofstuff15) (12)
CreateStreamObject(1696,3779.78515625,-1814.07824707,14.32848167,0.00000000,0.00000000,270.00000000,250); //object(roofstuff15) (13)
CreateStreamObject(1696,3779.78515625,-1819.28100586,14.32848167,0.00000000,0.00000000,270.00000000,250); //object(roofstuff15) (14)
CreateStreamObject(1696,3788.66699219,-1819.79736328,14.32848167,0.00000000,0.00000000,90.00000000,250); //object(roofstuff15) (15)
CreateStreamObject(18450,3816.90771484,-1792.31494141,23.77351189,0.00000000,15.83541870,89.76940918,250); //object(cs_roadbridge04) (17)
CreateStreamObject(3115,3816.56469727,-1841.15087891,34.75650024,0.00000000,0.00000000,90.00000000,250); //object(carrier_lift1_sfse) (7)
CreateStreamObject(3115,3833.86914062,-1841.15039062,38.10469055,336.96325684,0.00000000,90.00000000,250); //object(carrier_lift1_sfse) (9)
CreateStreamObject(3115,3851.78906250,-1841.15039062,41.73592377,0.00000000,0.00000000,90.00000000,250); //object(carrier_lift1_sfse) (10)
CreateStreamObject(18450,3900.49633789,-1838.82458496,35.69455338,0.00000000,8.63232422,0.00000000,250); //object(cs_roadbridge04) (18)
CreateStreamObject(9623,3714.38989258,-1767.72021484,6.02111053,0.00000000,0.00000000,270.00000000,250); //object(toll_sfw) (1)
CreateStreamObject(8168,3712.42480469,-1783.09545898,6.22225571,0.00000000,0.00000000,107.27447510,250); //object(vgs_guardhouse01) (1)
CreateStreamObject(8168,3712.42480469,-1751.82922363,6.22225571,0.00000000,0.00000000,107.27050781,250); //object(vgs_guardhouse01) (2)
CreateStreamObject(983,3715.05468750,-1777.87255859,5.58446217,90.00000000,0.00000000,0.00000000,250); //object(fenceshit3) (1)
CreateStreamObject(983,3715.05468750,-1779.15991211,5.58446217,90.00000000,0.00000000,0.00000000,250); //object(fenceshit3) (2)
CreateStreamObject(983,3715.05468750,-1757.47448730,5.58446217,90.00000000,0.00000000,0.00000000,250); //object(fenceshit3) (3)
CreateStreamObject(983,3715.05468750,-1756.18591309,5.58446217,90.00000000,0.00000000,0.00000000,250); //object(fenceshit3) (4)
CreateStreamObject(966,3720.06225586,-1768.52075195,3.22682381,0.00000000,0.00000000,90.00000000,250); //object(bar_gatebar01) (1)
CreateStreamObject(966,3720.06152344,-1766.33117676,3.22682381,0.00000000,0.00000000,270.00000000,250); //object(bar_gatebar01) (2)
CreateStreamObject(4028,3941.03613281,-1694.67089844,46.48441696,0.00000000,0.00000000,179.99450684,250); //object(lanstap) (1)
CreateStreamObject(3279,3852.70605469,-1828.33154297,41.15748978,0.00000000,0.00000000,270.00000000,250); //object(a51_spottower) (22)
CreateStreamObject(3279,3789.98193359,-1740.15600586,14.38026619,0.00000000,0.00000000,0.00000000,250); //object(a51_spottower) (22)
CreateStreamObject(3279,3789.98144531,-1781.38793945,14.38026619,0.00000000,0.00000000,0.00000000,250); //object(a51_spottower) (22)
CreateStreamObject(3279,3789.98144531,-1824.78210449,14.38026619,0.00000000,0.00000000,0.00000000,250); //object(a51_spottower) (22)
CreateStreamObject(4726,3840.38671875,-1659.68701172,54.41355896,0.00000000,0.00000000,0.00000000,250); //object(libtwrhelipd_lan2) (1)
CreateStreamObject(5428,3943.34179688,-1746.12573242,33.80611801,0.00000000,0.00000000,90.00000000,250); //object(laejeffers10) (1)
CreateStreamObject(9958,4055.54687500,-1634.82397461,3.99204159,0.00000000,0.00000000,270.00000000,250); //object(submarr_sfe) (1)
CreateStreamObject(992,3871.28588867,-1811.46850586,34.81071854,0.00000000,0.00000000,0.00000000,250); //object(bar_barrier10b) (1)
CreateStreamObject(992,3874.63037109,-1811.46777344,34.81071854,0.00000000,0.00000000,0.00000000,250); //object(bar_barrier10b) (2)
CreateStreamObject(992,3877.97509766,-1811.46777344,34.81071854,0.00000000,0.00000000,0.00000000,250); //object(bar_barrier10b) (3)
CreateStreamObject(992,3881.19116211,-1811.46777344,34.81071854,0.00000000,0.00000000,0.00000000,250); //object(bar_barrier10b) (4)
CreateStreamObject(992,3867.97875977,-1811.46777344,34.81071854,0.00000000,0.00000000,0.00000000,250); //object(bar_barrier10b) (5)
CreateStreamObject(992,3866.69189453,-1812.88439941,34.81071854,0.00000000,0.00000000,90.00000000,250); //object(bar_barrier10b) (6)
CreateStreamObject(992,3882.74047852,-1815.33129883,34.81071854,0.00000000,0.00000000,270.00000000,250); //object(bar_barrier10b) (9)
CreateStreamObject(992,3882.74023438,-1818.67944336,34.81071854,0.00000000,0.00000000,270.00000000,250); //object(bar_barrier10b) (10)
CreateStreamObject(992,3882.74023438,-1822.02709961,34.81071854,0.00000000,0.00000000,270.00000000,250); //object(bar_barrier10b) (11)
CreateStreamObject(992,3882.74023438,-1825.37475586,34.81071854,0.00000000,0.00000000,270.00000000,250); //object(bar_barrier10b) (12)
CreateStreamObject(992,3882.74023438,-1828.72241211,34.81071854,0.00000000,0.00000000,270.00000000,250); //object(bar_barrier10b) (13)
CreateStreamObject(992,3881.32495117,-1830.13830566,34.81071854,0.00000000,0.00000000,180.00000000,250); //object(bar_barrier10b) (14)
CreateStreamObject(992,3877.97900391,-1830.13769531,34.81071854,0.00000000,0.00000000,179.99450684,250); //object(bar_barrier10b) (15)
CreateStreamObject(992,3874.63330078,-1830.13769531,34.81071854,0.00000000,0.00000000,179.99450684,250); //object(bar_barrier10b) (16)
CreateStreamObject(992,3871.28759766,-1830.13769531,34.81071854,0.00000000,0.00000000,179.99450684,250); //object(bar_barrier10b) (17)
CreateStreamObject(992,3867.94189453,-1830.13769531,34.81071854,0.00000000,0.00000000,179.99450684,250); //object(bar_barrier10b) (18)
CreateStreamObject(992,3866.52612305,-1828.72106934,34.81071854,0.00000000,0.00000000,90.00000000,250); //object(bar_barrier10b) (19)
CreateStreamObject(992,3866.69140625,-1816.23217773,34.81071854,0.00000000,0.00000000,90.00000000,250); //object(bar_barrier10b) (20)
CreateStreamObject(992,3866.69140625,-1819.45104980,34.81071854,0.00000000,0.00000000,90.00000000,250); //object(bar_barrier10b) (21)
CreateStreamObject(992,3866.69140625,-1822.79858398,34.81071854,0.00000000,0.00000000,90.00000000,250); //object(bar_barrier10b) (22)
CreateStreamObject(992,3869.87280273,-1826.78930664,34.81071854,0.00000000,0.00000000,179.99450684,250); //object(bar_barrier10b) (23)
CreateStreamObject(992,3873.21728516,-1826.78906250,34.81071854,0.00000000,0.00000000,179.99450684,250); //object(bar_barrier10b) (24)
CreateStreamObject(992,3878.74926758,-1826.78906250,34.81071854,0.00000000,0.00000000,179.99450684,250); //object(bar_barrier10b) (25)
CreateStreamObject(992,3878.74902344,-1824.08459473,34.81071854,0.00000000,0.00000000,179.99450684,250); //object(bar_barrier10b) (26)
CreateStreamObject(992,3875.05444336,-1825.50231934,34.81071854,0.00000000,0.00000000,90.00000000,250); //object(bar_barrier10b) (27)
CreateStreamObject(992,3875.05371094,-1822.15356445,34.81071854,0.00000000,0.00000000,90.00000000,250); //object(bar_barrier10b) (28)
CreateStreamObject(992,3872.48046875,-1822.15332031,34.81071854,0.00000000,0.00000000,90.00000000,250); //object(bar_barrier10b) (29)
CreateStreamObject(992,3872.48046875,-1818.80493164,34.81071854,0.00000000,0.00000000,90.00000000,250); //object(bar_barrier10b) (30)
CreateStreamObject(992,3877.36962891,-1818.80468750,34.81071854,0.00000000,0.00000000,90.00000000,250); //object(bar_barrier10b) (31)
CreateStreamObject(992,3879.29907227,-1818.80468750,34.81071854,0.00000000,0.00000000,90.00000000,250); //object(bar_barrier10b) (32)
CreateStreamObject(992,3879.29882812,-1815.45629883,34.81071854,0.00000000,0.00000000,90.00000000,250); //object(bar_barrier10b) (33)
CreateStreamObject(992,3875.05297852,-1815.45605469,34.81071854,0.00000000,0.00000000,90.00000000,250); //object(bar_barrier10b) (34)
CreateStreamObject(992,3873.08789062,-1816.87268066,34.81071854,0.00000000,0.00000000,179.99450684,250); //object(bar_barrier10b) (35)
CreateStreamObject(992,3869.87133789,-1816.87207031,34.81071854,0.00000000,0.00000000,179.99450684,250); //object(bar_barrier10b) (36)
CreateStreamObject(992,3877.46215820,-1815.19787598,34.81071854,0.00000000,0.00000000,179.99450684,250); //object(bar_barrier10b) (37)
CreateStreamObject(992,3876.43261719,-1813.52307129,34.81071854,0.00000000,0.00000000,179.99450684,250); //object(bar_barrier10b) (38)
CreateStreamObject(992,3875.91796875,-1820.34802246,34.81071854,0.00000000,0.00000000,179.99450684,250); //object(bar_barrier10b) (39)
CreateStreamObject(992,3871.02880859,-1814.93872070,34.81071854,0.00000000,0.00000000,179.99450684,250); //object(bar_barrier10b) (40)
CreateStreamObject(992,3871.02832031,-1813.26428223,34.81071854,0.00000000,0.00000000,179.99450684,250); //object(bar_barrier10b) (41)
CreateStreamObject(992,3870.03588867,-1822.15332031,34.81071854,0.00000000,0.00000000,90.00000000,250); //object(bar_barrier10b) (42)
CreateStreamObject(992,3869.90649414,-1816.87316895,34.81071854,0.00000000,0.00000000,90.00000000,250); //object(bar_barrier10b) (43)
CreateStreamObject(992,3868.49096680,-1818.80480957,34.81071854,0.00000000,0.00000000,90.00000000,250); //object(bar_barrier10b) (44)
CreateStreamObject(992,3868.49023438,-1822.15307617,34.81071854,0.00000000,0.00000000,90.00000000,250); //object(bar_barrier10b) (45)
CreateStreamObject(992,3870.80615234,-1812.62292480,34.81071854,0.00000000,0.00000000,43.92651367,250); //object(bar_barrier10b) (46)
CreateStreamObject(7191,3903.50634766,-1752.70666504,35.52298355,0.00000000,0.00000000,0.00000000,250); //object(vegasnnewfence2b) (8)
CreateStreamObject(7191,3903.50585938,-1733.77661133,35.52298355,0.00000000,0.00000000,0.00000000,250); //object(vegasnnewfence2b) (10)
CreateStreamObject(7191,3983.30688477,-1752.70605469,35.52298355,0.00000000,0.00000000,0.00000000,250); //object(vegasnnewfence2b) (11)
CreateStreamObject(7191,3983.30664062,-1711.78295898,35.52298355,0.00000000,0.00000000,0.00000000,250); //object(vegasnnewfence2b) (12)
CreateStreamObject(7191,3961.00830078,-1689.94299316,35.52298355,0.00000000,0.00000000,90.00000000,250); //object(vegasnnewfence2b) (13)
CreateStreamObject(7191,3925.63037109,-1689.94238281,35.52298355,0.00000000,0.00000000,90.00000000,250); //object(vegasnnewfence2b) (14)
CreateStreamObject(7191,3903.50585938,-1712.01428223,35.52298355,0.00000000,0.00000000,0.00000000,250); //object(vegasnnewfence2b) (15)
CreateStreamObject(8656,3888.69238281,-1776.13964844,34.41939545,0.00000000,0.00000000,90.00000000,250); //object(shbbyhswall09_lvs) (1)
CreateStreamObject(8656,3888.69238281,-1776.13964844,36.60859680,0.00000000,0.00000000,90.00000000,250); //object(shbbyhswall09_lvs) (2)
CreateStreamObject(8656,3866.75195312,-1761.20019531,34.29061890,0.00000000,0.00000000,357.08862305,250); //object(shbbyhswall09_lvs) (3)
CreateStreamObject(8656,3868.29589844,-1730.75878906,34.29061890,0.00000000,0.00000000,357.08862305,250); //object(shbbyhswall09_lvs) (4)
CreateStreamObject(8656,3868.29589844,-1730.75878906,36.47982025,0.00000000,0.00000000,357.08862305,250); //object(shbbyhswall09_lvs) (5)
CreateStreamObject(8656,3866.75195312,-1761.20019531,36.47982025,0.00000000,0.00000000,357.08862305,250); //object(shbbyhswall09_lvs) (6)
CreateStreamObject(8656,3869.32519531,-1711.31347656,34.29061890,0.00000000,0.00000000,357.08862305,250); //object(shbbyhswall09_lvs) (7)
CreateStreamObject(8656,3869.32519531,-1711.31347656,36.47982025,0.00000000,0.00000000,357.08862305,250); //object(shbbyhswall09_lvs) (8)
CreateStreamObject(8656,3884.77246094,-1693.51660156,34.29061890,0.00000000,0.00000000,281.07971191,250); //object(shbbyhswall09_lvs) (10)
CreateStreamObject(8656,3884.77246094,-1693.51660156,36.47982025,0.00000000,0.00000000,281.07971191,250); //object(shbbyhswall09_lvs) (11)
CreateStreamObject(9482,3924.71972656,-1775.95166016,39.90991974,0.00000000,0.00000000,270.00000000,250); //object(chinagate) (1)
CreateStreamObject(9482,3960.82080078,-1775.95117188,39.90991974,0.00000000,0.00000000,270.00000000,250); //object(chinagate) (2)
CreateStreamObject(3475,3938.81640625,-1775.84997559,35.65586853,0.00000000,0.00000000,90.00000000,250); //object(vgsn_fncelec_pst) (1)
CreateStreamObject(3475,3944.73486328,-1775.84960938,35.65586853,0.00000000,0.00000000,90.00000000,250); //object(vgsn_fncelec_pst) (2)
CreateStreamObject(3475,3947.82226562,-1775.84960938,35.65586853,0.00000000,0.00000000,90.00000000,250); //object(vgsn_fncelec_pst) (3)
CreateStreamObject(3475,3974.67993164,-1775.84960938,35.65586853,0.00000000,0.00000000,90.00000000,250); //object(vgsn_fncelec_pst) (4)
CreateStreamObject(3475,3980.46948242,-1775.84960938,35.65586853,0.00000000,0.00000000,90.00000000,250); //object(vgsn_fncelec_pst) (5)
CreateStreamObject(3475,3911.88623047,-1775.84960938,35.65586853,0.00000000,0.00000000,90.00000000,250); //object(vgsn_fncelec_pst) (6)
CreateStreamObject(3475,3907.25390625,-1775.84960938,35.65586853,0.00000000,0.00000000,90.00000000,250); //object(vgsn_fncelec_pst) (7)
CreateStreamObject(8535,3944.92846680,-1708.42578125,39.85671234,0.00000000,0.00000000,90.00000000,250); //object(tikimotel02_lvs) (1)

CreateObject(5002,3946.92871094,-1735.95251465,33.29969360,0.00000000,0.00000000,0.00000000); //object(lasrnway4_las) (4)
CreateObject(5002,3946.92871094,-1796.16540527,33.27513840,0.00000000,0.00000000,180.40203857); //object(lasrnway4_las) (5)
Sbarra1=CreateObject(968,3720.05737305,-1768.46313477,3.90991402,0.00000000,-90.00000000,90.00000000); //object(barrierturn) (3)
Sbarra2=CreateObject(968,3720.05664062,-1766.27355957,3.90991402,0.00000000,90.00000000,90.00000000); //object(barrierturn) (5)
Gate1=CreateObject(980,2947.15942383,-1953.14440918,8.65449047,0.00000000,270.00000000,280.0); //object(airportgate) (11)
Gate2=CreateObject(980,2948.18798828,-1958.55322266,8.65449047,0.00000000,270.00000000,280.0); //object(airportgate) (14)
Gate3=CreateObject(980,2949.21728516,-1963.96142578,8.65449047,0.00000000,270.00000000,280.0); //object(airportgate) (15)

Sam=CreateObject(3884,3881.56640625,-1763.63476562,118.81739807,0.0,0.0,0.0); // Missle Launcher on Island Tower
return 1;}

public OnFilterScriptExit(){
  for(new i=0;i<MAX_SERVER_PLAYERS;i++)KillTimer(SamTimer[i]);
  for(new i=0;i<10;i++)DestroyObject(Missle[i]);
  for(new i=0;i<24;i++)DestroyVehicle(veh[i]);
  for(new i=0;i<MAX_SERVER_PLAYERS;i++){
	if(IsPlayerConnected(i)){
      for(new p=0;p<MAX_STREAM_OBJECTS;p++){
        if(PlayerObjects[i][seen][p] == true){
          DestroyPlayerObject(i,PlayerObjects[i][pobjects][p]);}}}}
  DestroyObject(Sam);
  DestroyObject(AdvMissle);
  DestroyObject(Gate1);
  DestroyObject(Gate2);
  DestroyObject(Gate3);
  DestroyObject(Sbarra1);
  DestroyObject(Sbarra2);
  return 1;}

public OnPlayerConnect(playerid){
  Timer1Active[playerid]=false;
  Timer1Active[playerid]=false;
  IsSamTimerAimingOn[playerid]=false;
  Spawned[playerid]=false;
  return 1;}

public OnPlayerDisconnect(playerid, reason){
  Spawned[playerid]=false;
  Timer1Active[playerid]=false;
  Timer1Active[playerid]=false;
  IsSamTimerAimingOn[playerid]=false;
  if(playerid==Followed){
	KillTimer(AdvMissleTimer);
	Followed=MAX_SERVER_PLAYERS+1;
	KillTimer(StopMissleTimer);
	KillTimer(TimerMissles2);
	KillTimer(AdvMissleTimer);
	DestroyObject(AdvMissle);
	IsSamAiming=false;}
  if(playerid==SamAiming){
	IsSamAiming=false;
	SamAiming=MAX_SERVER_PLAYERS+1;
	IsSamTimerAimingOn[playerid]=false;}
  return 1;}

public OnPlayerSpawn(playerid){
  Timer1Active[playerid]=false;
  Timer1Active[playerid]=false;
  IsSamTimerAimingOn[playerid]=false;
  Spawned[playerid]=true;
  return 1;}
  
dcmd_base(playerid,params[]){
  #pragma unused params
  if(IsPlayerAdmin(playerid))SetPlayerPos(playerid,2862.26147461,-2053.75903320,12.0);
  return 1;}
  
dcmd_defence(playerid,params[]){
    if(IsPlayerAdmin(playerid)){
	new mode;
    if(!strlen(params)){
	  SendClientMessage(playerid, 0xFFFF00AA, "Z_ADMIN ISLAND: Use /defencemode [0 - 1 - 2 - 3]");
	  return 1;}
	mode = strval(params);
	DEFENCE_MODE=mode;
	if(DEFENCE_MODE<0 && DEFENCE_MODE>3){
      SendClientMessage(playerid,0xF60000AA,"Z_ADMIN ISLAND: INVALID CODE! You must choose one of these codes: '0,1,2,3'");
	  DEFENCE_MODE=1;}
	KillTimer(AdvMissleTimer);
	Followed=MAX_SERVER_PLAYERS+1;
	KillTimer(StopMissleTimer);
	KillTimer(TimerMissles2);
	KillTimer(AdvMissleTimer);
	DestroyObject(AdvMissle);
	IsSamAiming=false;
	SamAiming=MAX_SERVER_PLAYERS+1;
	for(new i=0;i<MAX_SERVER_PLAYERS;i++)IsSamTimerAimingOn[i]=false;
	if(DEFENCE_MODE==0)SendClientMessage(playerid,0x81F628AA,"Z_ADMIN ISLAND: Defence mode set to '0': No Defence (defence disabled)");
	if(DEFENCE_MODE==1)SendClientMessage(playerid,0x81F628AA,"Z_ADMIN ISLAND: Defence mode set to '1': Auto-Kill");
	if(DEFENCE_MODE==2)SendClientMessage(playerid,0x81F628AA,"Z_ADMIN ISLAND: Defence mode set to '2': Straight Missle Throwing");
	if(DEFENCE_MODE==3)SendClientMessage(playerid,0x81F628AA,"Z_ADMIN ISLAND: Defence mode set to '3': Following Missles Throwing (advanced)");}
    return 1;}

public OnPlayerCommandText(playerid, cmdtext[]){
  dcmd(base,4,cmdtext);
  dcmd(defence,7,cmdtext);
  return 0;}

public OnPlayerDeath(playerid, killerid, reason){
  Spawned[playerid]=false;
  if(playerid==Followed){
	KillTimer(AdvMissleTimer);
	Followed=MAX_SERVER_PLAYERS+1;
	KillTimer(StopMissleTimer);
	KillTimer(TimerMissles2);
	KillTimer(AdvMissleTimer);
	DestroyObject(AdvMissle);
	IsSamAiming=false;}
  if(playerid==SamAiming){
	IsSamAiming=false;
	SamAiming=MAX_SERVER_PLAYERS+1;
	IsSamTimerAimingOn[playerid]=false;}
  return 1;}
  
forward StopAdvMissle();
public StopAdvMissle(){
  KillTimer(AdvMissleTimer);
  Followed=MAX_SERVER_PLAYERS+1;}
  
//------------------------------STOCK-Functions-------------------------------//
  
stock CreateStreamObject(modelid,Float:xpos,Float:ypos,Float:zpos,Float:xrot,Float:yrot,Float:zrot,viewdist){
  return CallRemoteFunction("Core_CreateStreamObject","ifffffff",modelid,xpos,ypos,zpos,xrot,yrot,zrot,viewdist);}

stock Float:ZGetDist(Float:a,Float:b,Float:A,Float:B){
  return Float:floatsqroot((A-a)*(A-a)+(b-B)*(b-B));}

stock OpenGates(){
  MoveObject(Gate1,2947.15942383,-1953.14440918,1.65449047,2);
  MoveObject(Gate2,2948.18798828,-1958.55322266,1.65449047,2);
  MoveObject(Gate3,2949.21728516,-1963.96142578,1.65449047,2);}

stock CloseGates(){
  MoveObject(Gate1,2947.15942383,-1953.14440918,8.65449047,2);
  MoveObject(Gate2,2948.18798828,-1958.55322266,8.65449047,2);
  MoveObject(Gate3,2949.21728516,-1963.96142578,8.65449047,2);}

stock AngolaSAM(Float:SamX,Float:SamY,playerid){
  new Float:x,Float:y,Float:z,Float:Dist,Float:AngX,Float:AngY,Float:Ang;
  GetPlayerPos(playerid,x,y,z);
  Dist=ZGetDist(SamX,SamY,x,y);
  if(x>SamX && y>SamY){
    AngX=(((-x+SamX)/Dist*90))*1;
    AngY=(((y-SamY)/Dist*90)-90)*1;}
  if(x<SamX && y>SamY){
    AngX=(((-x+SamX)/Dist*90))*1;
    AngY=(((y-SamY)/Dist*90)-90)*-1;}

  if(x>SamX && y<SamY){
    AngX=(((x-SamX)/Dist*90)-90)*1;
    AngY=(((y-SamY)/Dist*90)-180)*1;}
  if(x<SamX && y<SamY){
    AngX=(((x-SamX)/Dist*90)+270)*1;
    AngY=(((y-SamY)/Dist*90))*-1;}

  Ang=(AngX+AngY)/2;
  SetObjectRot(Sam,0.0,0.0,Ang);
  MissleAng=Ang;}
  
forward AngolaRazzo(playerid);
public AngolaRazzo(playerid){
  new Float:x,Float:y,Float:z,Float:Dist,Float:AngX,Float:AngY,Float:Ang;
  new Float:RazzoX,Float:RazzoY,Float:RazzoZ;
  GetPlayerPos(playerid,x,y,z);
  GetObjectPos(AdvMissle,RazzoX,RazzoY,RazzoZ);
  Dist=ZGetDist(RazzoX,RazzoY,x,y);
  if(x>RazzoX && y>RazzoY){
    AngX=(((-x+RazzoX)/Dist*90))*1;
    AngY=(((y-RazzoY)/Dist*90)-90)*1;}
  if(x<RazzoX && y>RazzoY){
    AngX=(((-x+RazzoX)/Dist*90))*1;
    AngY=(((y-RazzoY)/Dist*90)-90)*-1;}

  if(x>RazzoX && y<RazzoY){
    AngX=(((x-RazzoX)/Dist*90)-90)*1;
    AngY=(((y-RazzoY)/Dist*90)-180)*1;}
  if(x<RazzoX && y<RazzoY){
    AngX=(((x-RazzoX)/Dist*90)+270)*1;
    AngY=(((y-RazzoY)/Dist*90))*-1;}

  Ang=(AngX+AngY)/2;
  SetObjectRot(AdvMissle,0.0,0.0,Ang);
  MoveObject(AdvMissle,x,y,z,ADVANCED_MISSLES_SPEED);}

stock ThrowMissle(playerid){
  new Float:px,Float:py,Float:pz;
  if(MissleVar==10){
    MissleVar=0;
	for(new i=0;i<10;i++)DestroyObject(Missle[i]);}
  Missle[MissleVar]=CreateObject(345,3881.56640625,-1763.63476562,119.81739807,0.0,0.0,MissleAng);
  GetPlayerPos(playerid,px,py,pz);
  MoveObject(Missle[MissleVar],px,py,pz,STRAIGHT_MISSLES_SPEED);
  MissleX[MissleVar]=px;
  MissleY[MissleVar]=py;
  MissleZ[MissleVar]=pz;
  MissleVar++;}
  
stock ThrowAdvancedMissle(playerid){
  new Float:px,Float:py,Float:pz;
  AdvMissle=CreateObject(345,3881.56640625,-1763.63476562,119.81739807,0.0,0.0,MissleAng);
  GetPlayerPos(playerid,px,py,pz);
  MoveObject(AdvMissle,px,py,pz,ADVANCED_MISSLES_SPEED);
  AdvMissleTimer=SetTimerEx("AngolaRazzo",100,1,"d",playerid);
  StopMissleTimer=SetTimer("StopAdvMissle",20000,0);
  Followed=playerid;}
  
//-----------------------------TIMERS-Functions-------------------------------//

public UpdateObjects(){
  for(new b=0;b<MAX_SERVER_PLAYERS;b++){
	if(IsPlayerConnected(b)){
      if(GetPlayerVirtualWorld(b)==V_WORLD_OBJECTS){
        StreamObjectsForPlayer(b);}}}
  return 1;}

public StreamObjectsForPlayer(b){
  for(new x=0;x<MAX_STREAM_OBJECTS;x++){
    if(Objects[x][Smodelid] != 0){
      if(!IsPlayerInRangeOfPoint(b,Objects[x][Sviewdist],Objects[x][Sx],Objects[x][Sy],Objects[x][Sz])){
		if(PlayerObjects[b][seen][x] == true){
          DestroyPlayerObject(b,PlayerObjects[b][pobjects][x]);
		  PlayerObjects[b][seen][x] = false;}}
		else if(PlayerObjects[b][seen][x] != true){
		  PlayerObjects[b][pobjects][x] = CreatePlayerObject(b,Objects[x][Smodelid],Objects[x][Sx],Objects[x][Sy],Objects[x][Sz],Objects[x][Srx],Objects[x][Sry],Objects[x][Srz]);
		  PlayerObjects[b][seen][x] = true;}}}}

public Core_CreateStreamObject(Smodelid2,Float:Sx2,Float:Sy2,Float:Sz2,Float:Srx2,Float:Sry2,Float:Srz2,Sviewdist2){
  new i;
  for (i=0; i<MAX_STREAM_OBJECTS; i++){
    if (Objects[i][Smodelid] == 0){
      Objects[i][Smodelid] = Smodelid2;
      Objects[i][Sx] = Sx2;
	  Objects[i][Sy] = Sy2;
	  Objects[i][Sz] = Sz2;
	  Objects[i][Srx] = Srx2;
      Objects[i][Sry] = Sry2;
	  Objects[i][Srz] = Srz2;
	  Objects[i][Sviewdist] = Sviewdist2;
	  Objects[i][Sid] = i;
	  break;}}
  return i;}

public OpeningBarrier1(i){
  new Float:xrot,Float:yrot,Float:zrot;
  GetObjectRot(Sbarra1,xrot,yrot,zrot);
  if(yrot<=0 && yrot>=-90){
    SetObjectRot(Sbarra1,0.0,yrot+1,90);}
  if(yrot>0 && yrot<90){
	SetObjectRot(Sbarra1,0.0,0.0,90.0);
	KillTimer(Timer1[i]);
	SetTimerEx("CloseBar1",3000,0,"d",i);
	#if defined SHOW_WHAT_HAPPENS
	SendClientMessage(i,0xFFFF00AA,"Closing Barrier 1 in 5 seconds");
	#endif
	}
  return 1;}

public OpeningBarrier2(i){
  new Float:xrot,Float:yrot,Float:zrot;
  GetObjectRot(Sbarra2,xrot,yrot,zrot);
  if(yrot>=0 && yrot<=90){
    SetObjectRot(Sbarra2,0.0,yrot-1,90);}
  if(yrot<0 && yrot>-90){
	SetObjectRot(Sbarra2,0.0,0.0,90.0);
	KillTimer(Timer2[i]);
	SetTimerEx("CloseBar2",3000,0,"d",i);
	#if defined SHOW_WHAT_HAPPENS
	SendClientMessage(i,0xFFFF00AA,"Closing Barrier 2 in 5 seconds");
	#endif
	}
  return 1;}

public ClosingBarrier1(i){
  new Float:xrot,Float:yrot,Float:zrot;
  GetObjectRot(Sbarra1,xrot,yrot,zrot);
  if(yrot>=-90 && yrot<=10){
    SetObjectRot(Sbarra1,0.0,yrot-1,90);}
  if(yrot<-90 && yrot>-270){
	SetObjectRot(Sbarra1,0.0,-90.0,90.0);
	KillTimer(Timer1[i]);
	SetTimerEx("ReActiveVar1",5000,0,"d",i);
    #if defined SHOW_WHAT_HAPPENS
	SendClientMessage(i,0xFFFF00AA,"Reactivating Var 1");
	#endif
	}
  return 1;}

public ClosingBarrier2(i){
  new Float:xrot,Float:yrot,Float:zrot;
  GetObjectRot(Sbarra2,xrot,yrot,zrot);
  if(yrot<=90 && yrot>=-10){
    SetObjectRot(Sbarra2,0.0,yrot+1,90);}
  if(yrot>90 && yrot<270){
	SetObjectRot(Sbarra2,0.0,90.0,90.0);
	KillTimer(Timer2[i]);
	SetTimerEx("ReActiveVar2",5000,0,"d",i);
	#if defined SHOW_WHAT_HAPPENS
	SendClientMessage(i,0xFFFF00AA,"Reactivating Var 2");
	#endif
	}
  return 1;}
  
public CloseGatesTM(){
  CloseGates();
  GatesOpened=false;
  return 1;}
  
forward SamOnMe(playerid);
public SamOnMe(playerid){
  AngolaSAM(3881.56640625,-1763.63476562,playerid);
  return 1;}
  
public CheckMisslesPos(playerid){
  if(IsSamAiming==true){
  new Float:px,Float:py,Float:pz;
  for(new i=0;i<10;i++){
    GetObjectPos(Missle[i],px,py,pz);
	if(MissleX[i]==px && MissleY[i]==py && MissleZ[i]==pz){
	  DestroyObject(Missle[i]);
	  CreateExplosion(MissleX[i],MissleY[i],MissleZ[i],10,10000);}}}
  return 1;}
  
public CheckAdvancedMisslePos(playerid){
  if(IsSamAiming==true){
    new Float:px,Float:py,Float:pz;
    new Float:a,Float:b,Float:c;
    GetObjectPos(AdvMissle,px,py,pz);
    GetPlayerPos(playerid,a,b,c);
    if(GetDistance(px,py,pz,a,b,c)<5){
	  DestroyObject(AdvMissle);
	  CreateExplosion(a,b,c,7,100);
	  ThrowAdvancedMissle(playerid);}}
  return 1;}

public CheckPosFromBarriers(){
  DestroyObject(Sam);
  Sam=CreateObject(3884,3881.56640625,-1763.63476562,118.81739807,0.0,0.0,0.0);
  for(new i=0;i<MAX_SERVER_PLAYERS;i++){
    if(IsPlayerConnected(i))if(Spawned[i]==true){
      if(!IsPlayerInRangeOfPoint(i,330,3883.1416,-1764.6523,120.3191)){
		if(IsSamTimerAimingOn[i]==true){
		  KillTimer(SamTimer[i]);
	      IsSamTimerAimingOn[i]=false;
		  SamAiming=MAX_SERVER_PLAYERS+1;
		  IsSamAiming=false;
		  DestroyObject(AdvMissle);
		  KillTimer(TimerMissles);}}
	  if(IsPlayerInRangeOfPoint(i,330,3883.1416,-1764.6523,120.3191)){
		if(!IsPlayerAdmin(i)){
          if(DEFENCE_MODE==1){ //autokill
            SetPlayerHealth(i,0);
            GameTextForPlayer(i,InIslandMessage2,4000,3);
			return 1;}
          if(DEFENCE_MODE==2){ //straight missles on enemy
            GameTextForPlayer(i,InIslandMessage3,4000,3);
            ThrowMissle(i);
		    if(IsSamAiming==false){
		      SamAiming=i;
			  IsSamAiming=true;
			  SamTimer[i]=SetTimerEx("SamOnMe",50,1,"d",i);
			  IsSamTimerAimingOn[i]=true;
			  TimerMissles=SetTimerEx("CheckMisslesPos",50,1,"d",i);}}
	      if(DEFENCE_MODE==3){ //missle following the enemy
            GameTextForPlayer(i,InIslandMessage4,4000,3);
		    if(IsSamAiming==false){
		      SamAiming=i;
			  IsSamAiming=true;
			  SamTimer[i]=SetTimerEx("SamOnMe",50,1,"d",i);
			  IsSamTimerAimingOn[i]=true;
			  TimerMissles2=SetTimerEx("CheckAdvancedMisslePos",50,1,"d",i);
			  ThrowAdvancedMissle(i);}}}}
    
	  if(IsPlayerInRangeOfPoint(i,10,2948.2056,-1958.5729,8.6734)){
		if(!IsPlayerAdmin(i) && DEFENCE_MODE!=0){
		  GameTextForPlayer(i,RestrictedAreaWarning,3000,3);}
		if((IsPlayerAdmin(i)) || (!IsPlayerAdmin(i) && DEFENCE_MODE==0)){
		  if(GatesOpened==false){
		    OpenGates();
		    GatesOpened=true;
			SetTimer("CloseGatesTM",7000,0);}}}
		
	  if(IsPlayerInRangeOfPoint(i,6,3720.1160,-1771.6874,4.3452)){
		if(Timer1Active[i]==false){
		  Timer1[i]=SetTimerEx("OpeningBarrier1",20,1,"d",i);
		  Timer1Active[i]=true;
		  #if defined SHOW_WHAT_HAPPENS
		  SendClientMessage(i,0xFFFF00AA,"Opening barrier 1");
		  #endif
		  }}
      if(IsPlayerInRangeOfPoint(i,6,3720.3320,-1762.7115,4.3540)){
	    if(Timer2Active[i]==false){
		  Timer2[i]=SetTimerEx("OpeningBarrier2",20,1,"d",i);
		  Timer2Active[i]=true;
		  #if defined SHOW_WHAT_HAPPENS
		  SendClientMessage(i,0xFFFF00AA,"Opening barrier 2");
		  #endif
		  }}}}
  return 1;}

public CloseBar1(i){
  Timer1[i]=SetTimerEx("ClosingBarrier1",20,1,"d",i);
  return 1;}

public CloseBar2(i){
  Timer2[i]=SetTimerEx("ClosingBarrier2",20,1,"d",i);
  return 1;}

public ReActiveVar1(i){
  Timer1Active[i]=false;
  #if defined SHOW_WHAT_HAPPENS
  SendClientMessage(i,0xFFFF00AA,"Var 1 Reactived");
  #endif
  return 1;}

public ReActiveVar2(i){
  Timer2Active[i]=false;
  #if defined SHOW_WHAT_HAPPENS
  SendClientMessage(i,0xFFFF00AA,"Var 2 Reactived");
  #endif
  return 1;}
Reply
#8

Help Please
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)