Hallo,
ich will meine Vehicles spawnen lassen und dabei an bestimmten Farzugen die einen bestimmten Datenwert in der Datenbank haben ein 3D Textlabel ranhägen.
So, problem ist das es die Vehicles vertauscht, ein Copvehicle ist auf einmal ein Admin vehicle u.s.w
Ich finde irgendwie die Fehler nicht. Kann da mal einer bitte drüber schauen?
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;
}