Nabend Leute,
ich habe das Problem, dass wenn ich ein Fraktionsauto abschließen möchte, dies entweder die Server Konsole vollspammt oder sagt dass dieses Fahrzeug nicht zu meiner Fraktion gehört.
Das ganze System ist nach diesem Tutorial aufgebaut: [jTut]Fraktions-Fahrzeug System.
Danke im Voraus.
Der Flock Befehl:
Code
ocmd:flock(playerid,params[])
{
if(!IsPlayerOnline(playerid))return SendClientMessage(playerid,Rot,NotOnlineMSG);
if(!GetPlayerFrak(playerid))return SendClientMessage(playerid,Rot,"Error"#cWeiß": You ar not in any Fraction.");
new engine,lights,alarm,doors,bonnet,boot,objective;
if(IsPlayerInAnyVehicle(playerid))
{
new vID = GetPlayerVehicleID(playerid);
GetVehicleParamsEx(vID,engine,lights,alarm,doors,bonnet,boot,objective);
if(FracVehicle[vID][f_fracID] == GetPlayerFrak(playerid))
{
if(!LockState[vID])
{
SetVehicleParamsEx(vID,engine,lights,alarm,VEHICLE_PARAMS_ON,bonnet,boot,objective);
LockState[vID] = true;
SendClientMessage(playerid,Weiß,"["#cGelb"SInfo"#cWeiß"] You have locked your Vehicle.");
return 1;
}
else
{
SetVehicleParamsEx(vID,engine,lights,alarm,VEHICLE_PARAMS_OFF,bonnet,boot,objective);
LockState[vID] = false;
SendClientMessage(playerid,Weiß,"["#cGelb"SInfo"#cWeiß"] You have unlocked your Vehicle.");
return 1;
}
}
return SendClientMessage(playerid,Rot,"Error"#cWeiß": This Car doesn't belong to your Fraction.");
}
else
{
for(new v=0;v<MAX_VEHICLES;v++)
{
new Float:x,Float:y,Float:z;
for(new f=0;f<MAX_FRAC_VEHICLES;f++)
{
GetVehiclePos(f,x,y,z);
printf("1");
printf("VehicleID = %i | FracVehicleID = %i |PosX: %f |PosY: %f |PosZ: %f",v,f,x,y,z);
if(!IsPlayerInRangeOfPoint(playerid,3.00,x,y,z))continue;
{
printf("2");
if(v != FracVehicle[f][f_vID])continue;
{
printf("3");
if(FracVehicle[f][f_fracID] != GetPlayerFrak(playerid))continue;
{
printf("4");
if(!LockState[f])
{
printf("5.1");
SetVehicleParamsEx(f,engine,lights,alarm,VEHICLE_PARAMS_ON,bonnet,boot,objective);
LockState[f] = true;
SendClientMessage(playerid,Weiß,"["#cGelb"SInfo"#cWeiß"] You have locked your Vehicle.");
return 1;
}
else
{
printf("5.2");
SetVehicleParamsEx(f,engine,lights,alarm,VEHICLE_PARAMS_OFF,bonnet,boot,objective);
LockState[f] = false;
SendClientMessage(playerid,Weiß,"["#cGelb"SInfo"#cWeiß"] You have unlocked your Vehicle.");
return 1;
}
}
}
}
}
}
}
return SendClientMessage(playerid,Rot,"Error"#cWeiß": You aren't close to any Fraction Vehicle.");
}
Alles anzeigen
So werden die Fahrzeuge aus der Datenbank ausgeladen:
Code
public LoadFracVehicles_Data()
{
new rows;
rows = cache_num_rows();
for(new i=0;i<rows;i++)
{
FracVehicle[i][f_modelID] = cache_get_field_content_int(i, "Modelid");
FracVehicle[i][f_x] = cache_get_field_content_float(i, "PosX");
FracVehicle[i][f_y] = cache_get_field_content_float(i, "PosY");
FracVehicle[i][f_z] = cache_get_field_content_float(i, "PosZ");
FracVehicle[i][f_a] = cache_get_field_content_float(i, "PosA");
FracVehicle[i][f_color1] = cache_get_field_content_int(i, "Color1");
FracVehicle[i][f_color2] = cache_get_field_content_int(i, "Color2");
FracVehicle[i][f_fracID] = cache_get_field_content_int(i, "Fracid");
if(FracVehicle[i][f_modelID] >= 400 && FracVehicle[i][f_modelID] <= 611)
{
FracVehicle[i][f_vID] = CreateVehicle(FracVehicle[i][f_modelID],FracVehicle[i][f_x],FracVehicle[i][f_y],FracVehicle[i][f_z],FracVehicle[i][f_a],FracVehicle[i][f_color1],FracVehicle[i][f_color2], -1);
LockVehicle(FracVehicle[i][f_vID]);
}
else
{
printf("[Error] FractionVehicle Model-ID %d doesn't exist (ID: %d).",FracVehicle[i][f_modelID],i);
}
if(GetVehicleModel(MAX_VEHICLES-1) != 0)return print("The Limit of Max Vehicles is reached.");
if(i == MAX_FRAC_VEHICLES-1)return print("The Limit of Max Frac Vehicles is reached.");
}
return 1;
}
Alles anzeigen