SA-MP Forums Archive
[Ajuda] Erro na public ! - 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: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] Erro na public ! (/showthread.php?tid=454458)



Erro na public ! - PetterAdriano - 29.07.2013

Pessoal criei essa public para mostrar pro passageiro no velocimetro , Motor: On , Motor: OFF
Ai da um erro olhe

erro:

PHP код:
BMG.pwn(39124) : error 025: function heading differs from prototype 
public:

PHP код:
public MotorPet(newstatevehicleidispassenger)
{
 new 
velopet5[128];
 for (new 
i=0i<MAX_PLAYERSi++)
 {
    if(
newstate == PLAYER_STATE_PASSENGER)
    {
            if(
motor[i] == 1)
            {
            
format(velopet5,sizeof(velopet5),"~r~~h~~h~~h~~h~Motor: ~w~Ligado");
            }
            else if(
motor[i] == 0)
            {
            
format(velopet5,sizeof(velopet5),"~r~~h~~h~~h~~h~Motor: ~w~Desligado");
            }
            
TextDrawSetString(MotorOnOFF[i], velopet5);
    }
}




Re: Erro na public ! - PT - 29.07.2013

tenta so assim

pawn Код:
public MotorPet(vehicleid)
{
    new velopet5[128];
    for (new i=0; i<MAX_PLAYERS; i++)
    {
        if(newstate == PLAYER_STATE_PASSENGER)
        {
            if(motor[i] == 1)
            {
                format(velopet5,sizeof(velopet5),"~r~~h~~h~~h~~h~Motor: ~w~Ligado");
            }
            else if(motor[i] == 0)
            {
                format(velopet5,sizeof(velopet5),"~r~~h~~h~~h~~h~Motor: ~w~Desligado");
            }
            TextDrawSetString(MotorOnOFF[i], velopet5);
        }
    }
}



Re: Erro na public ! - PetterAdriano - 29.07.2013

Quote:
Originally Posted by PT
Посмотреть сообщение
tenta so assim

pawn Код:
public MotorPet(vehicleid)
{
    new velopet5[128];
    for (new i=0; i<MAX_PLAYERS; i++)
    {
        if(newstate == PLAYER_STATE_PASSENGER)
        {
            if(motor[i] == 1)
            {
                format(velopet5,sizeof(velopet5),"~r~~h~~h~~h~~h~Motor: ~w~Ligado");
            }
            else if(motor[i] == 0)
            {
                format(velopet5,sizeof(velopet5),"~r~~h~~h~~h~~h~Motor: ~w~Desligado");
            }
            TextDrawSetString(MotorOnOFF[i], velopet5);
        }
    }
}
deu erro,

PHP код:
C:\Users\PetrickSchoba\Desktop\BRPG\gamemodes\BMG.pwn(39124) : error 025: function heading differs from prototype
C
:\Users\PetrickSchoba\Desktop\BRPG\gamemodes\BMG.pwn(39129) : error 017undefined symbol "newstate"
Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase 



Re: Erro na public ! - Juniiro3 - 29.07.2013

1 - Verifique se no seu gm tem a funзгo:

pawn Код:
forward MotorPet(newstate, vehicleid, ispassenger);
E eu acho que vocк nгo precisa cirar uma public sendo qe jб existe uma com essas funзхes:

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
Dai dentro dessa public /\ vocк faзa seus cуdigos


Re: Erro na public ! - PT - 29.07.2013

desculpa errei

pawn Код:
forward MotorPet(vehicleid);
public MotorPet(vehicleid)
{
    new velopet5[128];
    for (new i=0; i<MAX_PLAYERS; i++)
    {
        if(GetPlayerState(i) == PLAYER_STATE_DRIVER)
        {
            if(motor[i] == 1)
            {
                format(velopet5,sizeof(velopet5),"~r~~h~~h~~h~~h~Motor: ~w~Ligado");
            }
            else if(motor[i] == 0)
            {
                format(velopet5,sizeof(velopet5),"~r~~h~~h~~h~~h~Motor: ~w~Desligado");
            }
            TextDrawSetString(MotorOnOFF[i], velopet5);
        }
    }
}



Re: Erro na public ! - PetterAdriano - 29.07.2013

Quote:
Originally Posted by Juniiro3
Посмотреть сообщение
1 - Verifique se no seu gm tem a funзгo:

pawn Код:
forward MotorPet(newstate, vehicleid, ispassenger);
E eu acho que vocк nгo precisa cirar uma public sendo qe jб existe uma com essas funзхes:

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
Dai dentro dessa public /\ vocк faзa seus cуdigos
Mais dentro dessa public
PHP код:
public OnPlayerStateChange(playeridnewstateoldstate
Nгo tem
PHP код:
vehicleidispassenger 



Re: Erro na public ! - DiiMeNoR - 29.07.2013

PHP код:
public MotorPet(newstatevehicleidispassenger[]) {
    new 
velopet5[128];
    for (new 
0MAX_PLAYERSi++) {
        if (
newstate == PLAYER_STATE_PASSENGER) {
            if (
motor[i] == 1) {
                
format(velopet5sizeof(velopet5), "~r~~h~~h~~h~~h~Motor: ~w~Ligado");
            } else if (
motor[i] == 0) {
                
format(velopet5sizeof(velopet5), "~r~~h~~h~~h~~h~Motor: ~w~Desligado");
            }
            
TextDrawSetString(MotorOnOFFvelopet5);
        }
    }




Re: Erro na public ! - PetterAdriano - 29.07.2013

Quote:
Originally Posted by DiiMeNoR
Посмотреть сообщение
PHP код:
public MotorPet(newstatevehicleidispassenger[]) {
    new 
velopet5[128];
    for (new 
0MAX_PLAYERSi++) {
        if (
newstate == PLAYER_STATE_PASSENGER) {
            if (
motor[i] == 1) {
                
format(velopet5sizeof(velopet5), "~r~~h~~h~~h~~h~Motor: ~w~Ligado");
            } else if (
motor[i] == 0) {
                
format(velopet5sizeof(velopet5), "~r~~h~~h~~h~~h~Motor: ~w~Desligado");
            }
            
TextDrawSetString(MotorOnOFFvelopet5);
        }
    }

PHP код:
C:\Users\PetrickSchoba\Desktop\BRPG\gamemodes\BMG.pwn(39122) : error 025: function heading differs from prototype
C
:\Users\PetrickSchoba\Desktop\BRPG\gamemodes\BMG.pwn(39131) : error 035argument type mismatch (argument 1)
Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase 
Deu esses erros.