Scripting Help
#1

Hello All,

I normally don't post for help but I am in desperate need!

I am a noob when it comes to scripting. I have two Bugs that Cannot stay!


My first issue is my cars! I just learned on how to Install cars in my script! BUT

I am doing it for my factions as well and I noticed that all the cars that I entered is drivable by
anyone. I added cars for a police department , anyone can drive it!... I again have no idea on how to fix
that seeing i look at is and my head goes blank. The Lines that I put in script will be listed below!

My second issue is my FS that I installed. I added on a FS to my Script that Had all kinds of gates and Such.
Well those gates can be opened by anyone. I want just the police to be able to fix it.
I had contacted the creator but He said that He doesn't provide support because he has retired from scripting.
I will post the Script below.

If you can PLEASE help me.

Thanks for any support you provide!

Lines for the cars I added


Код:
 	AddStaticVehicle(416,1209.6677,-1300.5430,13.5364,180.3661,1,3); //
  AddStaticVehicle(416,1209.4495,-1320.9647,13.5500,180.1030,1,3); //
  AddStaticVehicle(416,1209.2133,-1351.5068,13.5526,359.3271,1,3); //
  AddStaticVehicle(416,1209.5905,-1373.9008,13.4547,180.1731,1,3); //
  AddStaticVehicle(416,1191.9857,-1374.2783,13.5085,357.9360,1,3); //
  AddStaticVehicle(416,1191.8320,-1347.0760,13.5766,182.7764,1,3); //
  AddStaticVehicle(416,1192.1235,-1325.9537,13.5500,0.8017,1,3); //
  AddStaticVehicle(416,1192.4786,-1295.7401,13.5341,358.5956,1,3); //
  AddStaticVehicle(598,1646.7880,-1720.7751,20.2222,269.8669,0,1); //
  AddStaticVehicle(598,1644.8885,-1696.0242,20.2084,181.0347,0,1); //
  AddStaticVehicle(598,1671.9302,-1694.5553,20.2260,92.3650,0,1); //
  AddStaticVehicle(525,1602.7067,-1605.6381,13.3701,89.2093,17,20); //
  AddStaticVehicle(525,1602.8640,-1610.2010,13.3810,90.1656,18,20); //
  AddStaticVehicle(525,1602.4094,-1614.8226,13.3517,91.4687,22,30); //
  AddStaticVehicle(554,-2551.3438,2276.8945,5.0659,153.8307,15,32); //
  AddStaticVehicle(500,-2525.7891,2256.8057,5.0778,335.8274,40,84); //
The LSPD FILTERSCRIPT CODE

Код:
#include <a_samp>

#pragma tabsize 0

new PDDOORa;
new PDDOORb;
new PDDOORc;
new PDDOORd;
new PDWINDOW;
new CELLDOOR;
new PDGATE;
new PDGARAGE;
new PDELEVATOR;
new COMPOUNDGATE;


#define COLOR_GREY 0xAFAFAFAA
#define COLOR_PURPLE 0xC2A2DAAA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_DBLUE 0x2641FEAA
#define COLOR_BLUE 0x33AAFFFF
#define COLOR_GREEN 0x33AA33AA
#define COLOR_ORANGE 0xFF9900AA
#define COLOR_PINK 0xFF69B4FF
#define COLOR_BGREEN 0x08FD04FF
#define COLOR_CYAN 0x00FFFFAA
#define COLOR_RED 0xFF3366FF
#define COLOR_YELLOW 0xFFCC33FF
#define COLOR_DGREEN 0x008000FF
#define COLOR_DRED 0x800000FF
#define COLOR_DARK 0x000000FF

// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT
#define Filterscript
#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" LSPD Gates & Doors by Avenger678");
	print("--------------------------------------\n");
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}

#else

main()
{
	print("\n----------------------------------");
	print(" LSPD Gates & Doors by Avenger678");
	print("----------------------------------\n");
}

#endif

