SA-MP Forums Archive
Array - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Array (/showthread.php?tid=404422)



Array - Noliax8 - 03.01.2013

Hello, I am sorry I do not speak English. To look at my code would understand you.

Code:
Код:
new gunname[35];
GetWeaponName(Joueur[playerid][Arme[slot-1]], gunname, sizeof(gunname));
Errors:
Код:
C:\Users\Noliax8\Desktop\Nouveau dossier\gamemodes\rp.pwn(188) : error 028: invalid subscript (not an array or too many subscripts): "Arme"
C:\Users\Noliax8\Desktop\Nouveau dossier\gamemodes\rp.pwn(188) : warning 215: expression has no effect
C:\Users\Noliax8\Desktop\Nouveau dossier\gamemodes\rp.pwn(188) : error 001: expected token: ";", but found "]"
C:\Users\Noliax8\Desktop\Nouveau dossier\gamemodes\rp.pwn(188) : error 029: invalid expression, assumed zero
C:\Users\Noliax8\Desktop\Nouveau dossier\gamemodes\rp.pwn(188) : fatal error 107: too many error messages on one line
I would just like to be able to make a system of inventory just with a buckle.

Thank you !



AW: Array - Nero_3D - 03.01.2013

Try it like that

pawn Код:
GetWeaponName(Joueur[playerid][Arme][slot - 1], gunname, sizeof(gunname));



Re: Array - Noliax8 - 03.01.2013

Hello,

No..

Код:
C:\Users\Noliax8\Desktop\Nouveau dossier\gamemodes\rp.pwn(231) : error 020: invalid symbol name ""
C:\Users\Noliax8\Desktop\Nouveau dossier\gamemodes\rp.pwn(231) : error 029: invalid expression, assumed zero
C:\Users\Noliax8\Desktop\Nouveau dossier\gamemodes\rp.pwn(231) : warning 215: expression has no effect
C:\Users\Noliax8\Desktop\Nouveau dossier\gamemodes\rp.pwn(232) : error 029: invalid expression, assumed zero
C:\Users\Noliax8\Desktop\Nouveau dossier\gamemodes\rp.pwn(233) : error 020: invalid symbol name ""
C:\Users\Noliax8\Desktop\Nouveau dossier\gamemodes\rp.pwn(233) : error 029: invalid expression, assumed zero
C:\Users\Noliax8\Desktop\Nouveau dossier\gamemodes\rp.pwn(233) : warning 215: expression has no effect
C:\Users\Noliax8\Desktop\Nouveau dossier\gamemodes\rp.pwn(237) : error 020: invalid symbol name ""
C:\Users\Noliax8\Desktop\Nouveau dossier\gamemodes\rp.pwn(237) : error 029: invalid expression, assumed zero
C:\Users\Noliax8\Desktop\Nouveau dossier\gamemodes\rp.pwn(237) : warning 215: expression has no effect
C:\Users\Noliax8\Desktop\Nouveau dossier\gamemodes\rp.pwn(241) : error 032: array index out of bounds (variable "msg")
Код:
new msg[4][50],
msgtotal[250];

for(new slot=1; slot <= 5; slot++)
{
    new gunname[35];
	GetWeaponName(Joueur[playerid][Arme][slot-1], gunname, sizeof(gunname));

	if(Joueur[playerid][Arme][slot-1] != 0)
	{
		if(Joueur[playerid][Munition][slot-1] > 1)
		format(msg[slot+1], sizeof(50), "[Retrait] %s - %d balles\n", gunname, Joueur[playerid][Munition][slot-1]);
		else
		format(msg[slot+1], sizeof(50), "[Retrait] %s - %d balle\n", gunname, Joueur[playerid][Munition][slot-1]);
	}
	else
	{
		format(msg[slot+1], sizeof(50), "[Dйpot] Arme actuelle\n",);
	}
}

format(msgtotal, sizeof(msgtotal), "%s%s%s%s%s", msg[0], msg[1], msg[2], msg[3], msg[4]);
ShowPlayerDialog(playerid, DIALOG_POCHE, DIALOG_STYLE_LIST, "Poches - Arme", msgtotal, "Voir", "Annuler");



AW: Re: Array - Nero_3D - 03.01.2013

Their were several problems within your code

pawn Код:
//
    new
        gun[35],
        tmp[256]
    ;
    for(new slot = 0; slot != 4; ++slot) {
        GetWeaponName(Joueur[playerid][Arme][slot], gun, sizeof gun);

        if(Joueur[playerid][Arme][slot] != 0) {
            format(tmp, sizeof tmp,
                "%s[Retrait] %s - %d %s\n",
                tmp,
                gun,
                Joueur[playerid][Munition][slot],
                ((Joueur[playerid][Munition][slot] > 1) ? ("balles") : ("balle"))
            );
        } else {
            strcat(tmp, "[Dйpot] Arme actuelle\n");
        }
    }
    ShowPlayerDialog(playerid, DIALOG_POCHE, DIALOG_STYLE_LIST, "Poches - Arme", tmp, "Voir", "Annuler");



Re: Array - Noliax8 - 03.01.2013

Thanks!!