-
Notifications
You must be signed in to change notification settings - Fork 0
/
hydra_f.inc
150 lines (122 loc) · 3.79 KB
/
hydra_f.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
#if !defined MAX_HYDRA_TIMER
#define MAX_HYDRA_TIMER 100
#endif
static
hydra__id[MAX_VEHICLES],
hydra__aim[MAX_VEHICLES],
hydra__height[MAX_VEHICLES],
hydra__speed[MAX_VEHICLES],
hydra__hp[MAX_VEHICLES];
stock CreateFutureHydra(Float:x, Float:y, Float:z, Float:angle, respawn)
{
static
vehicleid;
vehicleid = CreateVehicle(520, x, y, z, angle, -1, -1, respawn);
hydra__id[vehicleid] = 1;
CreateHydraObjects(vehicleid);
return vehicleid;
}
public OnVehicleSpawn(vehicleid)
{
if (hydra__id[vehicleid])
{
CreateHydraObjects(vehicleid);
}
#if defined hydra__OnVehicleSpawn
hydra__OnVehicleSpawn(vehicleid);
#endif
return 1;
}
public OnVehicleDeath(vehicleid)
{
DestroyDynamicObject(hydra__aim[vehicleid]);
DestroyDynamicObject(hydra__height[vehicleid]);
DestroyDynamicObject(hydra__hp[vehicleid]);
DestroyDynamicObject(hydra__speed[vehicleid]);
#if defined hydra__OnVehicleDeath
hydra__OnVehicleDeath(vehicleid);
#endif
return 1;
}
public OnGameModeInit()
{
SetTimer("HydraTimer", MAX_HYDRA_TIMER, 1);
#if defined free__OnGameModeInit
free__OnGameModeInit();
#endif
return 1;
}
forward HydraTimer();
public HydraTimer()
{
for (new i = 1, j = GetVehiclePoolSize(); i <= j; i++)
{
if (!hydra__id[i])
continue;
new
string[8],
Float:__,
Float:_float,
_int;
GetVehicleHealth(i, _float);
valstr(string, floatround(_float));
strcat(string, "HP");
SetDynamicObjectMaterialText(hydra__hp[i], 0, string, 130, !"Arial", 140, 1, -23296, 0, 1);
_int = SpeedVehicle(i);
valstr(string, _int);
strcat(string, "KM/H");
SetDynamicObjectMaterialText(hydra__speed[i], 0, string, 130, !"Arial", 140, 1, -23296, 0, 1);
GetVehiclePos(i, __, __, _float);
valstr(string, floatround(_float));
strcat(string, "^");
SetDynamicObjectMaterialText(hydra__height[i], 0, string, 130, !"Arial", 230, 1, -1, -23296, 1);
}
return 1;
}
static stock CreateHydraObjects(vehicleid)
{
hydra__hp[vehicleid] = CreateDynamicObject(19477, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000);
AttachDynamicObjectToVehicle(hydra__hp[vehicleid], vehicleid, -2.558614, -0.168310, 0.405535, 11.600008, -30.000000, -65.015716);
hydra__speed[vehicleid] = CreateDynamicObject(19477, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000);
AttachDynamicObjectToVehicle(hydra__speed[vehicleid], vehicleid, 2.558614, -0.168310, 0.405535, -11.600008, -30.000000, 245.015716);
hydra__height[vehicleid] = CreateDynamicObject(19476, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000);
AttachDynamicObjectToVehicle(hydra__height[vehicleid], vehicleid, 0.523670, -6.738031, 2.013909, 0.000000, 0.000000, -89.992889);
hydra__aim[vehicleid] = CreateDynamicObject(19477, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000);
SetDynamicObjectMaterialText(hydra__aim[vehicleid], 0, !"=O=", 130, !"Arial", 200, 1, -65536, 0, 1);
AttachDynamicObjectToVehicle(hydra__aim[vehicleid], vehicleid, -0.946332, 93.174057, -0.350000, 0.000000, 0.000000, -89.372711);
return 1;
}
stock SpeedVehicle(vehicleid)
{
new
Float:x, Float:y, Float:z;
GetVehicleVelocity(vehicleid, x, y, z);
return floatround(floatsqroot(x*x+y*y+z*z)*100);
}
#if defined _ALS_OnVehicleSpawn
#undef OnVehicleSpawn
#else
#define _ALS_OnVehicleSpawn
#endif
#define OnVehicleSpawn hydra__OnVehicleSpawn
#if defined hydra__OnVehicleSpawn
forward hydra__OnVehicleSpawn(vehicleid);
#endif
#if defined _ALS_OnVehicleDeath
#undef OnVehicleDeath
#else
#define _ALS_OnVehicleDeath
#endif
#define OnVehicleDeath hydra__OnVehicleDeath
#if defined hydra__OnVehicleDeath
forward hydra__OnVehicleDeath(vehicleid);
#endif
#if defined _ALS_OnGameModeInit
#undef OnGameModeInit
#else
#define _ALS_OnGameModeInit
#endif
#define OnGameModeInit free__OnGameModeInit
#if defined free__OnGameModeInit
forward free__OnGameModeInit();
#endif