16.04.2011, 13:47
(
Последний раз редактировалось sMog.; 17.04.2011 в 15:24.
)
Hello how to edit this like if you have score about 100 you can buy on car if 300 you can buy 2 cars and so on full table:
1. = 100
2. = 100 + 200 = 300
3. = 300 + 300 = 600
4. = 600 + 400 = 1000
5. = 1000 + 500 = 1500
6. = 1500 + 600 = 2100
7. = 2100 + 700 = 2800
8. = 2800 + 800 = 3600
9. = 3600 + 900 = 4500
10. = 4500 + 1000 = 5500
11. = 5500 + 1100 = 6600
12. = 6600 + 1200 = 7800
13. = 7800 + 1300 = 9100
14. = 9100 + 1400 = 10500
15. = 10500 + 1500 = 12000
EDIT: i added whole buycar
edit 2 is this right ?
Or i must edit this ?
1. = 100
2. = 100 + 200 = 300
3. = 300 + 300 = 600
4. = 600 + 400 = 1000
5. = 1000 + 500 = 1500
6. = 1500 + 600 = 2100
7. = 2100 + 700 = 2800
8. = 2800 + 800 = 3600
9. = 3600 + 900 = 4500
10. = 4500 + 1000 = 5500
11. = 5500 + 1100 = 6600
12. = 6600 + 1200 = 7800
13. = 7800 + 1300 = 9100
14. = 9100 + 1400 = 10500
15. = 10500 + 1500 = 12000
EDIT: i added whole buycar
PHP код:
stock buycar(playerid)
{
new string[128];
if(VehicleInfo[GetPlayerVehicleID(playerid)][Temp] == 1) {
return SendClientMessage(playerid, COLOR_ORANGE, "This vehicle is only temporary and some commands may not work!");
}
if(PlayerInfo[playerid][LoggedIn] == 0) {
SendClientMessage(playerid, COLOR_BRIGHTRED, "You must be logged in to use this feature");
return 1;
}
if(PlayerInfo[playerid][Jailed] == 1) {
SendClientMessage(playerid, COLOR_BRIGHTRED, "You are in jail and cannot use this feature");
return 1;
}
if(passenger[playerid] == 1) {
SendClientMessage(playerid, COLOR_BRIGHTRED, "You must be in the drivers' seat of this vehicle to buy it!");
return 1;
}
if(IsPlayerInAnyVehicle(playerid) == 0) {
SendClientMessage(playerid, COLOR_BRIGHTRED, "You must be in a vehicle in order to buy one!");
return 1;
}
if(VehicleInfo[GetPlayerVehicleID(playerid)][buybar] == 1) {
SendClientMessage(playerid, COLOR_BRIGHTRED, "This vehicle is currently set as un-buyable!");
return 1;
}
if (strcmp(VehicleInfo[GetPlayerVehicleID(playerid)][owner],PlayerInfo[playerid][name],false) == 0) {
format(string, sizeof(string), "You already own this %s, %s", VehicleInfo[GetPlayerVehicleID(playerid)][name], PlayerInfo[playerid][name]);
SendClientMessage(playerid, COLOR_BRIGHTRED, string);
return 1;
}
if(VehicleInfo[GetPlayerVehicleID(playerid)][bought] == 1) {
format(string, sizeof(string), "This %s is owned by %s, and is not for sale!", VehicleInfo[GetPlayerVehicleID(playerid)][name], VehicleInfo[GetPlayerVehicleID(playerid)][owner]);
SendClientMessage(playerid, COLOR_BRIGHTRED, string);
return 1;
}
if((PlayerInfo[playerid][vowner] == 1) && (PlayerInfo[playerid][vowner2] == 1) && (PlayerInfo[playerid][vowner3] == 1) && (PlayerInfo[playerid][vowner4] == 1) && (PlayerInfo[playerid][vowner5] == 1) && (PlayerInfo[playerid][vowner6] == 1) && (PlayerInfo[playerid][vowner7] == 1) && (PlayerInfo[playerid][vowner8] == 1)){
if((PlayerInfo[playerid][vowner9] == 1) && (PlayerInfo[playerid][vowner10] == 1) && (PlayerInfo[playerid][vowner11] == 1) && (PlayerInfo[playerid][vowner12] == 1) && (PlayerInfo[playerid][vowner13] == 1) && (PlayerInfo[playerid][vowner14] == 1) && (PlayerInfo[playerid][vowner15] == 1)) {
SendClientMessage(playerid, COLOR_BRIGHTRED, "You can only own FIFTEEN vehicles at a time! You must sell one other vehicle first!");
return 1;
}
}
new cash[MAX_PLAYERS];
cash[playerid] = GetPlayerMoney(playerid);
if(cash[playerid] >= VehicleInfo[GetPlayerVehicleID(playerid)][vehiclecost]) {
new stringa[128];
strmid(VehicleInfo[GetPlayerVehicleID(playerid)][owner], PlayerInfo[playerid][name], 0, strlen(PlayerInfo[playerid][name]), 255);
VehicleInfo[GetPlayerVehicleID(playerid)][bought] = 1;
if(PlayerInfo[playerid][vowner] == 0){
PlayerInfo[playerid][vowner] = 1;
PlayerInfo[playerid][vowned] = GetPlayerVehicleID(playerid);
format(stringa, sizeof(stringa), "You just bought this %s for $%d. In Car Calling Slot #1", VehicleInfo[GetPlayerVehicleID(playerid)][name], VehicleInfo[GetPlayerVehicleID(playerid)][vehiclecost],VehicleInfo[GetPlayerVehicleID(playerid)][name]);
SendClientMessage(playerid, COLOR_GREEN, stringa);
}
else if(PlayerInfo[playerid][vowner2] == 0){
PlayerInfo[playerid][vowner2] = 1;
PlayerInfo[playerid][vowned2] = GetPlayerVehicleID(playerid);
format(stringa, sizeof(stringa), "You just bought this %s for $%d. In Car Calling Slot #2", VehicleInfo[GetPlayerVehicleID(playerid)][name], VehicleInfo[GetPlayerVehicleID(playerid)][vehiclecost],VehicleInfo[GetPlayerVehicleID(playerid)][name]);
SendClientMessage(playerid, COLOR_GREEN, stringa);
}
else if(PlayerInfo[playerid][vowner3] == 0){
PlayerInfo[playerid][vowner3] = 1;
PlayerInfo[playerid][vowned3] = GetPlayerVehicleID(playerid);
format(stringa, sizeof(stringa), "You just bought this %s for $%d. In Car Calling Slot #3", VehicleInfo[GetPlayerVehicleID(playerid)][name], VehicleInfo[GetPlayerVehicleID(playerid)][vehiclecost],VehicleInfo[GetPlayerVehicleID(playerid)][name]);
SendClientMessage(playerid, COLOR_GREEN, stringa);
}
else if(PlayerInfo[playerid][vowner4] == 0){
PlayerInfo[playerid][vowner4] = 1;
PlayerInfo[playerid][vowned4] = GetPlayerVehicleID(playerid);
format(stringa, sizeof(stringa), "You just bought this %s for $%d. In Car Calling Slot #4", VehicleInfo[GetPlayerVehicleID(playerid)][name], VehicleInfo[GetPlayerVehicleID(playerid)][vehiclecost],VehicleInfo[GetPlayerVehicleID(playerid)][name]);
SendClientMessage(playerid, COLOR_GREEN, stringa);
}
else if(PlayerInfo[playerid][vowner5] == 0){
PlayerInfo[playerid][vowner5] = 1;
PlayerInfo[playerid][vowned5] = GetPlayerVehicleID(playerid);
format(stringa, sizeof(stringa), "You just bought this %s for $%d. In Car Calling Slot #5", VehicleInfo[GetPlayerVehicleID(playerid)][name], VehicleInfo[GetPlayerVehicleID(playerid)][vehiclecost],VehicleInfo[GetPlayerVehicleID(playerid)][name]);
SendClientMessage(playerid, COLOR_GREEN, stringa);
}
else if(PlayerInfo[playerid][vowner6] == 0){
PlayerInfo[playerid][vowner6] = 1;
PlayerInfo[playerid][vowned6] = GetPlayerVehicleID(playerid);
format(stringa, sizeof(stringa), "You just bought this %s for $%d. In Car Calling Slot #6", VehicleInfo[GetPlayerVehicleID(playerid)][name], VehicleInfo[GetPlayerVehicleID(playerid)][vehiclecost],VehicleInfo[GetPlayerVehicleID(playerid)][name]);
SendClientMessage(playerid, COLOR_GREEN, stringa);
}
else if(PlayerInfo[playerid][vowner7] == 0){
PlayerInfo[playerid][vowner7] = 1;
PlayerInfo[playerid][vowned7] = GetPlayerVehicleID(playerid);
format(stringa, sizeof(stringa), "You just bought this %s for $%d. In Car Calling Slot #7", VehicleInfo[GetPlayerVehicleID(playerid)][name], VehicleInfo[GetPlayerVehicleID(playerid)][vehiclecost],VehicleInfo[GetPlayerVehicleID(playerid)][name]);
SendClientMessage(playerid, COLOR_GREEN, stringa);
}
else if(PlayerInfo[playerid][vowner8] == 0){
PlayerInfo[playerid][vowner8] = 1;
PlayerInfo[playerid][vowned8] = GetPlayerVehicleID(playerid);
format(stringa, sizeof(stringa), "You just bought this %s for $%d. In Car Calling Slot #8", VehicleInfo[GetPlayerVehicleID(playerid)][name], VehicleInfo[GetPlayerVehicleID(playerid)][vehiclecost],VehicleInfo[GetPlayerVehicleID(playerid)][name]);
SendClientMessage(playerid, COLOR_GREEN, stringa);
}
else if(PlayerInfo[playerid][vowner9] == 0){
PlayerInfo[playerid][vowner9] = 1;
PlayerInfo[playerid][vowned9] = GetPlayerVehicleID(playerid);
format(stringa, sizeof(stringa), "You just bought this %s for $%d. In Car Calling Slot #9", VehicleInfo[GetPlayerVehicleID(playerid)][name], VehicleInfo[GetPlayerVehicleID(playerid)][vehiclecost],VehicleInfo[GetPlayerVehicleID(playerid)][name]);
SendClientMessage(playerid, COLOR_GREEN, stringa);
}
else if(PlayerInfo[playerid][vowner10] == 0){
PlayerInfo[playerid][vowner10] = 1;
PlayerInfo[playerid][vowned10] = GetPlayerVehicleID(playerid);
format(stringa, sizeof(stringa), "You just bought this %s for $%d. In Car Calling Slot #10", VehicleInfo[GetPlayerVehicleID(playerid)][name], VehicleInfo[GetPlayerVehicleID(playerid)][vehiclecost],VehicleInfo[GetPlayerVehicleID(playerid)][name]);
SendClientMessage(playerid, COLOR_GREEN, stringa);
}
else if(PlayerInfo[playerid][vowner11] == 0){
PlayerInfo[playerid][vowner11] = 1;
PlayerInfo[playerid][vowned11] = GetPlayerVehicleID(playerid);
format(stringa, sizeof(stringa), "You just bought this %s for $%d. In Car Calling Slot #11", VehicleInfo[GetPlayerVehicleID(playerid)][name], VehicleInfo[GetPlayerVehicleID(playerid)][vehiclecost],VehicleInfo[GetPlayerVehicleID(playerid)][name]);
SendClientMessage(playerid, COLOR_GREEN, stringa);
}
else if(PlayerInfo[playerid][vowner12] == 0){
PlayerInfo[playerid][vowner12] = 1;
PlayerInfo[playerid][vowned12] = GetPlayerVehicleID(playerid);
format(stringa, sizeof(stringa), "You just bought this %s for $%d. In Car Calling Slot #12", VehicleInfo[GetPlayerVehicleID(playerid)][name], VehicleInfo[GetPlayerVehicleID(playerid)][vehiclecost],VehicleInfo[GetPlayerVehicleID(playerid)][name]);
SendClientMessage(playerid, COLOR_GREEN, stringa);
}
else if(PlayerInfo[playerid][vowner13] == 0){
PlayerInfo[playerid][vowner13] = 1;
PlayerInfo[playerid][vowned13] = GetPlayerVehicleID(playerid);
format(stringa, sizeof(stringa), "You just bought this %s for $%d. In Car Calling Slot #13", VehicleInfo[GetPlayerVehicleID(playerid)][name], VehicleInfo[GetPlayerVehicleID(playerid)][vehiclecost],VehicleInfo[GetPlayerVehicleID(playerid)][name]);
SendClientMessage(playerid, COLOR_GREEN, stringa);
}
else if(PlayerInfo[playerid][vowner14] == 0){
PlayerInfo[playerid][vowner14] = 1;
PlayerInfo[playerid][vowned14] = GetPlayerVehicleID(playerid);
format(stringa, sizeof(stringa), "You just bought this %s for $%d. In Car Calling Slot #14", VehicleInfo[GetPlayerVehicleID(playerid)][name], VehicleInfo[GetPlayerVehicleID(playerid)][vehiclecost],VehicleInfo[GetPlayerVehicleID(playerid)][name]);
SendClientMessage(playerid, COLOR_GREEN, stringa);
}
else if(PlayerInfo[playerid][vowner15] == 0){
PlayerInfo[playerid][vowner15] = 1;
PlayerInfo[playerid][vowned15] = GetPlayerVehicleID(playerid);
format(stringa, sizeof(stringa), "You just bought this %s for $%d. In Car Calling Slot #15", VehicleInfo[GetPlayerVehicleID(playerid)][name], VehicleInfo[GetPlayerVehicleID(playerid)][vehiclecost],VehicleInfo[GetPlayerVehicleID(playerid)][name]);
SendClientMessage(playerid, COLOR_GREEN, stringa);
}
GivePlayerMoney(playerid, -VehicleInfo[GetPlayerVehicleID(playerid)][vehiclecost]);
SavePlayer(playerid);
return 1;
}
if(cash[playerid] < VehicleInfo[GetPlayerVehicleID(playerid)][vehiclecost]) {
new string6[129];
format(string6, sizeof(string6), "You do not have $%d and cannot afford this %s!", VehicleInfo[GetPlayerVehicleID(playerid)][vehiclecost],VehicleInfo[GetPlayerVehicleID(playerid)][name]);
SendClientMessage(playerid, COLOR_BRIGHTRED, string6);
return 1;
}
return 1;
}
PHP код:
new cash[MAX_PLAYERS];
cash[playerid] = GetPlayerMoney(playerid);
if(cash[playerid] >= VehicleInfo[GetPlayerVehicleID(playerid)][vehiclecost]) {
new stringa[128];
strmid(VehicleInfo[GetPlayerVehicleID(playerid)][owner], PlayerInfo[playerid][name], 0, strlen(PlayerInfo[playerid][name]), 255);
VehicleInfo[GetPlayerVehicleID(playerid)][bought] = 1;
if(PlayerInfo[playerid][vowner] == 0)|| GetPlayerscore(playerid) >= 100){
PlayerInfo[playerid][vowner] = 1;
PlayerInfo[playerid][vowned] = GetPlayerVehicleID(playerid);
format(stringa, sizeof(stringa), "You just bought this %s for $%d. In Car Calling Slot #1", VehicleInfo[GetPlayerVehicleID(playerid)][name], VehicleInfo[GetPlayerVehicleID(playerid)][vehiclecost],VehicleInfo[GetPlayerVehicleID(playerid)][name]);
SendClientMessage(playerid, COLOR_GREEN, stringa);
}
else if(PlayerInfo[playerid][vowner2] == 0)|| GetPlayerscore(playerid) >= 200){
PlayerInfo[playerid][vowner2] = 1;
PlayerInfo[playerid][vowned2] = GetPlayerVehicleID(playerid);
format(stringa, sizeof(stringa), "You just bought this %s for $%d. In Car Calling Slot #2", VehicleInfo[GetPlayerVehicleID(playerid)][name], VehicleInfo[GetPlayerVehicleID(playerid)][vehiclecost],VehicleInfo[GetPlayerVehicleID(playerid)][name]);
SendClientMessage(playerid, COLOR_GREEN, stringa);
}
Код:
if((PlayerInfo[playerid][vowner] == 1) && (PlayerInfo[playerid][vowner2] == 1) && (PlayerInfo[playerid][vowner3] == 1) && (PlayerInfo[playerid][vowner4] == 1) && (PlayerInfo[playerid][vowner5] == 1) && (PlayerInfo[playerid][vowner6] == 1) && (PlayerInfo[playerid][vowner7] == 1) && (PlayerInfo[playerid][vowner8] == 1)){ if((PlayerInfo[playerid][vowner9] == 1) && (PlayerInfo[playerid][vowner10] == 1) && (PlayerInfo[playerid][vowner11] == 1) && (PlayerInfo[playerid][vowner12] == 1) && (PlayerInfo[playerid][vowner13] == 1) && (PlayerInfo[playerid][vowner14] == 1) && (PlayerInfo[playerid][vowner15] == 1)) { SendClientMessage(playerid, COLOR_BRIGHTRED, "You can only own FIFTEEN vehicles at a time! You must sell one other vehicle first!"); return 1; } }