[AJUDA] Restringindo os carros.
#1

To com um probleminha aqui galera :S

Heelp ??

pawn Код:
new CarroGroove[11];
//10 Carros aqui

new CarroCops[11];
//10 Carros aqui
AQUI TA TUDO OK, APARENTEMENTE :S
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if (ReservedCar(vehicleid)
)
    if(Gang[playerid] == GROOVE)
{
    SendClientMessage(playerid, SERVER_INFO, "Ok vocк pertence a este time (Groove Street)");  
}
    RemovePlayerFromVehicle(playerid);
    SendClientMessage(playerid, SERVER_INFO, "Vocк nao pertence a este time");
    SendClientMessage(playerid, SERVER_INFO, "Use: ( /meutime ) caso queira trocar.");
   
    if(Gang[playerid] == COPS)
{
    SendClientMessage(playerid, SERVER_INFO, "Ok vocк pertence a este time (COPS)");  
}
    RemovePlayerFromVehicle(playerid);
    SendClientMessage(playerid, SERVER_INFO, "Vocк nao pertence a este time");
    SendClientMessage(playerid, SERVER_INFO, "Use: ( /meutime ) caso queira trocar.");    
    return 0;
}
AONDE O PROBLEMA SE ENCONTRA:
pawn Код:
forward ReservedCar(carid);
    public ReservedCar(carid)
{
    if(CarroGroove); // 442
    {
    return 1;
    }
    if(CarroCops); // 446
    {
    return 1;
    }
    return 0; // 450
}
Problemas:
Код:
D:\JOGOS\GTA San Andreas\Server SAMP\gamemodes\teste.pwn(446) : error: 017: undefined symbol "CarroGroove"
D:\JOGOS\GTA San Andreas\Server SAMP\gamemodes\teste.pwn(446) : error: 036: empty statement
D:\JOGOS\GTA San Andreas\Server SAMP\gamemodes\teste.pwn(446) : warning: 225: unreachable code
D:\JOGOS\GTA San Andreas\Server SAMP\gamemodes\teste.pwn(446) : error: 017: undefined symbol "CarroCops"
D:\JOGOS\GTA San Andreas\Server SAMP\gamemodes\teste.pwn(446) : error: 036: empty statement
D:\JOGOS\GTA San Andreas\Server SAMP\gamemodes\teste.pwn(446) : warning: 225: unreachable code
Nao conssigo entender o motivo do Underfined Symbol ja que eu defini lб em cima new CarroGroove e CarroCops :S
Como posso resolver isso ?
Reply
#2

pawn Код:
forward ReservedCar(carid);
public ReservedCar(carid)
{
    for(new i, e = sizeof(CarroGroove); i != e; ++i)
    {
        if(CarroGroove[i] == carid)
        {
            return true;
        }
    }
    for(new i, e = sizeof(CarroCops); i != e; ++i)
    {
        if(CarroCops[i] == carid)
        {
            return true;
        }
    }
    return 0; // 450
}
Reply
#3

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if (ReservedCar(vehicleid)) // faltou fechar " ) "
)
    if(Gang[playerid] == GROOVE)
{
    SendClientMessage(playerid, SERVER_INFO, "Ok vocк pertence a este time (Groove Street)");  
}
    RemovePlayerFromVehicle(playerid);
    SendClientMessage(playerid, SERVER_INFO, "Vocк nao pertence a este time");
    SendClientMessage(playerid, SERVER_INFO, "Use: ( /meutime ) caso queira trocar.");
   
    if(Gang[playerid] == COPS)
{
    SendClientMessage(playerid, SERVER_INFO, "Ok vocк pertence a este time (COPS)");  
}
    RemovePlayerFromVehicle(playerid);
    SendClientMessage(playerid, SERVER_INFO, "Vocк nao pertence a este time");
    SendClientMessage(playerid, SERVER_INFO, "Use: ( /meutime ) caso queira trocar.");    
    return 0;
}
pawn Код:
new CarroGroove[11];
AddStaticVehicle(..);

new CarroCops[11];
AddStaticVehicle(...);
Reply
#4

Garfield ao usar seu cуdigo veja os Problemas:
Код:
D:\JOGOS\GTA San Andreas\Server SAMP\gamemodes\teste.pwn(440) : warning: 219: local variable "i" shadows a variable at a preceding level
D:\JOGOS\GTA San Andreas\Server SAMP\gamemodes\teste.pwn(440) : error: 017: undefined symbol "CarroGroove"
D:\JOGOS\GTA San Andreas\Server SAMP\gamemodes\teste.pwn(440) : warning: 215: expression has no effect
D:\JOGOS\GTA San Andreas\Server SAMP\gamemodes\teste.pwn(440) : error: 001: expected token: ")", but found ";"
D:\JOGOS\GTA San Andreas\Server SAMP\gamemodes\teste.pwn(440) : error: 036: empty statement
D:\JOGOS\GTA San Andreas\Server SAMP\gamemodes\teste.pwn(440) : error fatal: 107: too many error messages on one line
e Cristhian obrigado pela observaзгo

