Error en Pawno
#1

Buen Dia, estube editando un GameMode, todo iva bien hasta hoy, que le di F5 para Compile, Y Me salio este error.

C:\Users\Daniel y Laura\Desktop\Alianza Virtual RP\Zenon City Role Play\gamemodes\AlianzaVirtualRP.pwn(49895) : error 030: compound statement not closed at the end of file (started at line 49854)
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.

Soy nuevo en Pawno, Otra duda que tengo.. їQue es pasar las lineas del Script? Recuerden que soy Noob, porfavor no criticarme. Espero respuesta.
Reply
#2

En el pawno, al lado salen unas lineas correlativas
pawn Код:
1
2
3
4
5
6
.
.
.
Muestra la linea 49854 hasta la 49895
Reply
#3

Quote:
Originally Posted by CrossOv3r
Посмотреть сообщение
En el pawno, al lado salen unas lineas correlativas
pawn Код:
1
2
3
4
5
6
.
.
.
Muestra la linea 49854 hasta la 49895
Eso si lo sabia, ok ya te paso el Code. Te lo doy hasta la 49894. Ya que no tiene 49895.

pawn Код:
foreach(Player, i){
        if(Info[i][pAdminZC] >= 2){
            if(Spectating[i] >= 1){
                if(Spectate[i] < 553){
                    new targetid = Spectate[ i ];
                    if( !IsPlayerConnected( targetid ) ){
                        SendClientMessageEx( i, COLOR_WHITE, "El jugador que estabas specteando salio del servidor." );
                        GettingSpectated[Spectate[i]] = 999;
                        Spectating[i] = 0;
                        Spectate[i] = 999;
                        SetPVarInt(i, "SpecState", -1);
                        SetPVarInt(i, "SpecOff", 1 );
                        TogglePlayerSpectating( i, false );
                        SetCameraBehindPlayer(i);
                    }
                }
                if(Spectate[i] == 553){
                    TogglePlayerControllable(i, 1);
                    TogglePlayerSpectating(i, 0);
                    DeletePVar(i, "MedicBill");
                    SpawnPlayer( i );
                    Spectate[i] = 999;
                    Spectating[i] = 0;
                }
                if(Spectate[i] == 554){
                    TogglePlayerControllable(i, 1);
                    SetPlayerInterior(i,Unspec[i][sPint]);
                    Info[i][pInt] = Unspec[i][sPint];
                    SetPlayerPos(i, Unspec[i][Coords][0], Unspec[i][Coords][1], Unspec[i][Coords][2]);
                    Spectate[i] = 999;
                }
                if(Spectate[i] == 556){
                    SetPlayerToTeamColor(i);
                    Spectate[i] = 999;
                }
                if(Spectate[i] == 557){
                    Spectate[i] = 554;
                }
            }
        }
    }
Reply
#4

Ahн te falta retornar a 1
pawn Код:
return 1;
y ese error es porque falta un "}"
Reply
#5

Quote:
Originally Posted by JustBored
Посмотреть сообщение
Ahн te falta retornar a 1
pawn Код:
return 1;
y ese error es porque falta un "}"
Gracias amigo, el error era el "}" Ya me funciono, gracias.
Reply
#6

Quote:
Originally Posted by JustBored
Посмотреть сообщение
Ahн te falta retornar a 1
pawn Код:
return 1;
y ese error es porque falta un "}"
el return se usa cuando se necesita darle un valor a una funciуn o cuando se necesite finalizar la funcнon y este no es el caso.

Ejemplo.
pawn Код:
if(Funcion() == 10) {
    print("Funcion tiene el valor de 10");
}

Funcion() {
    return 10;
}
pawn Код:
printf("Hay %d jugadores conectados",ContarJugadores());

stock ContarJugadores() {
    new jugadores;
    for(new i=0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i)) {
        jugadores++;
    }
    return jugadores;
}
Reply
#7

Quote:
Originally Posted by Daniel-92
Посмотреть сообщение
el return se usa cuando se necesita darle un valor a una funciуn o cuando se necesite finalizar la funcнon y este no es el caso.

Ejemplo.
pawn Код:
if(Funcion() == 10) {
    print("Funcion tiene el valor de 10");
}

Funcion() {
    return 10;
}
pawn Код:
printf("Hay %d jugadores conectados",ContarJugadores());

stock ContarJugadores() {
    new jugadores;
    for(new i=0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i)) {
        jugadores++;
    }
    return jugadores;
}
Seria:

pawn Код:
return 0;
}
Tu mismo lo dijiste,no tiene un valor en especial.Yo en el "LarAdmin" lo puse asн.
Reply
#8

Quote:
Originally Posted by pinpon
Посмотреть сообщение
Seria:

pawn Код:
return 0;
}
Tu mismo lo dijiste,no tiene un valor en especial.Yo en el "LarAdmin" lo puse asн.
A como dije, se usa cuando se requiere retornar algo, si usas el return ahн estarias deteniendo el bucle por lo cъal generaria un bug y si no tiene un valor en especial simplemente no se pone.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)