if(!strcmp(opcion, "negocio", true))
{
for(new h = 0; h < sizeof(NegocioInfo); h++)
{
if(IsPlayerInRangeOfPoint(playerid, 3.0,NegocioInfo[h][nPosX], NegocioInfo[h][nPosY], NegocioInfo[h][nPosZ]))
{
if(strcmp(NegocioInfo[h][nPropietario], NombreJugador(playerid)) == 0)
{
if(NegocioInfo[h][nDinero] >= monto)
{
GanaDineroPlayer_(playerid, monto), NegocioInfo[h][nDinero] -= monto;
format(string, sizeof(string), "Sacaste "#CVERDE"%d$"#CBLANCO" de la caja fuerte. Ahora queda(n) "#CVERDE"%d$"#CBLANCO" depositados en la caja fuerte.",monto,NegocioInfo[h][nDinero]);
SendClientMessage(playerid, COLOR_BLANCO, string), GuardarNegocio(h);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_ROJO, "* No tienes esa cantidad en la caja fuerte.");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_ROJO, "* No eres el propietario de este negocio.");
return 1;
}
}
}
SendClientMessage(playerid, COLOR_ROJO, "* No estбs cerca de ningъn negocio.");
return 1;
}
if(sscanf(params, "Specifiers", Var1, var2, Var3)) return 0;
|
Код:
if(sscanf(params, "Specifiers", Var1, var2, Var3)) return 0; |
CMD:retirar(playerid, params[])
{
new negocio, dinero, str[100];
if(sscanf(params, "ii", negocio, dinero)) return SendClientMessage(playerid, -1, "/retirar [negocio] [dinero]");
format(str, 100, "negocio: %i | dinero: $ %i,00", negocio, dinero);
SendClientMessage(playerid, -1, str);
return 1;
}
|
Un ejemplo de comando en ZCMD:
Код:
CMD:retirar(playerid, params[])
{
new negocio, dinero, str[100];
if(sscanf(params, "ii", negocio, dinero)) return SendClientMessage(playerid, -1, "/retirar [negocio] [dinero]");
format(str, 100, "negocio: %i | dinero: $ %i,00", negocio, dinero);
SendClientMessage(playerid, -1, str);
return 1;
}
|
CMD:retirar(playerid, params[])
{
new opcion[24];
if(sscanf(params, "s[24]", opcion)) return SendClientMessage(playerid, -1, "/retirar opciуn");
if(!strcmp(opcion, "Negocio", true))
{
for(new h = 0; h < sizeof(NegocioInfo); h++)
{
if(IsPlayerInRangeOfPoint(playerid, 3.0,NegocioInfo[h][nPosX], NegocioInfo[h][nPosY], NegocioInfo[h][nPosZ]))
{
if(strcmp(NegocioInfo[h][nPropietario], NombreJugador(playerid)) == 0)
{
if(NegocioInfo[h][nDinero] >= monto)
{
GanaDineroPlayer_(playerid, monto), NegocioInfo[h][nDinero] -= monto;
format(string, sizeof(string), "Sacaste "#CVERDE"%d$"#CBLANCO" de la caja fuerte. Ahora queda(n) "#CVERDE"%d$"#CBLANCO" depositados en la caja fuerte.",monto,NegocioInfo[h][nDinero]);
SendClientMessage(playerid, COLOR_BLANCO, string), GuardarNegocio(h);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_ROJO, "* No tienes esa cantidad en la caja fuerte.");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_ROJO, "* No eres el propietario de este negocio.");
return 1;
}
}
}
SendClientMessage(playerid, COLOR_ROJO, "* No estбs cerca de ningъn negocio.");
}
else if(!strcmp(opcion, "Otra", true))
{
}
return 1;
}
CMD:editarnegocio(playerid, params[])
{
new
string[80];
if(PlayerInfo[playerid][pAdmin] < 0) return 0;
if(sscanf(params, "s[24]i", params[0], params[1])) return SendClientMessage(playerid, -1, "/retirar opciуn");
if(!strcmp(params[0], "precio", true))
{
if(params[1] > 50000 && params[1] < 10000000)
{
for(new i = 0; i < sizeof(NegocioInfo); i ++)
{
if(IsPlayerInRangeOfPoint(playerid, 5.0, NegocioInfo[i][nPosX], NegocioInfo[i][nPosY], NegocioInfo[i][nPosZ]))
{
NegocioInfo[i][nPrecio] = params[1], GuardarNegocio(i);
format(string, sizeof(string), "Administraciуn: %s le cambiу el interior al negocio %d.", NombreJugador(playerid), NegocioInfo[i][nSQLID]);
SendStaffMessage(COLOR_STAFF, string), ActualizarTextoNegocio(i);
return 1;
}
}
SendClientMessage(playerid, COLOR_ROJO,"* No estбs cerca de ningъn negocio.");
return 1;
}
else
{
SendClientMessage(playerid, COLOR_ROJO,"* El precio tiene que ser superior a 50 mil dуlares o no funcionarб.");
}
return 1;
}
else if(!strcmp(params[0], "Otra", true))
{
}
return 1;
}
CMD:editarnegocio(playerid, params[])
{
new opcion[24], string[40];
if(sscanf(params, "s[24]S()[40]", opcion)) return SendClientMessage(playerid, -1, "/editarnegocio opciуn");
if(!strcmp(opcion, "Precio", true))
{
new precio, string[128];
if(sscanf(string, "d", precio)) return SendClientMessage(playerid, -1, "/editarnegocio precio nuevo precio");
if(precio > 50000 || precio < 10000000) return SendClientMessage(playerid, -1, "Error, el precio debe ser entre 50000 y 10000000");
for(new i = 0; i < sizeof(NegocioInfo); i ++)
{
if(IsPlayerInRangeOfPoint(playerid, 5.0, NegocioInfo[i][nPosX], NegocioInfo[i][nPosY], NegocioInfo[i][nPosZ]))
{
NegocioInfo[i][nPrecio] = precio;
GuardarNegocio(i);
ActualizarTextoNegocio(i);
format(string, sizeof(string), "Administraciуn: %s le cambiу el interior al negocio %d.", NombreJugador(playerid), NegocioInfo[i][nSQLID]);
SendStaffMessage(COLOR_STAFF, string);
return 1;
}
}
SendClientMessage(playerid, COLOR_ROJO, "No estбs cerca de ningъn negocio.");
}
else if(!strcmp(opcion, "Otra", true))
{
}
return 1;
}