Help me! Tryin to create my first filterscript.
#1

I don't understand where is a problems:
Код:
#define FILTERSCRIPT
#include <a_samp>
new movingdoor1;
new movingdoor2;

public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" Grandrusenko hause.START");
	print("--------------------------------------\n");
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}

main()
{
	print("\n----------------------------------");
	print(" Grandrusenko hause.OFF");
	print("----------------------------------\n");
}

public OnGameModeInit()
{

	SetGameModeText("Elevator");
	AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
CreateVehicle(540,2514.37060547,-1534.58935547,23.49725533,28.00000000,7,6,15); //Vincent
CreateVehicle(507,2519.44018555,-1534.97155762,23.25790596,30.00000000,40,1,15); //Elegant
CreateVehicle(541,2523.65795898,-1533.14062500,23.46288681,28.00000000,-1,121,15); //Bullet
CreateVehicle(560,2528.17065430,-1532.51635742,23.50960541,34.00000000,41,-1,15); //Sultan
CreateVehicle(520,2526.23706055,-1527.26708984,33.73509598,0.00000000,-1,-1,15); //Hydra
CreateVehicle(425,2516.39208984,-1527.17419434,33.64036179,0.00000000,-1,-1,15); //Hunter
CreateObject(3624,2521.68090820,-1528.21191406,26.39105225,0.00000000,0.00000000,0.00000000); //object(nwwarhus) (1)
CreateObject(2904,2533.31567383,-1540.48156738,24.28315353,0.00000000,0.00000000,0.00000000); //object(warehouse_door1) (1)
CreateObject(2346,2521.26123047,-1516.59338379,22.95491409,0.00000000,0.00000000,0.00000000); //object(cj_hifi_table) (1)
CreateObject(2648,2521.69384766,-1516.51928711,23.72266769,0.00000000,0.00000000,0.00000000); //object(cj_steal_tv) (1)
CreateObject(2332,2520.65625000,-1516.44775391,23.44169998,0.00000000,0.00000000,0.00000000); //object(kev_safe) (1)
CreateObject(1709,2524.44116211,-1518.77160645,22.89920425,0.00000000,0.00000000,183.99998474); //object(kb_couch08) (1)
CreateObject(14787,2522.03540039,-1527.36767578,19.83795738,0.00000000,0.00000000,0.00000000); //object(ab_sfgymbits02a) (1)
CreateObject(2942,2515.41894531,-1517.08520508,23.60651398,0.00000000,0.00000000,0.00000000); //object(kmb_atm1) (1)
CreateObject(1514,2511.48144531,-1519.41748047,24.12845993,0.00000000,0.00000000,0.00000000); //object(dyn_ff_till) (1)
CreateObject(2424,2512.42749023,-1519.56506348,22.91861153,0.00000000,0.00000000,0.00000000); //object(cj_ff_conter_1) (2)
CreateObject(2424,2511.45410156,-1519.63720703,22.91861153,0.00000000,0.00000000,0.00000000); //object(cj_ff_conter_1) (3)
CreateObject(2424,2510.43530273,-1519.69372559,22.91861153,0.00000000,0.00000000,0.00000000); //object(cj_ff_conter_1) (4)
CreateObject(2424,2509.45922852,-1519.76257324,22.91861153,0.00000000,0.00000000,0.00000000); //object(cj_ff_conter_1) (5)
	movingdoor1	=	CreateObject(13613, 2540.31640625, -1528.0787353516, 24.714057922363, 0, 0, 0);
 movingdoor2 = CreateObject(3037, 2507.724609375, -1528.1882324219, 24.965961456299, 0, 0, 0);
	return 1;
}

public OnPlayerCommandText (playerid, cmdtext)

{
	if (!strcmp("/edown", cmdtext))
	{
		if(IsPlayerInRangeOfPoint(playerid, 7.0, 2353.693359375, -650.77709960938, 127.85127258301))
		{
	  MoveObject(movingdoor1, 2540.31640625, -1528.0787353516, 24.714057922363, 1);
		SendClientMessage(playerid, 0xEF994300, "Elevator has gone down.");
		 }
 		return 1;
	}

	if (!strcmp("/eup", cmdtext))
	{
	  if(IsPlayerInRangeOfPoint(playerid, 7.0, 2353.693359375, -650.77709960938, 127.85127258301))
 	{
 		MoveObject(movingdoor1, 2537.06640625, -1528.0787353516, 33.964057922363, 1);
    SendClientMessage(playerid, 0xEF994300, "The gate has opened.");
		}
		return 1;
	}
	
	if (!strcmp("/gdown", cmdtext))
	{
		if(IsPlayerInRangeOfPoint(playerid, 7.0, 2353.693359375, -650.77709960938, 127.85127258301))
		{
	  MoveObject(movingdoor2, 2507.724609375, -1528.1882324219, 20.215961456299, 1);
		SendClientMessage(playerid, 0xEF994300, "The garage door has been opened.");
		 }
 		return 1;
	}

	if (!strcmp("/gup", cmdtext))
	{
	  if(IsPlayerInRangeOfPoint(playerid, 7.0, 2353.693359375, -650.77709960938, 127.85127258301))
 	{
 		MoveObject(movingdoor2, 2507.724609375, -1528.1882324219, 24.965961456299, 1);
    SendClientMessage(playerid, 0xEF994300, "The garage door has been closed.");
		}
		return 1;
	}
I really need your help. If you help, gratz!
Reply
#2

You can't include OnGameModeInit and OnFilterscriptInit callbacks in same script.
If you create a filterscript, delete these.
pawn Код:
main {

}

public OnGameModeInit()
{
return 1;
}

public OnGameModeExit()
{
return 1;
}
If you create gamemode, you'll need to delete these.
pawn Код:
public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" Grandrusenko hause.START");
    print("--------------------------------------\n");
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}
If this is a filterscript, put the objebts under OnFilterScriptInit.
Reply
#3

I still doesn't understand.
Reply
#4

You can't use OnGameModeInit inside a filterscript since it's made for gamemodes, you need to use OnFilterScriptInit.

So, cut out all your code from GameModeInit, and paste it into FilterScriptInit, and then delete the GameModeInit or rename OnGameModeInit to OnFilterScriptInit, and delete the old FilterScriptInit.
Reply
#5

@EliranPesahov where did you saw
pawn Код:
public OnGameModeExit()
{
return 1;
}
?
Reply
#6

Quote:
Originally Posted by deqn_0000
Посмотреть сообщение
@EliranPesahov where did you saw
pawn Код:
public OnGameModeExit()
{
return 1;
}
?
This question was not needed, if he doesn't have it, he doesn't have to remove it.
His point was to change OnGameModeExit (if you have it) to OnFilterScriptExit.
Reply
#7

Quote:
Originally Posted by Mean
Посмотреть сообщение
This question was not needed, if he doesn't have it, he doesn't have to remove it.
His point was to change OnGameModeExit (if you have it) to OnFilterScriptExit.
Exactly.

@igor_andrusenko, I suggest you to read tutorials since you won't get better this way.
There are plenty of useful and good tutorials, just read and improve your knowledge.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)