Hi leute, habe mal frage udn zwar wenn ich /veh car id mache und dann mti /savecarspawen mache kommt nach Server restart 2 autos? warum? Es soll ja eiglich nur 1 auto sein.
if(strcmp(cmd, "/veh", true) == 0)
{
if(PlayerInfo[playerid][pAdmin]>=2)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_RED, "BENUTZUNG: /veh [modelid(400-611)]");
return 1;
}
new carid, Float:x, Float:y, Float:z, Float:angle, pname[MAX_PLAYER_NAME], string[50];
GetPlayerPos(playerid, x,y,z);
GetPlayerFacingAngle(playerid, angle);
carid = strval(tmp);
if(IsValidVehicle(carid))
{
GetPlayerName(playerid,pname,sizeof(pname));
new id = CreateStreamVehicle(carid, (x+3),y,z,angle,0,0,-1);
CarInfo[id][cID] = id;
CarInfo[id][cLocked][playerid] = 0;
CarInfo[id][cGas] = 1000;
CarInfo[id][cMeter]=0;
CarInfo[id][cHP]=1000.0;
CarInfo[id][cMaxGas]=1000;
strmid(CarInfo[id][cOwner], pname,0, sizeof(pname)-1, MAX_PLAYER_NAME);
CarInfo[id][cModel] = carid;
CarInfo[id][cX] = x;
CarInfo[id][cY] = y;
CarInfo[id][cZ] = z;
CarInfo[id][cAngle] = angle;
CarInfo[id][cColor1] = 0;
CarInfo[id][cColor2] = 0;
strmid(CarInfo[id][cKennzeichen], "Veh", 0 , 12, 12);
CarInfo[id][cType]=0;
CarInfo[id][carsfbumper] = 0;
CarInfo[id][carsfbbars] = 0;
CarInfo[id][carsrbumper] = 0;
CarInfo[id][carsrbbars] = 0;
CarInfo[id][carswheels] = 0;
CarInfo[id][carslskirt] = 0;
CarInfo[id][carsrskirt] = 0;
CarInfo[id][carshydros] = 0;
CarInfo[id][carsroof] = 0;
CarInfo[id][carshood] = 0;
CarInfo[id][carsexhaust] = 0;
CarInfo[id][carslights] = 0;
CarInfo[id][carsstereo] = 0;
CarInfo[id][carsnitro] = 0;
CarInfo[id][cTuned] = 0;
SaveCar(id);
format(string, sizeof(string), "CarID %d gespawnt!", CarInfo[id][cID]);
SendClientMessage(playerid, COLOR_YELLOW, string);
}
else
{
SendClientMessage(playerid, COLOR_RED, "IDs von 400 bis 611 sind nur erlaubt!");
}
}
return 1;
}
if(strcmp(cmd, "/savecarspawn", true) == 0)
{
if(IsPlayerInAnyVehicle(playerid))
{
new pname[MAX_PLAYER_NAME];
new vehicleid = GetPlayerVehicleID(playerid);
new model = GetVehicleModel(vehicleid);
GetPlayerName(playerid, pname, sizeof(pname));
if(strcmp(CarInfo[vehicleid][cOwner], pname, true) == 0 || PlayerInfo[playerid][pAdmin]>=3)
{
new szString[80], Float:x, Float:y, Float:z, Float:angle;
GetVehiclePos(vehicleid, x,y,z);
GetVehicleZAngle(vehicleid, angle);
CarInfo[vehicleid][cModel] = model;
CarInfo[vehicleid][cX] = x;
CarInfo[vehicleid][cY] = y;
CarInfo[vehicleid][cZ] = z;
CarInfo[vehicleid][cAngle] = angle;
SaveCar(vehicleid);
format(szString, sizeof(szString), "Der Spawnpunkt für dieses Fahrzeug wurde geändert!");
SendClientMessage(playerid, COLOR_YELLOW, szString);
LoadCar(vehicleid);
CreateStreamVehicle(CarInfo[vehicleid][cModel], CarInfo[vehicleid][cX], CarInfo[vehicleid][cY], CarInfo[vehicleid][cZ], CarInfo[vehicleid][cAngle], CarInfo[vehicleid][cColor1], CarInfo[vehicleid][cColor2], -1);
SetVehicleNumberPlate(vehicleid, CarInfo[vehicleid][cKennzeichen]);
SetVehicleToRespawn(vehicleid);
}
else
{
SendClientMessage(playerid, COLOR_YELLOW, "Du bist nicht der Besitzer dieses Fahrzeuges!");
}
}
return 1;
}