spawn vehicles with labels fail?!
#1

Hello,
i will spawn vehicles with 3dlabels.
The problem is, i create in my database a fiels "VehicleTypes" to differentiate the vehicles.
Now, the labels are false, it shows many vehicles with false Labels like Copvehicle = Admin vehciles.
Many shop vehicles have other Labels. I think there is any mistake in my loops.
can anyone help?

Код:
enum Fahrzeuge
{
	fvID,
	fvModel,
	Float:fvX,
	Float:fvY,
	Float:fvZ,
	Float:fvA,
	fvColor1,
	fvColor2,
	fvType,
//Vehicle Types
//0 = Standart
//1 = Grьn
//2 = Lila
//3 = Gelb
//100 = Admin
//101 = Polizei
//10 = CarShop 1
//11 = CarShop 2
	fvPaintjob,
	fvPrice,
	fvLocked,
	fvNeon,
	fvBesitzer[MAX_PLAYER_NAME]
}
Код:
public OnVehicleSpawn(vehicleid)
{
	for(new i; i < MAX_VEHICLES; i++)
	{
		if(Vehicles[i][fvType] == 10)
		{
			Admin3DText[i] = Create3DTextLabel( "Shop Vehicle", 0xB70000FF, 0.0, 0.0, 0.0, 50.0, 0, 1 );
			Attach3DTextLabelToVehicle( Admin3DText[i] , i, 0.0, 0.0, 1.3);
		}
		else if(Vehicles[i][fvType] == 100)
		{
			Admin3DText[i] = Create3DTextLabel( "Admin Vehicle", 0xB70000FF, 0.0, 0.0, 0.0, 50.0, 0, 1 );
			Attach3DTextLabelToVehicle( Admin3DText[i] , i, 0.0, 0.0, 1.3);
		}
		else if(Vehicles[i][fvType] == 101)
		{
			Admin3DText[i] = Create3DTextLabel( "Cop Vehicle", 0xB70000FF, 0.0, 0.0, 0.0, 50.0, 0, 1 );
			Attach3DTextLabelToVehicle( Admin3DText[i] , i, 0.0, 0.0, 1.3);
		}
		SetVehicleNumberPlate(i,"Thug Life");
		SetVehicleHealth(i, 999.0);
	}

...
	return 1;
}
Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
	if(newstate == PLAYER_STATE_DRIVER)
	{
  		if(Vehicles[GetPlayerVehicleID(playerid)][fvType] == 10)
		{
			 SendClientMessage(playerid, green, "{FF0000}[SERVER] {FFFFFF}Du kannst dir das Fahzeug mit /buyvehicle kaufen");
		}
		else if(Vehicles[GetPlayerVehicleID(playerid)][fvType] == 11)
		{
			SendClientMessage(playerid, green, "{FF0000}[SERVER] {FFFFFF}Du kannst dir das Fahzeug mit /buyvehicle kaufen");
		}
 	}

	if(newstate == PLAYER_STATE_DRIVER)
	{
		if((Vehicles[GetPlayerVehicleID(playerid)][fvType] == 100) && SpielerInfo[playerid][pAdmin] <= 0)
		{
			RemovePlayerFromVehicle(playerid);
			SendClientMessage(playerid, red, "{FF0000}[SERVER] {FFFFFF}Du bist leider kein Admin");
		}
 	}

	if(newstate == PLAYER_STATE_DRIVER)
	{
		if((Vehicles[GetPlayerVehicleID(playerid)][fvType] == 101) && SpielerInfo[playerid][pCop] <= 0)
		{
			RemovePlayerFromVehicle(playerid);
			SendClientMessage(playerid, red, "{FF0000}[SERVER] {FFFFFF}Du bist leider kein Cop");
		}
 	}

...
return 1;
Код:
stock LoadVehicles()
{
	new ID = 1, String[100];
	while(ID < 500)
	{
		format(String, sizeof(String), "%d", ID);
		Vehicles[ID][fvID] = mysql_GetInt("Vehicles", "ID", "ID", String);
		Vehicles[ID][fvModel] = mysql_GetInt("Vehicles", "VehicleModel", "ID", String);
		Vehicles[ID][fvX] = mysql_GetFloat("Vehicles", "VehicleX", "ID", String);
		Vehicles[ID][fvY] = mysql_GetFloat("Vehicles", "VehicleY", "ID", String);
		Vehicles[ID][fvZ] = mysql_GetFloat("Vehicles", "VehicleZ", "ID", String);
		Vehicles[ID][fvA] = mysql_GetFloat("Vehicles", "VehicleAngle", "ID", String);
		Vehicles[ID][fvColor1] = mysql_GetInt("Vehicles", "Color1", "ID", String);
		Vehicles[ID][fvColor2] = mysql_GetInt("Vehicles", "Color2", "ID", String);
		Vehicles[ID][fvType] = mysql_GetInt("Vehicles", "VehicleType", "ID", String);
		Vehicles[ID][fvPaintjob] = mysql_GetInt("Vehicles", "Paintjob", "ID", String);
		Vehicles[ID][fvPrice] = mysql_GetInt("Vehicles", "Price", "ID", String);
		Vehicles[ID][fvLocked] = mysql_GetInt("Vehicles", "Locked", "ID", String);
   		Vehicles[ID][fvNeon] = mysql_GetInt("Vehicles", "Neon", "ID", String);
		format(Vehicles[ID][fvBesitzer], MAX_PLAYER_NAME, mysql_GetString("Vehicles", "Besitzer", "ID", String));
		if(strlen(Vehicles[ID][fvType]) < 999)
		{
			Vehicles[ID][fvID] = AddStaticVehicleEx(Vehicles[ID][fvModel], Vehicles[ID][fvX], Vehicles[ID][fvY], Vehicles[ID][fvZ], Vehicles[ID][fvA], Vehicles[ID][fvColor1], Vehicles[ID][fvColor2], (5*60));
			SetVehicleHealth(Vehicles[ID][fvID], 999.0);
  }
		ID++;
	}
	printf("--> %i Vehicles Loaded FromMySQL", ID);
	return 1;
}
Reply
#2

any idea....?
Reply
#3

push ned help
Reply
#4

helpp
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)