stock ActualizarLabelNegocio(n)/* Actualizar label del negocio */
{
new string[300], Direccion[MAX_ZONE_NAME];
Get2DZone(Direccion, MAX_ZONE_NAME, InformacionNegocio[n][nExtX],InformacionNegocio[n][nExtY],InformacionNegocio[n][nExtZ]);
if(InformacionNegocio[n][nEnVenta] == 1)
{
if(InformacionNegocio[n][nPrecioEntrada])
{
format(string,sizeof(string),"%s\n\nDueсo: %s\nDirecciуn: %s %d\nEntrada: $%d\n\nPresiona [F]",
TipoNegocio(n), InformacionNegocio[n][nPropietario], Direccion, n, InformacionNegocio[n][nPrecioEntrada]);
}
else
{
format(string,sizeof(string),"%s\n\nDueсo: %s\nDirecciуn: %s %d\n\nPresiona [F]",
TipoNegocio(n), InformacionNegocio[n][nPropietario], Direccion, n);
}
}
else
{
format(string,sizeof(string),"%s\n\nЎNegocio en Venta!\nDirecciуn: %s %d\nPrecio: $%d\n\nЎMбs informaciуn /ayuda negocios!\n\nPresiona [F]",
TipoNegocio(n), Direccion, n, InformacionNegocio[n][nPrecio]);
}
Negocio[n] = CreateDynamic3DTextLabel(string, COLOR_GRIS, InformacionNegocio[n][nExtX], InformacionNegocio[n][nExtY], InformacionNegocio[n][nExtZ], 7.0);
return 1;
}
CMD:comprar(playerid, params[])
{
new nombre[12];
if(sscanf(params, "s[12]", nombre)) return SendClientMessage(playerid, COLOR_NARANJA, "* /comprar [Opciуn]");
if(strcmp(nombre,"negocio",true) == 0)
{
new id = EstaEnExteriorNegocio(playerid);
new Nombre[MAX_PLAYER_NAME];
GetPlayerName(playerid,Nombre,sizeof(Nombre));
if(id == -1 || id == 0) return SendClientMessage(playerid, COLOR_GRIS, "Info: "#CROSA"[!]"#CGRIS2" No estбs cerca de un negocio");
if(InformacionNegocio[id][nEnVenta] != 0 || InformacionNegocio[id][nPrecio] == 0) return SendClientMessage(playerid, COLOR_GRIS, "Info: "#CROSA"[!]"#CGRIS2" Este negocio no estб en venta.");
if(Informacion[playerid][pNegocioID] != 0) return SendClientMessage(playerid, COLOR_GRIS, "Info: "#CROSA"[!]"#CGRIS2" Ya tienes un negocio.");
if(GetPlayerMoney(playerid) < InformacionNegocio[id][nPrecio]) return SendClientMessage(playerid, COLOR_GRIS, "Info: "#CROSA"[!]"#CGRIS2" No tienes suficiente dinero para comprar este negocio.");
Informacion[playerid][pNegocioID] = id;
DarDinero(playerid, -InformacionNegocio[id][nPrecio]);
InformacionNegocio[id][nEstado] = 0;
InformacionNegocio[id][nEnVenta] = 1;
InformacionNegocio[id][nPropietario] = Nombre;
SendClientMessage(playerid, COLOR_GRIS, "Bien hecho! has comprado un negocio");
GuardarNegocio(playerid);
}
return 1;
}
stock ActualizarLabelNegocio(n)/* Actualizar label del negocio */
{
new string[300], Direccion[MAX_ZONE_NAME];
Get2DZone(Direccion, MAX_ZONE_NAME, InformacionNegocio[n][nExtX],InformacionNegocio[n][nExtY],InformacionNegocio[n][nExtZ]);
if(InformacionNegocio[n][nEnVenta] == 1)
{
if(InformacionNegocio[n][nPrecioEntrada])
{
format(string,sizeof(string),"%s\n\nDueсo: %s\nDirecciуn: %s %d\nEntrada: $%d\n\nPresiona [F]",
TipoNegocio(n), InformacionNegocio[n][nPropietario], Direccion, n, InformacionNegocio[n][nPrecioEntrada]);
}
else
{
format(string,sizeof(string),"%s\n\nDueсo: %s\nDirecciуn: %s %d\n\nPresiona [F]",
TipoNegocio(n), InformacionNegocio[n][nPropietario], Direccion, n);
}
}
else
{
format(string,sizeof(string),"%s\n\nЎNegocio en Venta!\nDirecciуn: %s %d\nPrecio: $%d\n\nЎMбs informaciуn /ayuda negocios!\n\nPresiona [F]",
TipoNegocio(n), Direccion, n, InformacionNegocio[n][nPrecio]);
}
Negocio[n] = CreateDynamic3DTextLabel(string, COLOR_GRIS, InformacionNegocio[n][nExtX], InformacionNegocio[n][nExtY], InformacionNegocio[n][nExtZ], 7.0);
return 1;
}
CMD:comprar(playerid, params[])
{
new nombre[12];
if(sscanf(params, "s[12]", nombre)) return SendClientMessage(playerid, COLOR_NARANJA, "* /comprar [Opciуn]");
if(strcmp(nombre,"negocio",true) == 0)
{
new id = EstaEnExteriorNegocio(playerid);
new Nombre[MAX_PLAYER_NAME];
GetPlayerName(playerid,Nombre,sizeof(Nombre));
if(id == -1 || id == 0) return SendClientMessage(playerid, COLOR_GRIS, "Info: "#CROSA"[!]"#CGRIS2" No estбs cerca de un negocio");
if(InformacionNegocio[id][nEnVenta] != 0 || InformacionNegocio[id][nPrecio] == 0) return SendClientMessage(playerid, COLOR_GRIS, "Info: "#CROSA"[!]"#CGRIS2" Este negocio no estб en venta.");
if(Informacion[playerid][pNegocioID] != 0) return SendClientMessage(playerid, COLOR_GRIS, "Info: "#CROSA"[!]"#CGRIS2" Ya tienes un negocio.");
if(GetPlayerMoney(playerid) < InformacionNegocio[id][nPrecio]) return SendClientMessage(playerid, COLOR_GRIS, "Info: "#CROSA"[!]"#CGRIS2" No tienes suficiente dinero para comprar este negocio.");
Informacion[playerid][pNegocioID] = id;
DarDinero(playerid, -InformacionNegocio[id][nPrecio]);
InformacionNegocio[id][nEstado] = 0;
InformacionNegocio[id][nEnVenta] = 1;
InformacionNegocio[id][nPropietario] = Nombre;
SendClientMessage(playerid, COLOR_GRIS, "Bien hecho! has comprado un negocio");
GuardarNegocio(playerid);
DestroyDynamicObject(Negocio[id]);
ActualizarLabelNegocio(id);
}
return 1;
}
|
Lo que pasa es que el If que lo muestra como en venta se fija si tiene un precio de entrada (PrecioEntrada) y si no se lo cambias al comprar el negocio lo seguirб teniendo y lo va a seguir mostrando como en venta... Debes hacer la comprobaciуn distinta porque aъn poniendo PrecioEntrada en 0, sigue teniendo un valor.
|