06.04.2009, 05:37
Okay, I've been making this for about 3 weeks now, everything works, no MySQL, I need help though, when I add in a house, it won't let me go inside of it do to this
Because thats the max amount of houses, so I can add only 3 in and then they all work, but if I add another one in, I have to go and change that number from [91] to [92] and I don't want to have to do that, and I tryed making it [MAX_PLAYERS] and [199] but then it loads the other houses and makes copys of the last house in property.cfg which is this
here is my code, mabey you can figure it out, thanks:
Код:
new HouseInfo[91][hInfo];
Код:
2292.750000,20.670000,234.199996,1064.900024,1084.199951,0,0,0,0,0,0,The State,5 Room House,2500000,0,0,6,1,0,0,0,0,0,418,-1,-1,131,0,79 0.000000,-2292.750000,20.670000,234.199996,1064.900024,1084.199951,0,0,0,0,0,0,The State,5 Room House,2500000,0,0,6,1,0,0,0,0,0,418,-1,-1,131,0,80 0.000000,-2292.750000,20.670000,234.199996,1064.900024,1084.199951,0,0,0,0,0,0,The State,5 Room House,2500000,0,0,6,1,0,0,0,0,0,418,-1,-1,131,0,81 0.000000,-2292.750000,20.670000,234.199996,1064.900024,1084.199951,0,0,0,0,0,0,The State,5 Room House,2500000,0,0,6,1,0,0,0,0,0,418,-1,-1,131,0,82 0.000000,-2292.750000,20.670000,234.199996,1064.900024,1084.199951,0,0,0,0,0,0,The State,5 Room House,2500000,0,0,6,1,0,0,0,0,0,418,-1,-1,131,0,83 0.000000,-
Код:
} if(strcmp(cmd, "/buyhouse", true) == 0) // By Ian Stuart { if(IsPlayerConnected(playerid)) { if(PlayerInfo[playerid][pPhousekey] != 255 && strcmp(playername, HouseInfo[PlayerInfo[playerid][pPhousekey]][hOwner], true) == 0) { new x_nr[64]; x_nr = strtok(cmdtext, idx); if(!strlen(x_nr)) { SendClientMessage(playerid, COLOR_FADE3, "Stand where you wish your house entrance to be and type /buyhouse entrace."); SendClientMessage(playerid, COLOR_FADE3, "Please choose an appropriate and realistic location for your house."); SendClientMessage(playerid, COLOR_FADE3, "Administaration will be notified and will DELETE YOUR HOUSE WITHOUT REFUND"); SendClientMessage(playerid, COLOR_FADE3, "if it is placed in an inappropriate location."); return 1; } if(strcmp(x_nr,"entrance",true) == 0) { new Float:X, Float:Y, Float:Z; new File:hFile; new entry[252]; GetPlayerPos(playerid, X, Y, Z); format(entry, 250, "%f,%f,%f,244.500000,305.000000,999.099975,0,0,0,0,0,0,The State, Bedsit,50000,0,0,1,1,0,1,100,1,0,418,-1,-1,133,0\n ", X, Y, Z); hFile = fopen("property.cfg", io_append); fwrite(hFile, entry); fclose(hFile); SendClientMessage(playerid, COLOR_FADE3, "You have bought your house entrance,"); SendClientMessage(playerid, COLOR_FADE3, "please stand where you wish your house car to be and type /buyhouse car"); LoadProperty(); return 1; } else if(strcmp(x_nr,"car",true) == 0) { if(IsPlayerConnected(playerid)) { if (PlayerInfo[playerid][pAdmin] < 0) { SendClientMessage(playerid, COLOR_GRAD1, "You are not logged in !"); return 1; } tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD2, "/buyhouse car, please make sure you typed /buyhouse car <549>"); return 1; } new car; car = strval(tmp); if(car < 549 || car > 549) { SendClientMessage(playerid, COLOR_GREY, "Vehicle ID must be 549"); return 1; } tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD2, "/buyhouse car, please make sure you typed /buyhouse car <549 0-126>"); return 1; } new color1; color1 = strval(tmp); if(color1 < 0 || color1 > 126) { SendClientMessage(playerid, COLOR_GREY, "Color Number can't be below 0 or above 126!"); return 1; } tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD2, "/buyhouse car, please make sure you typed /buyhouse car <549 0-126>"); return 1; } new color2; color2 = strval(tmp); if(color2 < 0 || color2 > 126) { SendClientMessage(playerid, COLOR_GREY, "Color Number can't be below 0 or above 126!"); return 1; } new Float:X,Float:Y,Float:Z; GetPlayerPos(playerid,X,Y,Z); new carid = CreateVehicle(car, X,Y,Z, 0.0, color1, color2, 60000); // format(string, sizeof(string), "You have bought your house car, please go to your house and,"); // SendClientMessage(playerid, COLOR_GREY, string); // format(string, sizeof(string), "type /payforhouse, thank you, and enjoy."); // SendClientMessage(playerid, COLOR_GREY, string); //CarInfo[carid][cModel] = car; //CarInfo[carid][cType] = 0; //CarInfo[carid][cOwned] = 0; //CarInfo[carid][cRespawnTime] = 0; //CarInfo[carid][cRespawnable] = 0; format(string, 256, "No-one"); // memcpy(CarInfo[carid][cOwner], string, 0, MAX_PLAYER_NAME*4, MAX_PLAYER_NAME*4); format(string, 256, "Spawned %d", carid); //memcpy(CarInfo[carid][cDescription], string, 0, 32*4, 32*4); // CarInfo[carid][cFamily] = 255; //CarInfo[carid][cFaction] = 255; //CarInfo[carid][cColorOne] = color1; //CarInfo[carid][cColorTwo] = color2; //CarInfo[carid][cValue] = 25000; SendClientMessage(playerid, COLOR_FADE3, "You bought your house car, please confirm your house by typeing,"); SendClientMessage(playerid, COLOR_FADE3, "please go to your door and type /confirm, thank you for buying,"); SendClientMessage(playerid, COLOR_FADE3, "please contact the admins if there is any problems."); SendClientMessage(playerid, COLOR_FADE3, "NOTE: THESE HOUSE CARS ARE TEMP, THEY WILL BE GONE ON THE NEXT RESTART!!!"); } else { SendClientMessage(playerid, COLOR_FADE3, "You already own a house."); return 1; } } } return 1;