Portal SAMP
[Ajuda] Checagem não está correta - Versão de Impressão

+- Portal SAMP (https://portalsamp.com)
+-- Fórum: SA-MP (https://portalsamp.com/forumdisplay.php?fid=5)
+--- Fórum: Área de suporte (https://portalsamp.com/forumdisplay.php?fid=6)
+--- Tópico: [Ajuda] Checagem não está correta (/showthread.php?tid=1985)



Checagem não está correta - uyk - 27/12/2021

Alguém poderia me ajudar quando eu uso " if(teste1[playerid] <=0 || teste2[playerid] <=0)" e se o jogador estiver com a variável teste1 ou teste2 como false, ele consegue pegar o veículo.

Já tentei colocar acima do isplayerinrangeofpoint, mas não obtive sucesso e coloquei depois do if(newkeys == KEY_YES), tbm n obtive sucesso

Código PHP:
new teste1[MAX_PLAYERS], teste2[MAX_PLAYERS];

public 
OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
if(
IsPlayerInRangeOfPoint(playerid2.01882.2751,-2634.5898,13.5469) || IsPlayerInRangeOfPoint(playerid2.01174.2777,1352.8175,10.9219))
{
  if(teste1[playerid] <=|| teste2[playerid] <=0)
  {
if(
newkeys == KEY_YES)
{
new 
Float:Pos[3], MV;
GetPlayerPos(playeridPos[0], Pos[1], Pos[2]);
MV CreateVehicle(411Pos[0], Pos[1], Pos[2], 360, -1, -1, -1);
PutPlayerInVehicle(playeridMV0);
}
  }
}
return 
1;




RE: Checagem não está correta - Burunu - 27/12/2021

(27/12/2021 10:26)uyk Escreveu: Alguém poderia me ajudar quando eu uso " if(teste1[playerid] <=0 || teste1[playerid] <=0)" e o player está com a variavel true ele não consegue criar o veiculo?

Já tentei colocar acima do isplayerinrangeofpoint, mas não obtive sucesso e coloquei depois do if(newkeys == KEY_YES), tbm n obtive sucesso

Código PHP:
new teste1[MAX_PLAYERS], teste2[MAX_PLAYERS];

public 
OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
if(
IsPlayerInRangeOfPoint(playerid2.01882.2751,-2634.5898,13.5469) || IsPlayerInRangeOfPoint(playerid2.01174.2777,1352.8175,10.9219))
{
  if(teste1[playerid] <=|| teste1[playerid] <=0)
  {
if(
newkeys == KEY_YES)
{
new 
Float:Pos[3], MV;
GetPlayerPos(playeridPos[0], Pos[1], Pos[2]);
MV CreateVehicle(411Pos[0], Pos[1], Pos[2], 360, -1, -1, -1);
PutPlayerInVehicle(playeridMV0);
}
  }
}
return 
1;


Código PHP:
new teste1[MAX_PLAYERS], teste2[MAX_PLAYERS];

public 
OnPlayerKeyStateChange(playeridnewkeysoldkeys){
  if(
IsPlayerInRangeOfPoint(playerid2.01882.2751,-2634.5898,13.5469) || IsPlayerInRangeOfPoint(playerid2.0,1174.2777,1352.8175,10.9219)){
    if(teste1[playerid] <=|| teste2[playerid] <=0){
      if(
newkeys == KEY_YES){
       new 
Float:Pos[3], MV;
       
GetPlayerPos(playeridPos[0], Pos[1], Pos[2]);
       
MV CreateVehicle(411Pos[0], Pos[1], Pos[2], 360, -1, -1, -1);
       
PutPlayerInVehicle(playeridMV0);
     }
   }
 }
 return 
1;




RE: Checagem não está correta - uyk - 30/12/2021

Amigo, testei aqui e não funcionou.


RE: Checagem não está correta - faraday - 30/12/2021

(30/12/2021 16:11)uyk Escreveu: Amigo, testei aqui e não funcionou.

Código:
new teste1[MAX_PLAYERS], teste2[MAX_PLAYERS];
   
    public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
    {
        if(newkeys & KEY_YES && (IsPlayerInRangeOfPoint(playerid, 2.0, 1882.2751,-2634.5898,13.5469) || IsPlayerInRangeOfPoint(playerid, 2.0, 1174.2777,1352.8175,10.9219)))
        {
            if(teste1[playerid] <= 0 || teste2[playerid] <= 0)
                return 1;
               
            new Float:Pos[3], MV;
            GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
            MV = CreateVehicle(411, Pos[0], Pos[1], Pos[2], 360, -1, -1, -1);
            PutPlayerInVehicle(playerid, MV, 0);
        }
        return 1;
    }



RE: Checagem não está correta - uyk - 31/12/2021

Também não funcionou, amigo.

Este que você mandou o jogador fica impossibilitado de pegar o veículo.


RE: Checagem não está correta - DeviceBlack - 02/01/2022

'-' sem explicação alguma fica dificil '-'
Código PHP:
new
    
teste1[MAX_PLAYERS],
    
teste2[MAX_PLAYERS];

public 
OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
    if(
IsPlayerInRangeOfPoint(playerid2.01882.2751,-2634.5898,13.5469) || IsPlayerInRangeOfPoint(playerid2.01174.2777,1352.8175,10.9219))
    {
        if(
teste1[playerid] || teste2[playerid]) return 0;
        if(
newkeys KEY_YES)
        {
            new 
Float:Pos[3], MV;
            
GetPlayerPos(playeridPos[0], Pos[1], Pos[2]);
            
MV CreateVehicle(411Pos[0], Pos[1], Pos[2], 360, -1, -1, -1);
            
PutPlayerInVehicle(playeridMV0);
        }
    }
    return 
1;




RE: Checagem não está correta - uyk - 02/01/2022

(02/01/2022 02:49)DeviceBlack Escreveu: '-' sem explicação alguma fica dificil '-'
Código PHP:
new
    
teste1[MAX_PLAYERS],
    
teste2[MAX_PLAYERS];

public 
OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
    if(
IsPlayerInRangeOfPoint(playerid2.01882.2751,-2634.5898,13.5469) || IsPlayerInRangeOfPoint(playerid2.01174.2777,1352.8175,10.9219))
    {
        if(
teste1[playerid] || teste2[playerid]) return 0;
        if(
newkeys KEY_YES)
        {
            new 
Float:Pos[3], MV;
            
GetPlayerPos(playeridPos[0], Pos[1], Pos[2]);
            
MV CreateVehicle(411Pos[0], Pos[1], Pos[2], 360, -1, -1, -1);
            
PutPlayerInVehicle(playeridMV0);
        }
    }
    return 
1;

Eu tinha colocado uma explicação, mas foi muito superficial, dei uma editada.

"Alguém poderia me ajudar quando eu uso " if(teste1[playerid] <=0 || teste2[playerid] <=0)" e se o jogador estiver com a variável teste1 ou teste2 como false, ele consegue pegar o veículo."