Habs bei mir so (muss angepasst werden!)
forward IsASpawnedCar(carid);
new SpawnedCar[MAX_VEHICLES];
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmd, "/veh", true) == 0 || strcmp(cmd, "/v", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] >= 1337)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "Benutze: [/v]eh [carid] [color1] [color2]");
return 1;
}
new car;
car = strval(tmp);
if(car < 400 || car > 611) { SendClientMessage(playerid, COLOR_RED, "AutoID kann nur wischen 400 und 611 sein!"); return 1; }
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "Benutze: [/v]eh [carid] [color1] [color2]");
return 1;
}
new color1;
color1 = strval(tmp);
if(color1 < 0 || color1 > 200000000) { SendClientMessage(playerid, COLOR_RED, "FarbID kann nur zwischen 1 und 200 sein!"); return 1; }
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "Benutze: [/v]eh [carid] [color1] [color2]");
return 1;
}
new color2;
color2 = strval(tmp);
if(color2 < 0 || color2 > 200) { SendClientMessage(playerid, COLOR_RED, "FarbID kann nur zwischen 1 und 200 sein!"); return 1; }
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid, X,Y,Z);
new carid = CreateVehicle(car, X,Y,Z, 0.0, color1, color2, 60000);
SpawnedCar[vehnumber] = carid;
vehnumber += 1;
CreatedCars[CreatedCar] = carid;
CreatedCar ++;
format(string, sizeof(string), "Fahrzeug %d spawned.", carid);
SendClientMessage(playerid, COLOR_GREY, string);
GetPlayerName(playerid, sendername, sizeof(sendername));
SetVehicleNumberPlate(carid,"SpawnedCar");
format(string, 256, "[ADMIN]: %s hat sich ein Auto gespawnt: %d.", sendername,car);
ABroadCast(COLOR_LIGHTRED,string,1);
Tank[carid] = 100;
}
}
return 1;
}
if(strcmp(cmd,"/desspawned",true) == 0)
{
if(PlayerInfo[playerid][pAdmin] >= 4)
{
format(string,sizeof(string),"[ADMIN]: %s(%d) hat alle gespawnten Fahrzeuge zerstört.",sendername,playerid);
SendAdminMessage(COLOR_YELLOW, string);
for(new v=0; v<MAX_VEHICLES; v++)
{
if(IsASpawnedCar(v))
{
DestroyVehicle(v);
SpawnedCar[v] = 0;
}
}
}
return 1;
}
}
public IsASpawnedCar(carid)
{
for(new i = 0; i < sizeof(SpawnedCar); i++)
{
if(carid == SpawnedCar[i])
{
return 1;
}
}
return 0;
}