public OnGameModeInit()
{

PDDOORa = CreateObject( 985 , 247.005905 , 72.448440 , 1003.640625 , 0.000000 , 0.000000 , 1260.000000 );
PDDOORb = CreateObject( 985 , 250.774871 , 60.822799 , 1003.640625 , 0.000000 , 0.000000 , 5130.000000 );
PDDOORc = CreateObject( 986 , 248.142105 , 78.125961 , 1003.640625 , 0.000000 , 0.000000 , 12690.000000 );
PDDOORd = CreateObject( 986 , 248.248901 , 87.360313 , 1003.467834 , 0.000000 , 0.000000 , 12690.000000 );
PDWINDOW = CreateObject( 974 , 250.503234 , 67.772872 , 1006.222045 , 0.000000 , 0.000000 , 7830.000000 );
CELLDOOR = CreateObject( 989 , 266.238403 , 81.891395 , 1001.039062 , 0.000000 , 0.000000 , 10816.000000 );
PDGATE = CreateObject( 987 , 1546.113769 , -1621.810913 , 11.709331 , 0.000000 , 0.000000 , 990.000000 );
PDGARAGE = CreateObject( 987 , 1593.301635 , -1638.118530 , 12.467614 , 0.000000 , 0.000000 , 540.000000 );
PDELEVATOR = CreateObject( 988 , 1549.049804 , -1697.787109 , 12.551495 , -90.000000 , 0.000000 , 810.000000 );
COMPOUNDGATE = CreateObject( 986 , 1591.682861 , -1617.880371 , 12.053466 , 0.000000 , 0.000000 , 0.000000 );

CreateObject(4882 , 1529.906372 , -1645.990844 , 17.192256 , 0.000000 , 0.000000 , 812.000000 );
CreateObject(8947 , 1550.584350 , -1628.559570 , 24.334913 , 0.000000 , 0.000000 , 0.000000 );
CreateObject(8947 , 1564.935302 , -1628.527343 , 24.324607 , 0.000000 , 0.000000 , 0.000000 );
CreateObject(8947 , 1550.579711 , -1628.601928 , 24.300050 , 180.000000 , 0.000000 , 0.000000 );
CreateObject(8947 , 1564.789306 , -1628.576049 , 24.312379 , 180.000000 , 0.000000 , 0.000000 );
CreateObject(3749 , 1546.750122 , -1627.783447 , 18.306715 , 0.000000 , 0.000000 , 630.000000 );
CreateObject(1635 , 1542.953247 , -1627.944946 , 22.180809 , 0.000000 , 0.000000 , 0.000000 );
CreateObject(9241, 1565.905273, -1698.264893, 28.904495, 0.0000, 0.0000, 270.0000);
CreateObject(9241, 1566.000244, -1653.266724, 28.779516, 0.0000, 0.0000, 270.0000);
CreateObject(8550 , 1555.286376 , -1627.094482 , 31.792537 , 0.000000 , 0.000000 , 0.000000 );

CreateObject( 987 , 1539.853759 , -1617.624633 , 11.450000 , 0.000000 , 0.000000 , 0.000000 );
CreateObject( 987 , 1539.853759 , -1605.779907 , 11.450000 , 0.000000 , 0.000000 , 270.000000 );
CreateObject( 987 , 1539.853759 , -1602.585693 , 11.450000 , 0.000000 , 0.000000 , 2070.000000 );
CreateObject( 987 , 1551.839843 , -1602.689941 , 11.450000 , 0.000000 , 0.000000 , 1260.000000 );
CreateObject( 987 , 1563.804321 , -1602.689941 , 11.450000 , 0.000000 , 0.000000 , 8100.000000 );
CreateObject( 987 , 1575.796264 , -1602.689941 , 11.450000 , 0.000000 , 0.000000 , 1260.000000 );
CreateObject( 987 , 1587.784790 , -1602.689941 , 11.450000 , 0.000000 , 0.000000 , 8100.000000 );
CreateObject( 987 , 1599.765014 , -1602.689941 , 11.450000 , 0.000000 , 0.000000 , 1260.000000 );
CreateObject( 987 , 1607.886596 , -1602.689941 , 11.450000 , 0.000000 , 0.000000 , 8100.000000 );
CreateObject( 987 , 1607.750000 , -1614.606567 , 11.450000 , 0.000000 , 0.000000 , 90.000000 );
CreateObject( 987 , 1607.750000 , -1626.607299 , 11.450000 , 0.000000 , 0.000000 , 810.000000 );
CreateObject( 987 , 1607.750000 , -1637.935058 , 11.450000 , 0.000000 , 0.000000 , 810.000000 );
CreateObject( 987 , 1607.750000 , -1638.097900 , 11.450000 , 0.000000 , 0.000000 , 7022.000000 );
CreateObject( 987 , 1551.849731 , -1617.624633 , 11.450000 , 0.000000 , 0.000000 , 0.000000 );
CreateObject( 987 , 1563.764404 , -1617.624633 , 11.450000 , 0.000000 , 0.000000 , 0.000000 );
CreateObject( 987 , 1575.738769 , -1617.624633 , 11.450000 , 0.000000 , 0.000000 , 0.000000 );
CreateObject( 987 , 1595.711425 , -1617.624633 , 11.450000 , 0.000000 , 0.000000 , 0.000000 );

AddStaticVehicle(497,1566.6086,-1699.9132,30.9096,2.0264,0,1);
AddStaticVehicle(497,1566.7705,-1652.6370,30.7791,183.1091,0,1);



	return 1;
}

