new NumeroDeSerie[MAX_PLAYERS];
forward ActualizarNumeroSerie();
public ActualizarNumeroSerie()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(NumeroDeSerie[i] > 0)
{
//
}
}
}
SetTimer("ActualizarNumeroSerie",100,1);
zcmd(vnumero, playerid, params[])
{
new string[128];
format(string, sizeof(string), "El nъmero de serie de йsta arma es {00FF00}%d.", NumeroDeSerie[playerid]);
SendClientMessage(playerid, COLOR_YELLOW, string);
return 1;
}
if(dialogid == AMMUNATION_MENU_PIS)
{
if(response == 1)
{
if(JugadorInfo[playerid][pGunLic] == 0)
{
Message(playerid, COLOR_GRAD2, " Debe tener licencia de porte armamentнstico para poder adquirir un arma.");
return 1;
}
switch(listitem)
{
case 0:
{
if(JugadorInfo[playerid][pDonateT] == 1)
{
new randarma = random(99999);
NumeroDeSerie[playerid] = randarma;
SendClientMessage(playerid, COLOR_YELLOW, "Usted ha comprado una pistola Colt M1911 (calibre .45). Se le ha hecho un descuento del 30%% por ser socio.");
format(string, sizeof(string), "El nъmero de serie de su pistola es {00FF00}%d.", randarma);
SendClientMessage(playerid, COLOR_YELLOW, string);
Compra(playerid, 665);
SafeGivePlayerWeapon(playerid, 22, 1);
}
else
{
new randarma = random(99999);
NumeroDeSerie[playerid] = randarma;
SendClientMessage(playerid, COLOR_YELLOW, "Usted ha comprado una pistola Colt M1911 (calibre .45).");
format(string, sizeof(string), "El nъmero de serie de su pistola es {00FF00}%d.", randarma);
SendClientMessage(playerid, COLOR_YELLOW, string);
Compra(playerid, 960);
SafeGivePlayerWeapon(playerid,22,1);
}
}
}
}
else ShowAmmunation(playerid);
}
if(dialogid == AMMUNATION_MENU_ESC)
{
if(response == 1)
{
if(JugadorInfo[playerid][pGunLic] == 0)
{
Message(playerid, COLOR_GRAD2, " Debe tener licencia de porte armamentнstico para poder adquirir un arma.");
return 1;
}
switch(listitem)
{
case 0:
{
if(JugadorInfo[playerid][pDonateT] == 1)
{
new randarma = random(99999);
NumeroDeSerie[playerid] = randarma;
SendClientMessage(playerid, COLOR_YELLOW, "Usted ha comprado un rifle de caza Marlin Model 336 (calibre .30). Se le ha hecho un descuento del 30%% por ser socio.");
format(string, sizeof(string), "El nъmero de serie de su rifle de caza es {00FF00}%d.", randarma);
SendClientMessage(playerid, COLOR_YELLOW, string);
Compra(playerid, 693);
SafeGivePlayerWeapon(playerid, 33,1);
}
else
{
new randarma = random(99999);
NumeroDeSerie[playerid] = randarma;
SendClientMessage(playerid, COLOR_YELLOW, "Usted ha comprado un rifle de caza Marlin Model 336 (calibre .30).");
format(string, sizeof(string), "El nъmero de serie de su rifle de caza es {00FF00}%d.", randarma);
SendClientMessage(playerid, COLOR_YELLOW, string);
Compra(playerid, 990);
SafeGivePlayerWeapon(playerid, 33,1);
}
}
case 1:
{
if(JugadorInfo[playerid][pDonateT] == 1)
{
new randarma = random(99999);
NumeroDeSerie[playerid] = randarma;
SendClientMessage(playerid, COLOR_YELLOW, "Usted ha comprado una escopeta Ithaca 17 (calibre 18,53mm). Se le ha hecho un descuento del 30%% por ser socio.");
format(string, sizeof(string), "El nъmero de serie de su escopeta normal es {00FF00}%d.", randarma);
SendClientMessage(playerid, COLOR_YELLOW, string);
Compra(playerid, 805);
SafeGivePlayerWeapon(playerid, 25,1);
}
else
{
new randarma = random(99999);
NumeroDeSerie[playerid] = randarma;
SendClientMessage(playerid, COLOR_YELLOW, "Usted ha comprado una escopeta Ithaca 17 (calibre 18,53mm). Se le ha hecho un descuento del 30%% por ser socio.");
format(string, sizeof(string), "El nъmero de serie de su escopeta normal es {00FF00}%d.", randarma);
SendClientMessage(playerid, COLOR_YELLOW, string);
Compra(playerid, 1150);
SafeGivePlayerWeapon(playerid, 25,1);
}
}
}
}
else ShowAmmunation(playerid);
}
switch(listitem)
{
case 0:
{
if(JugadorInfo[playerid][pDonateT] == 1)
{
new randarma = random(99999);
NumeroDeSerie1[playerid] = randarma;
SendClientMessage(playerid, COLOR_YELLOW, "Usted ha comprado un rifle de caza Marlin Model 336 (calibre .30). Se le ha hecho un descuento del 30%% por ser socio.");
format(string, sizeof(string), "El nъmero de serie de su rifle de caza es {00FF00}%d.", randarma);
SendClientMessage(playerid, COLOR_YELLOW, string);
Compra(playerid, 693);
SafeGivePlayerWeapon(playerid, 33,1);
}
else
{
new randarma = random(99999);
NumeroDeSerie2[playerid] = randarma;
SendClientMessage(playerid, COLOR_YELLOW, "Usted ha comprado un rifle de caza Marlin Model 336 (calibre .30).");
format(string, sizeof(string), "El nъmero de serie de su rifle de caza es {00FF00}%d.", randarma);
SendClientMessage(playerid, COLOR_YELLOW, string);
Compra(playerid, 990);
SafeGivePlayerWeapon(playerid, 33,1);
}
}
case 1:
{
if(JugadorInfo[playerid][pDonateT] == 1)
{
new randarma = random(99999);
NumeroDeSerie3[playerid] = randarma;
SendClientMessage(playerid, COLOR_YELLOW, "Usted ha comprado una escopeta Ithaca 17 (calibre 18,53mm). Se le ha hecho un descuento del 30%% por ser socio.");
format(string, sizeof(string), "El nъmero de serie de su escopeta normal es {00FF00}%d.", randarma);
SendClientMessage(playerid, COLOR_YELLOW, string);
Compra(playerid, 805);
SafeGivePlayerWeapon(playerid, 25,1);
}
else
{
new randarma = random(99999);
NumeroDeSerie4[playerid] = randarma;
SendClientMessage(playerid, COLOR_YELLOW, "Usted ha comprado una escopeta Ithaca 17 (calibre 18,53mm). Se le ha hecho un descuento del 30%% por ser socio.");
format(string, sizeof(string), "El nъmero de serie de su escopeta normal es {00FF00}%d.", randarma);
SendClientMessage(playerid, COLOR_YELLOW, string);
Compra(playerid, 1150);
SafeGivePlayerWeapon(playerid, 25,1);
}
}
}
}
else ShowAmmunation(playerid);
}
Muchнsimas gracias, ya funciona bien, me tocarб realizar el guardado de datos del nъmero de serie.
Ahora una duda, yo tengo un sistema para tirar armas al suelo y recogerlas del mismo, entonces.. Si por ejemplo, yo tiro mi pistola con nъmero de serie 3000, entonces una persona la recoge con /rarma, entonces esa persona utiliza /vnumero, їaparecerб que el nъmero de serie de la pistola es 3000? |
Vale, y tengo otro que no puedo solucionar.
Compro una escopeta normal supongamos que me da el nъmero de serie 200.. Entonces lo tiro, lo recojo y uso /vnumero y me aparece nъmero de serie 200.. Hasta ahн, vamos bien, ahora; La tiro de nuevo, compro una nueva escopeta con por ejemplo, 300 de nъmero de serie, entonces la tiro, recojo la escopeta anterior y me da como cуdigo de serie 300, siendo que esa escopeta era 200, y la otra era 300.. їAlguna soluciуn? |
#define MAX_ARMAS_SERIES 9999 // VALOR DEL RAMDOM
NumeroDeSerie1[ MAX_ARMAS_SERIES];
їO podrнa crear una funciуn propia de stock usando el GivePlayerWeapon pero que de un cуdigo de serie fija al arma?
Digo, una funciуn tomando GivePlayerWeapon, y modificarla, creando algo como DarArmaLegal. |