[Ajuda] OnPlayerKeyStateChange
#9

Quote:
Originally Posted by JohnBlack
Посмотреть сообщение
Vocк tentou o que eu sugeri?
Sim tentei, estou usando apenas umas vez o if(newkeys & KEY_SECONDARY_ATTACK) e dei uma analisada nos return. O que me parece aqui й, quando eu aperto o enter/f as duas variбveis estгo falsa (pInfo[playerid][dentrocasa]) , (pInfo[playerid][dentroEmpresa]) entгo ele vai chamar as duas funзхes juntos.

Estou tentando elaborar uma forma de que antes de chegar a as variбvel (pInfo[playerid][dentrocasa]) , (pInfo[playerid][dentroEmpresa]) ele verifique se o jogador esta em cima da pickup.


exemplo.
PHP код:

if(playerid estб na pickup casa)
{
   if(!
pInfo[playerid][dentrocasa])
   {
     
// code
   
}
}
if(
playerid estб na pickup empresa)
{
   if(!
pInfo[playerid][dentroEmpresa])
   {
     
// code
   
}

Acredito que essa seja a soluзгo....

Edit: Resolvido do seguinte modo , nгo sei se й a melhor forma, se alguйm achar um modo melhor eu agradeзo

PHP код:

// OnPlayerKeyStateChange
public OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
    new 
string[128];
        
    if(
newkeys KEY_SECONDARY_ATTACK)
    {
        new 
timestamp GetTickCount();
        
//     =-=-=-=-=-=-=-=-=-=-=-= Entrar Casa =-=-=-=-=-=-=-=-=-=-=-=
        
if(!pInfo[playerid][dentrocasa] && timestamp inhousepickup[playerid] < 1000)
        {    
            
SendClientMessage(playerid, -1" CASA ");
            if(
timestamp inhousepickup[playerid] > 1000)
            {
                return 
1;
            }
            
            
format(STRXsizeof(STRX), "Casaid %d"playericonhouse[playerid]);
            
GetPlayerName(playeridpInfo[playerid][Nome], 24);
            if(
hInfo[playericonhouse[playerid]][SemInt] == 1) return SendClientMessage(playerid, -1"Casa sem portas");
            
            if(
strcmp(hInfo[playericonhouse[playerid]][Dono], pInfo[playerid][Nome], true) == 0)
            {
                
playerworld[playerid] = GetPlayerVirtualWorld(playerid);
                
SetPlayerVirtualWorld(playeridhInfo[playericonhouse[playerid]][Virtualworld]);
                
SetPlayerInterior(playeridhInfo[playericonhouse[playerid]][Interior]);
                
SetPlayerPos(playeridhInfo[playericonhouse[playerid]][InteriorX], hInfo[playericonhouse[playerid]][InteriorY], hInfo[playericonhouse[playerid]][InteriorZ]);
                
playerinterior[playerid] = hInfo[playericonhouse[playerid]][Interior];
                
pInfo[playerid][dentrocasa] = true;
                
format(stringsizeof(string), "Bem vindo a sua casa"hInfo[playericonhouse[playerid]][ID]);
                
SendClientMessage(playerid, -1string);
                return 
1;
            }
            
            if(
hInfo[playericonhouse[playerid]][Locked] == true) return SendClientMessage(playerid, -1"Essa casa estб trancada"); 
            
            
playerworld[playerid] = GetPlayerVirtualWorld(playerid);
            
SetPlayerVirtualWorld(playeridhInfo[playericonhouse[playerid]][Virtualworld]);
            
SetPlayerInterior(playeridhInfo[playericonhouse[playerid]][Interior]);
            
SetPlayerPos(playeridhInfo[playericonhouse[playerid]][InteriorX], hInfo[playericonhouse[playerid]][InteriorY], hInfo[playericonhouse[playerid]][InteriorZ]);
            
playerinterior[playerid] = hInfo[playericonhouse[playerid]][Interior];
            
pInfo[playerid][dentrocasa] = true;
            
format(stringsizeof(string), "Bem vindo б CASA ID %d"hInfo[playericonhouse[playerid]][ID]);
            
SendClientMessage(playerid, -1string);
        }
        else
        {
            if(
GetPlayerInterior(playerid) == playerinterior[playerid] && pInfo[playerid][dentrocasa])
            {
                if(
IsPlayerInRangeOfPoint(playerid2.0hInfo[playericonhouse[playerid]][InteriorX], hInfo[playericonhouse[playerid]][InteriorY], hInfo[playericonhouse[playerid]][InteriorZ]))
                {
                    
SetPlayerPos(playeridhInfo[playericonhouse[playerid]][iconx], hInfo[playericonhouse[playerid]][icony],hInfo[playericonhouse[playerid]][iconz]);
                    
SetPlayerInterior(playeridplayerworld[playerid]);
                    
SetPlayerVirtualWorld(playerid0);
                    
pInfo[playerid][dentrocasa] = false;
                    
format(stringsizeof(STRX), "Vocк saiu da casa %d."hInfo[playericonhouse[playerid]][ID]);
                    
SendClientMessage(playerid, -1string);
                }
                else
                {
                    
SendClientMessage(playerid, -1"Vocк estб longe da porta!");
                    return 
1;
                }
            }
        }
        
//     =-=-=-=-=-=-=-=-=-=-=-= Entrar Casa End =-=-=-=-=-=-=-=-=-=-=-=
        
if(!pInfo[playerid][dentroEmpresa] && timestamp inEmpresapickup[playerid] < 1000)
        {    
            
SendClientMessage(playerid, -1" Empresa ");
            if(
timestamp inEmpresapickup[playerid] > 1000)
            {    
                return 
1;
            }
            
            
format(STRXsizeof(STRX), "Empresa ID : %d"playericonEmpresa[playerid]);
            
GetPlayerName(playeridpInfo[playerid][Nome], 24);
            if(
eInfo[playericonEmpresa[playerid]][eSemInt] == 1) return SendClientMessage(playerid, -1"nгo tem portas!");
            
            if(
strcmp(eInfo[playericonEmpresa[playerid]][eDonoEmpresa], pInfo[playerid][Nome], true) == 0)
            {
                
playerworld[playerid] = GetPlayerVirtualWorld(playerid);
                
SetPlayerVirtualWorld(playerideInfo[playericonEmpresa[playerid]][eVirtualworld]);
                
SetPlayerInterior(playerideInfo[playericonEmpresa[playerid]][eInterior]);
                
SetPlayerPos(playerideInfo[playericonEmpresa[playerid]][eInteriorX], eInfo[playericonEmpresa[playerid]][eInteriorY], eInfo[playericonEmpresa[playerid]][eInteriorZ]);
                
playerinterior[playerid] = eInfo[playericonEmpresa[playerid]][eInterior];
                
pInfo[playerid][dentroEmpresa] = true;
                
format(stringsizeof(string), "Sua Empresa de ID : %d "eInfo[playericonEmpresa[playerid]][eID]);
                
SendClientMessage(playerid, -1string);
                return 
1;
            }
            
            if(
eInfo[playericonEmpresa[playerid]][eLocked] == true) return SendClientMessage(playerid, -1"Empresa estб fechada"); 
            
            
playerworld[playerid] = GetPlayerVirtualWorld(playerid);
            
SetPlayerVirtualWorld(playerideInfo[playericonEmpresa[playerid]][eVirtualworld]);
            
SetPlayerInterior(playerideInfo[playericonEmpresa[playerid]][eInterior]);
            
SetPlayerPos(playerideInfo[playericonEmpresa[playerid]][eInteriorX], eInfo[playericonEmpresa[playerid]][eInteriorY], eInfo[playericonEmpresa[playerid]][eInteriorZ]);
            
playerinterior[playerid] = eInfo[playericonEmpresa[playerid]][eInterior];
            
pInfo[playerid][dentroEmpresa] = true;
            
format(stringsizeof(string), "Empresa ID : %d."eInfo[playericonEmpresa[playerid]][eID]);
            
SendClientMessage(playerid, -1string);
        }
        else
        {
            if(
GetPlayerInterior(playerid) == playerinterior[playerid] && pInfo[playerid][dentroEmpresa])
            {
                if(
IsPlayerInRangeOfPoint(playerid2.0eInfo[playericonEmpresa[playerid]][eInteriorX], eInfo[playericonEmpresa[playerid]][eInteriorY], eInfo[playericonEmpresa[playerid]][eInteriorZ]))
                {
                    
SetPlayerPos(playerideInfo[playericonEmpresa[playerid]][eiconx], eInfo[playericonEmpresa[playerid]][eicony],eInfo[playericonEmpresa[playerid]][eiconz]);
                    
SetPlayerInterior(playeridplayerworld[playerid]);
                    
SetPlayerVirtualWorld(playerid0);
                    
pInfo[playerid][dentroEmpresa] = false;
                    
format(stringsizeof(STRX), "Vocк saiu da Empresa ID : %d."eInfo[playericonEmpresa[playerid]][eID]);
                    
SendClientMessage(playerid, -1string);
                }
                else
                {
                    
SendClientMessage(playerid, -1"Vocк estб longe da porta");
                    return 
1;
                }
            }
        }
    }
        
    return 
1;

Reply


Messages In This Thread
OnPlayerKeyStateChange - by Lontresca - 08.03.2018, 23:14
Re: OnPlayerKeyStateChange - by KoloradO - 08.03.2018, 23:42
Re: OnPlayerKeyStateChange - by Lontresca - 09.03.2018, 00:04
Re: OnPlayerKeyStateChange - by FerrariL - 09.03.2018, 00:41
Re: OnPlayerKeyStateChange - by JohnBlack - 09.03.2018, 00:43
Re: OnPlayerKeyStateChange - by Lontresca - 09.03.2018, 01:18
Re: OnPlayerKeyStateChange - by JohnBlack - 09.03.2018, 01:21
Re: OnPlayerKeyStateChange - by FerrariL - 09.03.2018, 01:22
Re: OnPlayerKeyStateChange - by Lontresca - 09.03.2018, 01:37

Forum Jump:


Users browsing this thread: 2 Guest(s)