Code
enum pVehicle_BuyData
{
modelid,
Name[35],
Preis,
Level,
Float:aPosx,
Float:aPosy,
Float:aPosz,
Float:aPosa,
Float:buySpawnX,
Float:buySpawnY,
Float:buySpawnZ,
Float:buySpawnA
}
Alles anzeigen
Hey,
Ich wollte mal fragen wie man Fahrzeug Kauf mit Level begrenzen kann heißt:
Sultan z.b ab Level 6.
Würd ich mir darunter Vorstellen:
Heißt mit im Enum intigrieren.
new VehicleShop[][pVehicle_BuyData] =
{
// modelid, Name[35], Preis, Level, Float:aPosx, Float:aPosy, Float:aPosz, Float:aPosa, Float:buySpawnX, Float:buySpawnY, Float:buySpawnZ, Float:buySpawnA
{411, "Infernus", 5000, 6, 1658.3048, -1899.2352, 13.2792, 34.5660, 1634.1624, -1904.8958, 13.2569, 313.9601},
{451, "Turismo", 5000, 6, 1663.2457, -1894.6740, 13.2546, 37.2904, 1634.1624, -1904.8958, 13.2569, 313.9601},
{560, "Sultan", 5000, 6, 1668.1372, -1890.4473, 13.2529, 40.2299, 1634.1624, -1904.8958, 13.2569, 313.9601}
};
OnDialogRespawnse -> Heißt wen er sich das Fahrzeug käuft.
Code
case DIALOG_BUYPRIVATEVEHICLE:
{
new string[128];
if(!response)
{
SetCameraBehindPlayer(playerid);
UnfreezePlayer(playerid);
RemovePlayerFromVehicle(playerid);
GetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(GetPlayerVehicleID(playerid), VEHICLE_PARAMS_OFF, VEHICLE_PARAMS_OFF, alarm, doors, bonnet, boot, objective);
return 1;
}
if(response)
{
for(new i=0;i<sizeof(autoVehicles);i++)
{
if(GetPlayerVehicleID(playerid) == autoVehicles[i])
{
if((GetMoney(playerid) - VehicleShop[i][Preis]) < 0)
{
SendClientMessage(playerid, COLOR_WHITE, ERROR_MONEY);
SetCameraBehindPlayer(playerid);
UnfreezePlayer(playerid);
RemovePlayerFromVehicle(playerid);
GetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(GetPlayerVehicleID(playerid), VEHICLE_PARAMS_OFF, VEHICLE_PARAMS_OFF, alarm, doors, bonnet, boot, objective);
return 1;
}
if(GetPlayerVehicleCount(playerid) >= MAX_PLAYER_VEHICLES)
{
SendClientMessage(playerid, COLOR_WHITE, "Du kannst keine weiteren Fahrzeuge kaufen!");
SetCameraBehindPlayer(playerid);
UnfreezePlayer(playerid);
RemovePlayerFromVehicle(playerid);
GetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(GetPlayerVehicleID(playerid), VEHICLE_PARAMS_OFF, VEHICLE_PARAMS_OFF, alarm, doors, bonnet, boot, objective);
return 1;
}
new playerName[MAX_PLAYER_NAME+1], nPlate[32];
GetPlayerName(playerid, playerName, sizeof(playerName));
format(nPlate, sizeof(nPlate), "%c%c 1%d", toupper(playerName[0]), toupper(playerName[1]), randomex(10000, 99999));
GiveMoney(playerid, -VehicleShop[i][Preis]);
format(string, sizeof(string), "{33CCFF}Dein Fahrzeug (%s) steht am Autohaus bereit.", VehicleShop[i][Name]);
SendClientMessage(playerid, COLOR_WHITE, string);
CreatePlayerVehicle(playerid, VehicleShop[i][modelid], VehicleShop[i][buySpawnX], VehicleShop[i][buySpawnY], VehicleShop[i][buySpawnZ], VehicleShop[i][buySpawnA], nPlate, (VehicleShop[i][Preis]/2), 0, 1, 1);
SetCameraBehindPlayer(playerid);
UnfreezePlayer(playerid);
RemovePlayerFromVehicle(playerid);
GetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(GetPlayerVehicleID(playerid), VEHICLE_PARAMS_OFF, VEHICLE_PARAMS_OFF, alarm, doors, bonnet, boot, objective);
return 1;
}
}
}
}
Alles anzeigen