26.03.2013, 18:46
So i made a dealership parking lot and whenever I get onto the vehicle to buy it.
I just want to be able to set the price for each individual vehicle.
I don't know if this is an ingame Command or what?
Heres some lines of coding that i think may be helpful.
(I have a friend helping me through coding certain things but he's never done a dealership)
I just want to be able to set the price for each individual vehicle.
I don't know if this is an ingame Command or what?
Heres some lines of coding that i think may be helpful.
(I have a friend helping me through coding certain things but he's never done a dealership)
Код:
case DIALOG_BUYCAR: { if (!response) return RemovePlayerFromVehicle(playerid); if(response) { new car, str[126], ownedcar; car = GetVehicleModel(GetPlayerVehicleID(playerid)); for(new x;x<MAX_PLAYER_VEHICLES;x++) { if(GetVehicleCost(car) == -1) { SendClientMessage(playerid, -1, "Default price has not been changed yet, you can not buy this vehicle."); RemovePlayerFromVehicle(playerid); return 1; } if(PlayerInfo[playerid][pVehicle][x] == 0) { new rand = random(255), rand2 = random(255); if(PlayerInfo[playerid][pCash] < GetVehicleCost(car)) { SendClientMessage(playerid, -1, "You don't have enough cash."); RemovePlayerFromVehicle(playerid); return 1; } PlayerInfo[playerid][pVehicle][x] = car; PlayerInfo[playerid][pCash] -= GetVehicleCost(car); SetVehicleToRespawn(GetPlayerVehicleID(playerid)); RemovePlayerFromVehicle(playerid); PlayerInfo[playerid][pVehicleSpawned][x] = 1; PlayerInfo[playerid][pVehiclePosX][x] = 555.87; PlayerInfo[playerid][pVehiclePosY][x] = -1265.16; PlayerInfo[playerid][pVehiclePosZ][x] = 17.24; PlayerInfo[playerid][pVehicleCol1][x] = rand; PlayerInfo[playerid][pVehicleCol1][x] = rand2; ownedcar = CreateVehicle(car, PlayerInfo[playerid][pVehiclePosX][x], PlayerInfo[playerid][pVehiclePosY][x], PlayerInfo[playerid][pVehiclePosZ][x], 0, rand, rand2, 0); PlayerInfo[playerid][pVehicleSpawnedID][x] = ownedcar; PutPlayerInVehicle(playerid, ownedcar, 0); format(str, sizeof(str), "MoneyTrace: %s bought a car (MID: %i) for %i.", GetName(playerid), car, GetVehicleCost(car)); Log("/logs/moneytrace.txt", str); format(str, sizeof(str), "You bought a car for %i. (%i)", GetVehicleCost(car), ownedcar); SendClientMessage(playerid, -1, str); new plate[126]; format(plate, sizeof(plate), "LS%i", ownedcar); SetVehicleNumberPlate(ownedcar, plate); break; } } } }