GTAOnline.net
San Andreas Multiplayer (sa:mp) => Scripting SA-MP [Pawn center] => Discussion démarrée par: Tetra-S le 03 Décembre 2007, 20:19:25
-
Bonjour je suis en train de preparer mon script mais une erruer est survenu lors d'un coding pour spawn a different endroit avec le meme perso voici mon code et mes erreur
mon code :
if(gTeam[playerid] == TEAM_STUNT)
{
if(persoLS == 1)// ligne 547
{
new randomize=random(sizeof(SpawnLS));
SetPlayerPos(playerid, SpawnLS[randomize][0],SpawnLS[randomize][1],SpawnLS[randomize][2]);
}
if(persoSF == 1)// ligne 553
{
new randomize=random(sizeof(SpawnSF));
SetPlayerPos(playerid, SpawnSF[randomize][0],SpawnSF[randomize][1],SpawnSF[randomize][2]);
}
if(persoLV == 1)// ligne 559
{
new randomize=random(sizeof(SpawnLV));
SetPlayerPos(playerid, SpawnLV[randomize][0],SpawnLV[randomize][1],SpawnLV[randomize][2]);
}
if(persoD == 1)//ligne 565
{
new randomize=random(sizeof(SpawnD));
SetPlayerPos(playerid, SpawnD[randomize][0],SpawnD[randomize][1],SpawnD[randomize][2]);
}
}
mes erreurs :
C:\DOCUME~1\Tetra-S\Bureau\SERVEU~1\GAMEMO~1\XSS.pwn(547) : error 033: array must be indexed (variable "persoLS")
C:\DOCUME~1\Tetra-S\Bureau\SERVEU~1\GAMEMO~1\XSS.pwn(553) : error 033: array must be indexed (variable "persoSF")
C:\DOCUME~1\Tetra-S\Bureau\SERVEU~1\GAMEMO~1\XSS.pwn(559) : error 033: array must be indexed (variable "persoLV")
C:\DOCUME~1\Tetra-S\Bureau\SERVEU~1\GAMEMO~1\XSS.pwn(565) : error 033: array must be indexed (variable "persoD")
j'espere que vous pourrez m'aidez
-
Essais d'utiliser un switch.
-
pouquoi un switch g 4 variable driferente
-
Traduction de l'erreur "Array must be indexed" : Le tableau doit être indexé (ou indicé).
(Bon d'accord, ce n'est pas forcément plus parlant en français)
En fait, les variables persoLS, persoSF, persoLV et persoD sont des tableaux donc tu doit OBLIGATOIREMENT les utiliser avec une indexation, c'est à dire avec des crochets [] (les crochets contiennent l'index - ou indice- de l'élément).
Comme je ne sais pas à quoi correspondent ces variables, je peux pas t'en dire plus mais tu as globalement 2 solutions :
- Transformer ces variables en variables simples (en supprimant les [] dans le new)
- Mettre le bon index entre [].
++
Syg