Duda : Error - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: Non-English (
https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (
https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Español/Spanish (
https://sampforum.blast.hk/forumdisplay.php?fid=29)
+---- Thread: Duda : Error (
/showthread.php?tid=374481)
Duda : Error -
IvanDrago - 02.09.2012
Hola , agrege un nuevo sistema de AFK, y me tira estos errores: , quero saber para sirben.... y como reparalo
pawn Код:
}
if(AFK[i] > 1) AFK[i] --;
}
}
Код:
(14893) : error 017: undefined symbol "i"
(14893) : error 017: undefined symbol "i"
(14895) : error 054: unmatched closing brace ("}")
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
3 Errors.
Respuesta: Duda : Error -
EduGTA - 02.09.2012
No tienes definido "i" y tienes un "}" demбs...
Soluciуn: definir "i" y quitar ese "}"
Respuesta: Duda : Error -
Parka - 02.09.2012
pawn Код:
for(new i=0; i < MAX_PLAYERS; i++)
{
if(AFK[i] > 1) AFK[i] --;
{
}
}
Respuesta: Duda : Error -
IvanDrago - 02.09.2012
asi es, como quedaria?
pawn Код:
public SyncUp()
{
if(PayDayLeft >= 1)
{
PayDayLeft -= 1;
}
else
{
PayDayLeft = 60;
}
SyncTime();
DollahScoreUpdate();
if(PayDayLeft == 0)
{
PayDay();
}
if(AFK[i] > 1) AFK[i] --;
}
}
Respuesta: Duda : Error -
Parka - 02.09.2012
pawn Код:
public SyncUp()
{
if(PayDayLeft >= 1)
{
PayDayLeft -= 1;
}
else
{
PayDayLeft = 60;
}
SyncTime();
DollahScoreUpdate();
if(PayDayLeft == 0)
{
PayDay();
}
for(new i=0; i < MAX_PLAYERS; i++)
{
if(AFK[i] > 1) AFK[i] --;
{
}
}
}
Respuesta: Duda : Error -
Shiny_David - 03.09.2012
Quote:
Originally Posted by cesar_******
pawn Код:
public SyncUp() { if(PayDayLeft >= 1) { PayDayLeft -= 1; } else { PayDayLeft = 60; } SyncTime(); DollahScoreUpdate(); if(PayDayLeft == 0) { PayDay(); } for(new i=0; i < MAX_PLAYERS; i++) { if(AFK[i] > 1) AFK[i] --; { //no necesaria
} //no necesaria } }
|
este codigo tiene dos llaves incesesarias y explicare por que:
al usar esto
if(AFK[i] > 1) AFK[i] --;
el if solo se aplicara para el parametro siguiente y si es llave para todo el conjunto, todo esta correcto sin embargo si pones algo dentro de las llaves no se ejecutara correctamente, la manera correcta seria
pawn Код:
public SyncUp()
{
if(PayDayLeft >= 1)
{
PayDayLeft -= 1;
}
else
{
PayDayLeft = 60;
}
SyncTime();
DollahScoreUpdate();
if(PayDayLeft == 0)
{
PayDay();
}
for(new i=0; i < MAX_PLAYERS; i++)
{
if(AFK[i] > 1)
{
AFK[i] --;
//resto del codigo que va adentro
}
}
}