Team/Factions Cars Issue
#1

Hi, I was following the guide https://sampforum.blast.hk/showthread.php?tid=107762 on Teams, I am implementing the cars. At the top of the script I added

Код:
   enum TeamCars
	{
	t1
	t2
	t3
	t4
	t5
	t6
	t7
	t8
	t9
	t10
	t11
	t12
	t13
	t14
	t15
	t16
	t17
	t18
	t19
	t20
	t21
	t22
	t23
	t24
	t25
	t26
	t27
	t28
	t29
	t30
	}
	new Cars[TeamCars];

	Cars[t1] = CreateVehicle(520,279.1000061,1989.0999756,18.6000004,270.0000000,-1,-1,15);
	Cars[t2] = CreateVehicle(520,278.6992188,2024.3994141,18.6000004,270.0000000,-1,-1,15);
	Cars[t3] = CreateVehicle(520,278.8999939,1955.0999756,18.6000004,270.0000000,-1,-1,15);
	Cars[t4] = CreateVehicle(432,384.6992188,1896.5000000,17.7000008,90.0000000,95,10,15);
	Cars[t5] = CreateVehicle(432,384.7999878,1902.5999756,17.7000008,90.0000000,95,10,15);
	Cars[t6] = CreateVehicle(432,384.8999939,1908.5999756,17.7000008,90.0000000,95,10,15);
	Cars[t7] = CreateVehicle(432,384.7999878,1914.0999756,17.7000008,90.0000000,95,10,15);
	Cars[t8] = CreateVehicle(432,384.7999878,1919.5000000,17.7000008,90.0000000,95,10,15);
	Cars[t9] = CreateVehicle(433,382.8999939,1995.0999756,18.2000008,89.9999390,95,10,15);
	Cars[t10] = CreateVehicle(433,383.0000000,1990.5000000,18.2000008,89.9945068,95,10,15);
	Cars[t11] = CreateVehicle(433,383.2999878,1985.5000000,18.2000008,89.9945068,95,10,15);
	Cars[t12] = CreateVehicle(548,361.0000000,1966.3000488,19.5000000,0.0000000,245,245,15);
	Cars[t13] = CreateVehicle(548,360.6992188,1938.5996094,19.5000000,0.0000000,245,245,15);
	Cars[t14] = CreateVehicle(548,379.3999939,1949.4000244,19.5000000,0.0000000,245,245,15);
	Cars[t15] = CreateVehicle(470, 1366.9098, -2450.6079, 13.3500, -90.0000, -1, -1, 100);
	Cars[t16] = CreateVehicle(470, 1366.9098, -2454.6079, 13.3500, -90.0000, -1, -1, 100);
	Cars[t17] = CreateVehicle(470, 1366.9098, -2458.6079, 13.3500, -90.0000, -1, -1, 100);
	Cars[t18] = CreateVehicle(470, 1366.9098, -2462.6079, 13.3500, -90.0000, -1, -1, 100);
	Cars[t19] = CreateVehicle(470, 1366.9098, -2446.6079, 13.3500, -90.0000, -1, -1, 100);
	Cars[t20] = CreateVehicle(433, 1369.0089, -2441.3030, 14.0000, -90.0000, -1, -1, 100);
	Cars[t21] = CreateVehicle(433, 1368.9932, -2436.2905, 14.0000, -90.0000, -1, -1, 100);
	Cars[t22] = CreateVehicle(433, 1368.9932, -2436.2905, 14.0000, -90.0000, -1, -1, 100);
	Cars[t23] = CreateVehicle(433, 1368.9932, -2431.2905, 14.0000, -90.0000, -1, -1, 100);
	Cars[t24] = CreateVehicle(425, 1487.2528, -2405.4680, 17.2000, 180.0000, -1, -1, 100);
	Cars[t25] = CreateVehicle(520, 1450.7407, -2422.5881, 14.2197, 180.0000, -1, -1, 100);
	Cars[t26] = CreateVehicle(520, 1422.2407, -2422.5881, 14.2197, 180.0000, -1, -1, 100);
However the issue is that the cars do not spawn if I add that to the top of the script, if I add it at Gamemode Init callback, it says unknown symbol T1, etc.. Even if I add the enum at Gamemode init, same error. Any ideas?
Reply
#2

You have to add it in any callback. You should put it in OnGameModeInit and then add it with AddStaticVehicle.
Reply
#3

Quote:
Originally Posted by JustBored
Посмотреть сообщение
You have to add it in any callback. You should put it in OnGameModeInit and then add it with AddStaticVehicle.
I dont understand. Which part do I put where? And why does it have to be StaticVehicle, in the guide it is CreateVehicle.
Reply
#4

Try changing it to.
pawn Код:
enum TeamCars
    {
    t1,
    t2,
    t3,
        ....
        t29,
    t30
}
Make sure the enum is at the top of the script and that the CreateVehicle() codes are under OnGameModeInit();
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)