SA-MP Forums Archive
[Ajuda] Meio noob - 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] Meio noob (/showthread.php?tid=370985)



Meio noob - Don_Speed - 21.08.2012

Code
pawn Код:
forward Carro(playerid,vehicleid,health);
public Carro(playerid,vehicleid,health)
{
   new Float:health;//aviso aqui
   new veh;
   veh = GetPlayerVehicleID(playerid);
   GetVehicleHealth(veh, health);
   new engine, lights, alarm, doors, bonnet, boot, objective;
   if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
   {
       if(health < 10)
       {
           if(IsPlayerInAnyVehicle(playerid))
           {
               TogglePlayerControllable(playerid, 0);
               GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
               SetVehicleParamsEx(vehicleid, 0, 0, alarm, doors, bonnet, boot, objective);
           }
       }
       if(health > 10)
       {
           if(IsPlayerInAnyVehicle(playerid))
           {
               TogglePlayerControllable(playerid, 1);
               GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
               SetVehicleParamsEx(vehicleid, 1, 1, alarm, doors, bonnet, boot, objective);
           }
       }
   }
   return true;
}
pawn Код:
C:\Documents and Settings\Maurilio\Desktop\Transportando o Brasil - editado\gamemodes\TOB.pwn(1397) : warning 219: local variable "health" shadows a variable at a preceding level
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Warning.
Ele nao para de funfar e ainda explode



Re: Meio noob - iReflesh - 21.08.2012

Mude o nome da variavel


Re: Meio noob - Maklister - 21.08.2012

Toma

pawn Код:
forward Carro(playerid,vehicleid,Vida);
public Carro(playerid,vehicleid,Vida)
{
   new Float:Vida;
   new veh;
   veh = GetPlayerVehicleID(playerid);
   GetVehicleHealth(veh, Vida);
   new engine, lights, alarm, doors, bonnet, boot, objective;
   if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
   {
       if(Vida < 10)
       {
           if(IsPlayerInAnyVehicle(playerid))
           {
               TogglePlayerControllable(playerid, 0);
               GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
               SetVehicleParamsEx(vehicleid, 0, 0, alarm, doors, bonnet, boot, objective);
           }
       }
       if(Vida > 10)
       {
           if(IsPlayerInAnyVehicle(playerid))
           {
               TogglePlayerControllable(playerid, 1);
               GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
               SetVehicleParamsEx(vehicleid, 1, 1, alarm, doors, bonnet, boot, objective);
           }
       }
   }
   return true;
}
Mude o nome da sua Float de Salvamento caso tiver de health para Vida


Re: Meio noob - Don_Speed - 21.08.2012

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

pawn Код:
forward Carro(playerid,vehicleid,Vida);
public Carro(playerid,vehicleid,Vida)
{
   new Float:Vida;
   new veh;
   veh = GetPlayerVehicleID(playerid);
   GetVehicleHealth(veh, Vida);
   new engine, lights, alarm, doors, bonnet, boot, objective;
   if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
   {
       if(Vida < 10)
       {
           if(IsPlayerInAnyVehicle(playerid))
           {
               TogglePlayerControllable(playerid, 0);
               GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
               SetVehicleParamsEx(vehicleid, 0, 0, alarm, doors, bonnet, boot, objective);
           }
       }
       if(Vida > 10)
       {
           if(IsPlayerInAnyVehicle(playerid))
           {
               TogglePlayerControllable(playerid, 1);
               GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
               SetVehicleParamsEx(vehicleid, 1, 1, alarm, doors, bonnet, boot, objective);
           }
       }
   }
   return true;
}
Mude o nome da sua Float de Salvamento caso tiver de health para Vida

Nem deu ta com o msm aviso ¬¬



Re: Meio noob - iReflesh - 21.08.2012

pawn Код:
Carro(playerid,vehicleid,*health)
new Float:*health;//aviso aqui

Pqp, tem o mesmo nome cara faz oque falo


Re: Meio noob - Maklister - 21.08.2012

Tenta Assim agora

pawn Код:
forward Carro(playerid,vehicleid,VidaDoVeiculoDonSpeed);
public Carro(playerid,vehicleid,VidaDoVeiculoDonSpeed)
{
   new Float:VidaDoVeiculoDonSpeed;
   new veh;
   veh = GetPlayerVehicleID(playerid);
   GetVehicleHealth(veh, VidaDoVeiculoDonSpeed);
   new engine, lights, alarm, doors, bonnet, boot, objective;
   if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
   {
       if(VidaDoVeiculoDonSpeed < 10)
       {
           if(IsPlayerInAnyVehicle(playerid))
           {
               TogglePlayerControllable(playerid, 0);
               GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
               SetVehicleParamsEx(vehicleid, 0, 0, alarm, doors, bonnet, boot, objective);
           }
       }
       if(VidaDoVeiculoDonSpeed > 10)
       {
           if(IsPlayerInAnyVehicle(playerid))
           {
               TogglePlayerControllable(playerid, 1);
               GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
               SetVehicleParamsEx(vehicleid, 1, 1, alarm, doors, bonnet, boot, objective);
           }
       }
   }
   return true;
}



Re: Meio noob - Don_Speed - 21.08.2012

Msm aviso!


Re: Meio noob - iReflesh - 21.08.2012

Pqp o cara insiste ainda, nem chegou a testar o codigo.


Re: Meio noob - Don_Speed - 21.08.2012

Msm aviso!


Re: Meio noob - Maklister - 21.08.2012

Quote:
Originally Posted by Don_Speed
Посмотреть сообщение
Msm aviso!
vey na boa ? como ?

VidaDoVeiculoDonSpeed <<< tem isso definido ja O.O

posta o erro denovo com o ultimo code que te passei