21.07.2014, 14:09
(
Последний раз редактировалось Virtual1ty; 21.07.2014 в 17:34.
Причина: completely missed out on the second dimension
)
I'm on a tablet ATM but I'll try.
EDIT: finally.
I apologise for any indentation mistakes!
EDIT: finally.
pawn Код:
#define MAX_PVEH (10) // max vehicles a player can spawn
new
gPlayerVeh[MAX_PLAYERS][MAX_PVEH],
gVehsSpawned[MAX_PLAYERS]
;
// in create cmd:
new idx = gVehsSpawned[playerid];
if (idx >= MAX_PVEH) return SCM(playerid, -1, "Can't create any more vehicles - max reached! (10)");
// but beware: if you do not plan on deleting every vehicle this 'idx' stuff won't work
// as planned - you would have to write a 'GetFreeSlot" function..
gPlayerVeh[playerid][idx] = CreateVehicle(...);
gVehsSpawned[playerid]++;
// under OnPlayerDeath:
for (new i; i < MAX_PVEH; i++)
{
if (IsValidVehicle(gPlayerVeh[playerid][i]))
{
DestroyVehicle(gPlayerVeh[playerid][i]);
gPlayerVeh[playerid][i] = INVALID_VEHICLE_ID;
gVehsSpawned[playerid]--;
}
}