28.05.2013, 13:54
pawn Код:
new spawnedVeh[MAX_VEHICLES];
// ongamemodeinit, or onfilterscriptinit:
for(new i = 0; i < MAX_VEHICLES; i++) spawnedVeh[MAX_VEHICLES] = 0;
CMD:veh(playerid, params[])
{
new aVehicle[64];
new Color1;
new Color2;
new string[200];
if(sscanf(params, "s[64]I(-1)I(-1)", aVehicle, Color1, Color2)) return SCM(playerid, COLOR_GREY, "[USAGE]: /veh [carid/name][color1] [color2]");
new veh = GetVehicleModelID(aVehicle);
if(veh < 400 || veh > 611) return SCM(playerid, COLOR_RED, "[ERROR]: Invalid Vehicle model! (400-611)");
new Float:Pos[4];
GetPlayerPos(playerid, Pos[0],Pos[1],Pos[2]);
GetPlayerFacingAngle(playerid, Pos[3]);
new PVeh = CreateVehicle(veh, Pos[0], Pos[1], Pos[2], Pos[3]+90, Color1, Color2, -1);
spawnedVeh[PVeh] = 1;
LinkVehicleToInterior(PVeh, GetPlayerInterior(playerid));
SetVehicleVirtualWorld(PVeh, GetPlayerVirtualWorld(playerid));
format(string, sizeof(string), "{80FF00}[Admin]:{400080} %s(ID:%d) has spawned %s(ID:%d) to him!", GetName(playerid), playerid, aVehicle, veh);
SCMToAll(COLOR_PURPLE, string);
return 1;
}
CMD:deleteveh(playerid)
{
for(new i = 0; i < MAX_VEHICLES; i++)
{
if(spawnedVeh[i] == 1)
{
spawnedVeh[i] = 0;
DestroyVehicle(i);
}
}
return 1;
}