05.10.2013, 23:40
Lo que quiero es crear un sistema de garage para las casas, Me refiero a crear la casa normal con el comando que ya tengo creado y luego colocar
/garageforhouse [houseid] [typegarage]
Ya tengo el comando /createhouse y /creategarage, quiero unirlos o lo que se les haga mas facil para poder crear ese comando y que se guarden los garages aqui les paso los comandos:
Casas:
Garages:
/garageforhouse [houseid] [typegarage]
Ya tengo el comando /createhouse y /creategarage, quiero unirlos o lo que se les haga mas facil para poder crear ese comando y que se guarden los garages aqui les paso los comandos:
Casas:
Код:
if(strcmp(cmd, "/createhouse", true) == 0) { if(PlayerInfo[playerid][pAdmin] >= 1337) { tmp = strtok(cmdtext, idx); if (!strlen(tmp)) return SyntaxMessage(playerid, "/createhouse [price] [type]"); new price = strval(tmp); tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SyntaxMessage(playerid, "/createhouse [price] [type]"); SendClientMessage(playerid, WHITE, "Available names: bedroom1, bedroom2, motelroom, smallhouse1, smallhouse2, woodhouse"); SendClientMessage(playerid, WHITE, "Available names: medhouse1, medhouse2, medhouse3, richhouse1, richhouse2, richhouse3"); SendClientMessage(playerid, WHITE, "Available names: richhouse4, richouse5, richhouse6, dungeon, office, stripclub"); SendClientMessage(playerid, WHITE, "Available names: brothel, factory, maddogs"); return 1; } new id = GetAvailableID(TYPE_HOUSE), location[MAX_ZONE_NAME]; if (id == -1) return SendClientMessage(playerid, GREY, " Houses are at their maximum. Cannot continue."); new Float:x, Float:y, Float:z; GetPlayerPos(playerid, x, y, z); if (!InvalidHouseInterior(tmp)) return SendClientMessage(playerid, GREY, "Invalid house type."); HouseIDTaken[id] = 1; HouseInfo[id][HouseWait] = 0; HouseInfo[id][HouseOwned] = 0; HouseInfo[id][HouseVirtual] = id; HouseInfo[id][HouseEnterX] = x; HouseInfo[id][HouseEnterY] = y; HouseInfo[id][HouseEnterZ] = z; HouseInfo[id][HouseInsideX] = 244.5000; HouseInfo[id][HouseInsideY] = 305.0000; HouseInfo[id][HouseInsideZ] = 999.1484; HouseInfo[id][HouseInsideA] = 270.0000; HouseInfo[id][HouseGun1] = 0; HouseInfo[id][HouseGun2] = 0; HouseInfo[id][HouseGun3] = 0; HouseInfo[id][HouseGun4] = 0; HouseInfo[id][HouseCash] = 0; HouseInfo[id][HouseMats] = 0; HouseInfo[id][HouseWeed] = 0; HouseInfo[id][HouseMeth] = 0; HouseInfo[id][HouseHeroin] = 0; HouseInfo[id][HouseCocaine] = 0; HouseInfo[id][HousePrice] = price; HouseInfo[id][HouseInterior] = 1; HouseInfo[id][HouseType] = 1; HouseInfo[id][HouseExitVW] = GetPlayerVirtualWorld(playerid); HouseInfo[id][HouseExitInt] = GetPlayerInterior(playerid); HouseInfo[id][HouseSafe] = 0; HouseInfo[id][HouseSafeCode] = 0; strmid(HouseInfo[id][HouseType], "Bedsit", 0, strlen("Bedsit"), 255); strmid(HouseInfo[id][HouseOwner], "The State", 0, strlen("The State"), 255); SendClientMessage(playerid, LIGHTBLUE, "House created, now use /edithouse [id] to edit it."); format(string, sizeof(string), "The house ID is: %d (you can use this id to /edithouse with it).", id); SendClientMessage(playerid, LIGHTBLUE, string); HouseInfo[id][HousePickup] = CreateDynamicPickup(1273, 23, x, y, z); Get2DZone(location, MAX_ZONE_NAME, x, y, z); format(string, sizeof(string), "House Owner: {FFFFFF}The State\n"HOUSE_HEX"House Location: {FFFFFF}%s\n"HOUSE_HEX"House Interior: {FFFFFF}Bedsit\n"HOUSE_HEX"House Cost: {FFFFFF}$%d", location, price); HouseInfo[id][HouseLabel] = CreateStreamed3DTextLabel(string, HOUSE_COLOR, x, y, z, 10.0, 0); EditHouseInterior(id, tmp); SaveHouses(); houses++; return 1; } else { SendClientMessage(playerid, GREY, " You are not authorized to use that command."); } return 1; }
Код:
if(strcmp(cmd, "/creategarage", true) == 0) { if(PlayerInfo[playerid][pAdmin] >= 1337) { tmp = strtok(cmdtext, idx); if (!strlen(tmp)) return SyntaxMessage(playerid, "/creategarage [price] [size]"); new price = strval(tmp); tmp = strtok(cmdtext, idx); if (!strlen(tmp)) return SyntaxMessage(playerid, "/creategarage [price] [size]"); new size = strval(tmp); if (size < 1 || size > 3) return SendClientMessage(playerid, GREY, "Invalid size."); new location[32]; new Float:x, Float:y, Float:z; new id = GetAvailableID(TYPE_GARAGE); if (id == -1) return SendClientMessage(playerid, GREY, " Garages are at their maximum. Cannot continue."); GarageIDTaken[id] = 1; GetPlayerPos(playerid, x, y, z); GarageInfo[id][GarageEnterX] = x; GarageInfo[id][GarageEnterY] = y; GarageInfo[id][GarageEnterZ] = z; GarageInfo[id][GaragePickup] = CreateDynamicPickup(1239, 23, x, y, z); GarageInfo[id][GarageOwned] = 0; GarageInfo[id][GaragePrice] = price; GarageInfo[id][GarageVirtual] = id; GarageInfo[id][GarageInsideX] = 0; GarageInfo[id][GarageInsideY] = 0; GarageInfo[id][GarageInsideZ] = 0; GarageInfo[id][GarageInsideA] = 0; GarageInfo[id][GarageExitX] = 0; GarageInfo[id][GarageExitY] = 0; GarageInfo[id][GarageExitZ] = 0; GarageInfo[id][GarageExitA] = 0; strmid(GarageInfo[id][GarageOwner], "The State", 0, strlen("The State"), 255); GarageInfo[id][GarageSize] = 0; Get2DZone(location, MAX_ZONE_NAME, x, y, z); format(string, sizeof(string), "Garage Owner: {FFFFFF} The State\n"GARAGE_HEX"Garage Size: {FFFFFF}None\n"GARAGE_HEX"Garage Location: {FFFFFF}%s", location); GarageInfo[id][GarageLabel] = CreateStreamed3DTextLabel(string, GARAGE_COLOR, x, y, z, 10.0, 0); SendClientMessage(playerid, LIGHTBLUE, "Garage created, now use /editgarage [id] to edit it."); format(string, sizeof(string), "The garage ID is: %d (you can use this id to /editgarage with it).", id); SendClientMessage(playerid, LIGHTBLUE, string); SetGarageSize(id, size); SaveGarages(); garages++; return 1; } else { SendClientMessage(playerid, GREY, " You are not authorized to use that command."); } return 1; }