NomePente(playerid,weaponid){
static string[200];
switch (weaponid){
case WEAPON_DEAGLE:
{
if(InventarioAmmo[0][playerid] > 0)
{
format(string, sizeof (string), "PT Deagle\t%i Pentes\t%i Balas",InventarioPente[0][playerid],InventarioAmmo[0][playerid]);
}
}
case WEAPON_MP5:
{
if(InventarioAmmo[1][playerid] > 0)
{
format(string, sizeof (string), "PT MP5\t%i Pentes\t%i Balas",InventarioPente[1][playerid],InventarioAmmo[1][playerid]);
}
}
case WEAPON_COLT45:
{
if(InventarioAmmo[2][playerid] > 0)
{
format(string, sizeof (string), "PT COLT45\t%i Pentes\t%i Balas",InventarioPente[2][playerid],InventarioAmmo[2][playerid]);
}
}
case WEAPON_SILENCED:
{
if(InventarioAmmo[3][playerid] > 0)
{
format(string, sizeof (string), "PT SILENCED\t%i Pentes\t%i Balas",InventarioPente[3][playerid],InventarioAmmo[3][playerid]);
}
}
case WEAPON_SHOTGUN:
{
if(InventarioAmmo[4][playerid] > 0)
{
format(string, sizeof (string), "PT SHOTGUN\t%i Pentes\t%i Balas",InventarioPente[4][playerid],InventarioAmmo[4][playerid]);
}
}
case WEAPON_SHOTGSPA:
{
if(InventarioAmmo[5][playerid] > 0)
{
format(string, sizeof (string), "PT CombatShotgun\t%i Pentes\t%i Balas",InventarioPente[5][playerid],InventarioAmmo[5][playerid]);
}
}
case WEAPON_AK47:
{
if(InventarioAmmo[5][playerid] > 0)
{
format(string, sizeof (string), "PT AK47\t%i Pentes\t%i Balas",InventarioPente[5][playerid],InventarioAmmo[5][playerid]);
}
}
case WEAPON_M4:
{
if(InventarioAmmo[7][playerid] > 0)
{
format(string, sizeof (string), "PT M4A1\t%i Pentes\t%i Balas",InventarioPente[7][playerid],InventarioAmmo[7][playerid]);
}
}
case WEAPON_SNIPER:
{
if(InventarioAmmo[8][playerid] > 0)
{
format(string, sizeof (string), "PT SNIPER\t%i Pentes\t%i Balas",InventarioPente[8][playerid],InventarioAmmo[8][playerid]);
}
}
case WEAPON_RIFLE:
{
if(InventarioAmmo[9][playerid] > 0)
{
format(string, sizeof (string), "PT RIFLE\t%i Pentes\t%i Balas",InventarioPente[9][playerid],InventarioAmmo[9][playerid]);
}
}
}
return string;
}
NomePente(playerid,weaponid){
static string[200];
string[0] = EOS;
switch (weaponid){
case WEAPON_DEAGLE:format(string, sizeof (string), "PT Deagle\t%i Pentes\t%i Balas",InventarioPente[playerid],InventarioAmmo[playerid]);
case WEAPON_MP5:format(string, sizeof (string), "PT MP5\t%i Pentes\t%i Balas",InventarioPente[playerid],InventarioAmmo[playerid]);
case WEAPON_COLT45:format(string, sizeof (string), "PT COLT45\t%i Pentes\t%i Balas",InventarioPente[playerid],InventarioAmmo[playerid]);
case WEAPON_SILENCED:format(string, sizeof (string), "PT SILENCED\t%i Pentes\t%i Balas",InventarioPente[playerid],InventarioAmmo[playerid]);
case WEAPON_SHOTGUN:format(string, sizeof (string), "PT SHOTGUN\t%i Pentes\t%i Balas",InventarioPente[playerid],InventarioAmmo[playerid]);
case WEAPON_SHOTGSPA:format(string, sizeof (string), "PT CombatShotgun\t%i Pentes\t%i Balas",InventarioPente[playerid],InventarioAmmo[playerid]);
case WEAPON_AK47:format(string, sizeof (string), "PT AK47\t%i Pentes\t%i Balas",InventarioPente[playerid],InventarioAmmo[playerid]);
case WEAPON_M4:format(string, sizeof (string), "PT M4A1\t%i Pentes\t%i Balas",InventarioPente[playerid],InventarioAmmo[playerid]);
case WEAPON_RIFLE:format(string, sizeof (string), "PT RIFLE\t%i Pentes\t%i Balas",InventarioPente[playerid],InventarioAmmo[playerid]);
case WEAPON_SNIPER:format(string, sizeof (string), "PT SNIPER\t%i Pentes\t%i Balas",InventarioPente[playerid],InventarioAmmo[playerid]);
}
return string;
}
Porra, espera mlk.
Seu tуpico ficou em cima do meu, agora comenta la, oq tu achou do meu inventбrio kkkk PHP код:
|
CMD:inventario(playerid, params[]){
new Inv[160];
new weaponid = GetPlayerWeapon(playerid);
if(UsandoMochila[playerid] == true)
{
for(new i = 0; i != 5; i++)
{
strcat(Inv, InventarioPente[i][playerid] > 0 ? ((NomePente(playerid,weaponid))) : ("(NenhumPente)"));
strcat(Inv, "\n");
}
strcat(Inv, "GuardarPente");
ShowPlayerDialog(playerid, DialogInv, DIALOG_STYLE_LIST, "Mochila", Inv, "Selecionar", "Fechar");
}
else
{
SendClientMessage(playerid, -1,"Voce nao tem uma mochila vai comprar!");
}
return 1;
}
Mostre onde й chamada a "NomePente".
@Edit, pera ! Vocк tem certeza que colocou correto isso "InventarioPente[playerid],InventarioAmmo[playerid]" na formats? Todas estгo obtendo o valor dessa variбvel |
Vocк nгo pode armazenar valores diferentes na mesma variбvel, no caso nгo pode armazenar o valor dos pentes, tem que criar para cada arma
|