@NINGUEM ?
Reply
#5

Alguem ajuda ae por favor
Reply
#6

pawn Код:
// OnGameModeInit()
CarroGroove[0] = CreateVehicle(...);
CarroGroove[1] = CreateVehicle(...);
CarroGroove[2] = CreateVehicle(...);
CarroGroove[3] = CreateVehicle(...);

CarroCops[0]   = CreateVehicle(...);
CarroCops[1]   = CreateVehicle(...);
CarroCops[2]   = CreateVehicle(...);
CarroCops[3]   = CreateVehicle(...);

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(ReservedCar(vehicleid))
    {
        if(Gang[playerid] == GROOVE)
        {
            SendClientMessage(playerid, SERVER_INFO, "Ok vocк pertence a este time (Groove Street)");
            RemovePlayerFromVehicle(playerid);
            SendClientMessage(playerid, SERVER_INFO, "Vocк nao pertence a este time");
            SendClientMessage(playerid, SERVER_INFO, "Use: ( /meutime ) caso queira trocar.");
        }
        if(Gang[playerid] == COPS)
        {
            SendClientMessage(playerid, SERVER_INFO, "Ok vocк pertence a este time (COPS)");
            RemovePlayerFromVehicle(playerid);
            SendClientMessage(playerid, SERVER_INFO, "Vocк nao pertence a este time");
            SendClientMessage(playerid, SERVER_INFO, "Use: ( /meutime ) caso queira trocar.");
        }
    }
    return 0;
}

forward ReservedCar(carid);
public ReservedCar(carid)
{
    for(new i, e = sizeof(CarroGroove); i != e; ++i)
    {
        if(CarroGroove[i] == carid)
        {
            return true;
        }
    }
    for(new i, e = sizeof(CarroCops); i != e; ++i)
    {
        if(CarroCops[i] == carid)
        {
            return true;
        }
    }
    return 0; // 450
}
Reply
#7

Garfield mano, aprecio o esforзo mais:
Код:
D:\JOGOS\GTA San Andreas\Server SAMP\gamemodes\teste.pwn(456) : warning: 219: local variable "i" shadows a variable at a preceding level
D:\JOGOS\GTA San Andreas\Server SAMP\gamemodes\teste.pwn(456) : error: 017: undefined symbol "CarroGroove"
D:\JOGOS\GTA San Andreas\Server SAMP\gamemodes\teste.pwn(456) : warning: 215: expression has no effect
D:\JOGOS\GTA San Andreas\Server SAMP\gamemodes\teste.pwn(456) : error: 001: expected token: ")", but found ";"
D:\JOGOS\GTA San Andreas\Server SAMP\gamemodes\teste.pwn(456) : error: 036: empty statement
D:\JOGOS\GTA San Andreas\Server SAMP\gamemodes\teste.pwn(456) : error fatal: 107: too many error messages on one line
pawn Код:
for(new i, e = sizeof(CarroGroove); i != e; ++i)
Reply
#8

pawn Код:
forward ReservedCar(carid);
public ReservedCar(carid)
{
    for(new i, e = 11; i != e; ++i)
    {
        if(CarroGroove[i] == carid)
        {
            return true;
        }
    }
    for(new i, e = 11; i != e; ++i)
    {
        if(CarroCops[i] == carid)
        {
            return true;
        }
    }
    return 0; // 450
}
Reply
#9

Acredito que estamos quase la :S
Percebi que de um code pro outro vocк tirou o sizeof e colocou 11 no lugar, devido ao numero de carros.
Agora o problema estб aqui:
pawn Код:
if(CarroGroove[i] == carid)
Код:
D:\JOGOS\GTA San Andreas\Server SAMP\gamemodes\teste.pwn(459) : error: 017: undefined symbol "CarroGroove"
D:\JOGOS\GTA San Andreas\Server SAMP\gamemodes\teste.pwn(459) : warning: 215: expression has no effect
D:\JOGOS\GTA San Andreas\Server SAMP\gamemodes\teste.pwn(459) : error: 001: expected token: ";", but found "]"
D:\JOGOS\GTA San Andreas\Server SAMP\gamemodes\teste.pwn(459) : error: 029: invalid expression, assumed zero
D:\JOGOS\GTA San Andreas\Server SAMP\gamemodes\teste.pwn(459) : error fatal: 107: too many error messages on one line
Reply
#10

Precisa colocar no topo:
pawn Код:
new CarroGroove[11];
new CarroCops[11];
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)