public OnGameModeExit()
{
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
		if (strcmp(cmdtext, "/pd1op", true)==0)
    {
    MoveObject(PDDOORa,247.005905 , 72.448440 , 1003.640625,3.5);//close
    MoveObject(PDDOORa,247.005905 , 72.448440 , 1006.912902,3.5);//open
   SendClientMessage(playerid, COLOR_YELLOW,"Administration Door Open");
   return 1;
    }
    
		if (strcmp(cmdtext, "/pd1cl", true)==0)
    {
    MoveObject(PDDOORa,247.005905 , 72.448440 , 1006.912902,3.5);//open
    MoveObject(PDDOORa,247.005905 , 72.448440 , 1003.640625,3.5);//close
   SendClientMessage(playerid, COLOR_YELLOW,"Administration Door Close");
   return 1;
    }
    
    if (strcmp(cmdtext, "/pd2op", true)==0)
    {
    MoveObject(PDDOORb,250.774871 , 60.822799 , 1003.640625,3.5);//close
    MoveObject(PDDOORb,250.774871 , 60.822799 , 1006.862670,3.5);//open
   SendClientMessage(playerid, COLOR_YELLOW,"Desk Door 2 Open");
   return 1;
    }

		if (strcmp(cmdtext, "/pd2cl", true)==0)
    {
    MoveObject(PDDOORb,250.774871 , 60.822799 , 1006.862670,3.5);//open
    MoveObject(PDDOORb,250.774871 , 60.822799 , 1003.640625,3.5);//close
   SendClientMessage(playerid, COLOR_YELLOW,"Desk Door 2 Close");
   return 1;
    }
    
    if (strcmp(cmdtext, "/pd3op", true)==0)
    {
    MoveObject(PDDOORc,248.142105 , 78.125961 , 1003.640625,3.5);//close
    MoveObject(PDDOORc,248.142105 , 78.125961 , 1007.248718,3.5);//open
   SendClientMessage(playerid, COLOR_YELLOW,"Locker Room Open");
   return 1;
    }

		if (strcmp(cmdtext, "/pd3cl", true)==0)
    {
    MoveObject(PDDOORc,248.142105 , 78.125961 , 1007.248718,3.5);//open
    MoveObject(PDDOORc,248.142105 , 78.125961 , 1003.640625,3.5);//close
   SendClientMessage(playerid, COLOR_YELLOW,"Locker Room Close");
   return 1;
    }
    
    if (strcmp(cmdtext, "/pd4op", true)==0)
    {
    MoveObject(PDDOORd,248.248901 , 87.360313 , 1003.467834,3.5);//close
    MoveObject(PDDOORd,248.248901 , 87.360313 , 1006.931152,3.5);//open
   SendClientMessage(playerid, COLOR_YELLOW,"Cell Entrance Open");
   return 1;
    }

		if (strcmp(cmdtext, "/pd4cl", true)==0)
    {
    MoveObject(PDDOORd,248.248901 , 87.360313 , 1006.931152,3.5);//open
    MoveObject(PDDOORd,248.248901 , 87.360313 , 1003.467834,3.5);//close
   SendClientMessage(playerid, COLOR_YELLOW,"Cell Entrance Close");
   return 1;
    }

    if (strcmp(cmdtext, "/pdwop", true)==0)
    {
    MoveObject(PDWINDOW,250.503234 , 67.772872 , 1006.222045,3.5);//close
    MoveObject(PDWINDOW,250.503234 , 67.772872 , 1008.109191,3.5);//open
   SendClientMessage(playerid, COLOR_YELLOW,"Window Open");
   return 1;
    }

		if (strcmp(cmdtext, "/pdwcl", true)==0)
    {
    MoveObject(PDWINDOW,250.503234 , 67.772872 , 1008.109191,3.5);//open
    MoveObject(PDWINDOW,250.503234 , 67.772872 , 1006.222045,3.5);//close
   SendClientMessage(playerid, COLOR_YELLOW,"Window Close");
   return 1;
    }

    if (strcmp(cmdtext, "/celop", true)==0)
    {
    MoveObject(CELLDOOR,266.238403 , 81.891395 , 1001.039062,3.5);//close
    MoveObject(CELLDOOR,266.238403 , 81.891395 , 1004.377380,3.5);//open
   SendClientMessage(playerid, COLOR_YELLOW,"Celldoor Open");
   return 1;
    }

		if (strcmp(cmdtext, "/celcl", true)==0)
    {
    MoveObject(CELLDOOR,266.238403 , 81.891395 , 1004.377380,3.5);//open
    MoveObject(CELLDOOR,266.238403 , 81.891395 , 1001.039062,3.5);//close
   SendClientMessage(playerid, COLOR_YELLOW,"Celldoor Close");
   return 1;
    }
    
    if (strcmp(cmdtext, "/pdgatop", true)==0)
    {
    MoveObject(PDGATE,1546.113769 , -1621.810913 , 11.709331,3.5);//close
    MoveObject(PDGATE,1546.113769 , -1621.810913 , 5.644468,3.5);//open
   SendClientMessage(playerid, COLOR_YELLOW,"Welcome to LSPD, Gate Open");
   return 1;
    }

		if (strcmp(cmdtext, "/pdgatcl", true)==0)
    {
    MoveObject(PDGATE,1546.113769 , -1621.810913 , 5.644468,3.5);//open
    MoveObject(PDGATE,1546.113769 , -1621.810913 , 11.709331,3.5);//close
   SendClientMessage(playerid, COLOR_YELLOW,"Gate Close");
   return 1;
    }

    if (strcmp(cmdtext, "/pdgarop", true)==0)
    {
    MoveObject(PDGARAGE,1593.301635 , -1638.118530 , 12.467614,3.5);//close
    MoveObject(PDGARAGE,1593.301635 , -1638.118530 , 6.142154,3.5);//open
   SendClientMessage(playerid, COLOR_YELLOW,"Garage Open");
   return 1;
    }

		if (strcmp(cmdtext, "/pdgarcl", true)==0)
    {
    MoveObject(PDGARAGE,1593.301635 , -1638.118530 , 6.142154,3.5);//open
    MoveObject(PDGARAGE,1593.301635 , -1638.118530 , 12.467614,3.5);//close
   SendClientMessage(playerid, COLOR_YELLOW,"Garage Close");
   return 1;
    }
    
    if (strcmp(cmdtext, "/pdelup", true)==0)
    {
    MoveObject(PDELEVATOR,1549.049804 , -1697.787109 , 12.551495,3.5);//down
    MoveObject(PDELEVATOR,1549.049804 , -1697.787109 , 27.134717,3.5);//up
   SendClientMessage(playerid, COLOR_YELLOW,"Garage Open");
   return 1;
    }

		if (strcmp(cmdtext, "/pdeldo", true)==0)
    {
    MoveObject(PDELEVATOR,1549.049804 , -1697.787109 , 27.134717,3.5);//up
    MoveObject(PDELEVATOR,1549.049804 , -1697.787109 , 12.551495,3.5);//down
   SendClientMessage(playerid, COLOR_YELLOW,"Garage Close");
   return 1;
    }
    
    if (strcmp(cmdtext, "/pdcompop", true)==0)
    {
    MoveObject(COMPOUNDGATE,1591.682861 , -1617.880371 , 12.053466,3.5);//close
    MoveObject(COMPOUNDGATE,1583.598754 , -1617.880371 , 12.053466,3.5);//open
   SendClientMessage(playerid, COLOR_YELLOW,"Compound Open");
   return 1;
    }

		if (strcmp(cmdtext, "/pdcompcl", true)==0)
    {
    MoveObject(COMPOUNDGATE,1583.598754 , -1617.880371 , 12.053466,3.5);//open
    MoveObject(COMPOUNDGATE,1591.682861 , -1617.880371 , 12.053466,3.5);//close
   SendClientMessage(playerid, COLOR_YELLOW,"Compound Close");
   return 1;
    }
    
	return 0;
}
Thanks for Reading!... If you need to see the Script itself Contact PM
Reply
#2

Why wouldn't anyone be able to drive the cars or open the gates? There is no code stopping them.
Reply
#3

Quote:
Originally Posted by Backwardsman97
Why wouldn't anyone be able to drive the cars or open the gates? There is no code stopping them.
I know,

I dont know Anything About the Code. It is a Filter Script that I downloaded. I need someone to Mod it
So that It is only for Police.

Thanks for you input!
Reply
#4

Anyone have any other Idea?


HELP PLEASE
Reply
#5

Quote:

drivable by anyone.

search public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger) in your gamemode and add
if(!IsACop(playerid) && !ispassenger && IsACopCar(vehicleid)) { RemovePlayerFromVehicle(playerid);}
you should write public IsACop(playerid) and IsACopCar(playerid)

The filterscript with gates is better for integrating in gamemode and too to use IsACop(playerid), when enter command /open...
Reply
#6

If you need someone to make a script for you, just ask in the scripts requests part of the forums :P
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)