-
Notifications
You must be signed in to change notification settings - Fork 0
/
getspawninfo.inc
222 lines (192 loc) · 6.06 KB
/
getspawninfo.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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
/*
About: get spawn info function
Author: ziggi
*/
#if !defined _samp_included
#error "Please include a_samp or a_npc before getspawninfo"
#endif
#if defined _getspawninfo_included
#endinput
#endif
#define _getspawninfo_included
/*
Defines
*/
#define MAX_PLAYER_CLASS 320
/*
Enums
*/
enum e_Spawn_Info {
bool:e_sIsUsed,
e_sTeam,
e_sSkin,
Float:e_sPosX,
Float:e_sPosY,
Float:e_sPosZ,
Float:e_sRotation,
e_sWeapon1,
e_sWeapon1_Ammo,
e_sWeapon2,
e_sWeapon2_Ammo,
e_sWeapon3,
e_sWeapon3_Ammo,
}
/*
Vars
*/
static
gPlayerSpawn[MAX_PLAYERS][e_Spawn_Info],
gPlayerClass[MAX_PLAYER_CLASS][e_Spawn_Info];
/*
AddPlayerClass
*/
stock SpawnInfo_AddPlayerClass(skin,
Float:x, Float:y, Float:z, Float:angle,
weapon1, weapon1_ammo, weapon2, weapon2_ammo, weapon3, weapon3_ammo)
{
new classid = AddPlayerClass(skin, x, y, z, angle,
weapon1, weapon1_ammo, weapon2, weapon2_ammo, weapon3, weapon3_ammo);
gPlayerClass[classid][e_sIsUsed] = true;
gPlayerClass[classid][e_sTeam] = NO_TEAM;
gPlayerClass[classid][e_sSkin] = skin;
gPlayerClass[classid][e_sPosX] = x;
gPlayerClass[classid][e_sPosY] = y;
gPlayerClass[classid][e_sPosZ] = z;
gPlayerClass[classid][e_sRotation] = angle;
gPlayerClass[classid][e_sWeapon1] = weapon1;
gPlayerClass[classid][e_sWeapon1_Ammo] = weapon1_ammo;
gPlayerClass[classid][e_sWeapon2] = weapon2;
gPlayerClass[classid][e_sWeapon2_Ammo] = weapon2_ammo;
gPlayerClass[classid][e_sWeapon3] = weapon3;
gPlayerClass[classid][e_sWeapon3_Ammo] = weapon3_ammo;
return classid;
}
#if defined _ALS_AddPlayerClass
#undef AddPlayerClass
#else
#define _ALS_AddPlayerClass
#endif
#define AddPlayerClass SpawnInfo_AddPlayerClass
/*
AddPlayerClassEx
*/
stock SpawnInfo_AddPlayerClassEx(teamid, skin,
Float:x, Float:y, Float:z, Float:angle,
weapon1, weapon1_ammo, weapon2, weapon2_ammo, weapon3, weapon3_ammo)
{
new classid = AddPlayerClassEx(teamid, skin, x, y, z, angle,
weapon1, weapon1_ammo, weapon2, weapon2_ammo, weapon3, weapon3_ammo);
gPlayerClass[classid][e_sIsUsed] = true;
gPlayerClass[classid][e_sTeam] = teamid;
gPlayerClass[classid][e_sSkin] = skin;
gPlayerClass[classid][e_sPosX] = x;
gPlayerClass[classid][e_sPosY] = y;
gPlayerClass[classid][e_sPosZ] = z;
gPlayerClass[classid][e_sRotation] = angle;
gPlayerClass[classid][e_sWeapon1] = weapon1;
gPlayerClass[classid][e_sWeapon1_Ammo] = weapon1_ammo;
gPlayerClass[classid][e_sWeapon2] = weapon2;
gPlayerClass[classid][e_sWeapon2_Ammo] = weapon2_ammo;
gPlayerClass[classid][e_sWeapon3] = weapon3;
gPlayerClass[classid][e_sWeapon3_Ammo] = weapon3_ammo;
return classid;
}
#if defined _ALS_AddPlayerClassEx
#undef AddPlayerClassEx
#else
#define _ALS_AddPlayerClassEx
#endif
#define AddPlayerClassEx SpawnInfo_AddPlayerClassEx
/*
SetSpawnInfo
*/
stock SpawnInfo_SetSpawnInfo(playerid, team, skin,
Float:x, Float:y, Float:z, Float:rotation,
weapon1, weapon1_ammo, weapon2, weapon2_ammo, weapon3, weapon3_ammo)
{
gPlayerSpawn[playerid][e_sIsUsed] = true;
gPlayerSpawn[playerid][e_sTeam] = team;
gPlayerSpawn[playerid][e_sSkin] = skin;
gPlayerSpawn[playerid][e_sPosX] = x;
gPlayerSpawn[playerid][e_sPosY] = y;
gPlayerSpawn[playerid][e_sPosZ] = z;
gPlayerSpawn[playerid][e_sRotation] = rotation;
gPlayerSpawn[playerid][e_sWeapon1] = weapon1;
gPlayerSpawn[playerid][e_sWeapon1_Ammo] = weapon1_ammo;
gPlayerSpawn[playerid][e_sWeapon2] = weapon2;
gPlayerSpawn[playerid][e_sWeapon2_Ammo] = weapon2_ammo;
gPlayerSpawn[playerid][e_sWeapon3] = weapon3;
gPlayerSpawn[playerid][e_sWeapon3_Ammo] = weapon3_ammo;
return SetSpawnInfo(playerid, team, skin, x, y, z, rotation,
weapon1, weapon1_ammo, weapon2, weapon2_ammo, weapon3, weapon3_ammo);
}
#if defined _ALS_SetSpawnInfo
#undef SetSpawnInfo
#else
#define _ALS_SetSpawnInfo
#endif
#define SetSpawnInfo SpawnInfo_SetSpawnInfo
/*
OnPlayerConnect
*/
public OnPlayerConnect(playerid)
{
gPlayerSpawn[playerid][e_sIsUsed] = false;
#if defined SpawnInfo_OnPlayerConnect
return SpawnInfo_OnPlayerConnect(playerid);
#else
return 1;
#endif
}
#if defined _ALS_OnPlayerConnect
#undef OnPlayerConnect
#else
#define _ALS_OnPlayerConnect
#endif
#define OnPlayerConnect SpawnInfo_OnPlayerConnect
#if defined SpawnInfo_OnPlayerConnect
forward SpawnInfo_OnPlayerConnect(playerid);
#endif
/*
OnPlayerRequestClass
*/
public OnPlayerRequestClass(playerid, classid)
{
if (!gPlayerSpawn[playerid][e_sIsUsed]) {
gPlayerSpawn[playerid] = gPlayerClass[classid];
}
#if defined SpawnInfo_OnPlayerRequestClass
return SpawnInfo_OnPlayerRequestClass(playerid, classid);
#else
return 1;
#endif
}
#if defined _ALS_OnPlayerRequestClass
#undef OnPlayerRequestClass
#else
#define _ALS_OnPlayerRequestClass
#endif
#define OnPlayerRequestClass SpawnInfo_OnPlayerRequestClass
#if defined SpawnInfo_OnPlayerRequestClass
forward SpawnInfo_OnPlayerRequestClass(playerid, classid);
#endif
/*
GetSpawnInfo
*/
stock GetSpawnInfo(playerid, &team = NO_TEAM, &skin = 0,
&Float:x = 0.0, &Float:y = 0.0, &Float:z = 0.0, &Float:rotation = 0.0,
&weapon1 = 0, &weapon1_ammo = 0, &weapon2 = 0, &weapon2_ammo = 0, &weapon3 = 0, &weapon3_ammo = 0)
{
team = gPlayerSpawn[playerid][e_sTeam];
skin = gPlayerSpawn[playerid][e_sSkin];
x = gPlayerSpawn[playerid][e_sPosX];
y = gPlayerSpawn[playerid][e_sPosY];
z = gPlayerSpawn[playerid][e_sPosZ];
rotation = gPlayerSpawn[playerid][e_sRotation];
weapon1 = gPlayerSpawn[playerid][e_sWeapon1];
weapon1_ammo = gPlayerSpawn[playerid][e_sWeapon1_Ammo];
weapon2 = gPlayerSpawn[playerid][e_sWeapon2];
weapon2_ammo = gPlayerSpawn[playerid][e_sWeapon2_Ammo];
weapon3 = gPlayerSpawn[playerid][e_sWeapon3];
weapon3_ammo = gPlayerSpawn[playerid][e_sWeapon3_Ammo];
}