[AJUDA]Problemas no OnPlayerKeyStateChange
#1

Bom, tenho um sistema de casas e hoje pela manhг terminei meu sistema de empresas.
tava tudo ok, atй eu fazer a parada de entrar/sair na empresa

Quando eu tiro o da empresa, funciona normalmente o entrar/sair das casas
agora quando eu coloco o da empresa, o da empresa funciona normalmente
e o da casa, me teleporta pra uma posiзгo nada haver..

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys == KEY_SECONDARY_ATTACK)
    {
        for(new i = 0; i <= TotalEmpresas; ++i)
        {
            if(IsPlayerInRangeOfPoint(playerid, 3, BusinessInfo[i][SaidaX], BusinessInfo[i][SaidaY], BusinessInfo[i][SaidaZ]))
            if(BusinessInfo[i][Interior] == 0) return SendClientMessage(playerid, -1, "Empresa desativada temporбriamente.");
            {
                if(BusinessInfo[i][Chave] == 0)
                {
                    SetPlayerInterior(playerid, BusinessInfo[i][Interior]);
                    SetPlayerVirtualWorld(playerid, BusinessInfo[i][VirtualWorld]);
                    SetPlayerPos(playerid, BusinessInfo[i][EntradaX], BusinessInfo[i][EntradaY], BusinessInfo[i][EntradaZ]);
                }
                else { GameTextForPlayer(playerid, "EMPRESA FECHADA", 3000, 1); }
            }
            if(IsPlayerInRangeOfPoint(playerid, 3, BusinessInfo[i][EntradaX], BusinessInfo[i][EntradaY], BusinessInfo[i][EntradaZ]))
            {
                if(GetPlayerVirtualWorld(playerid) == BusinessInfo[i][VirtualWorld])
                {
                    SetPlayerInterior(playerid, 0);
                    SetPlayerVirtualWorld(playerid, 0);
                    SetPlayerPos(playerid, BusinessInfo[i][SaidaX], BusinessInfo[i][SaidaY], BusinessInfo[i][SaidaZ]);
                }
            }
        }
        for(new i = 0; i <= TotalCasas; ++i)
        {
            if(IsPlayerInRangeOfPoint(playerid, 3, HouseInfo[i][SaidaX], HouseInfo[i][SaidaY], HouseInfo[i][SaidaZ]))
            {
                if(HouseInfo[i][Chave] == 0)
                {
                    SetPlayerInterior(playerid, HouseInfo[i][Interior]);
                    SetPlayerVirtualWorld(playerid, HouseInfo[i][VirtualWorld]);
                    SetPlayerPos(playerid, HouseInfo[i][EntradaX], HouseInfo[i][EntradaY], HouseInfo[i][EntradaZ]);
                }
                else { GameTextForPlayer(playerid, "CASA FECHADA", 3000, 1); }
            }
            if(IsPlayerInRangeOfPoint(playerid, 3, HouseInfo[i][EntradaX], HouseInfo[i][EntradaY], HouseInfo[i][EntradaZ]))
            {
                if(GetPlayerVirtualWorld(playerid) == HouseInfo[i][VirtualWorld])
                {
                    SetPlayerInterior(playerid, 0);
                    SetPlayerVirtualWorld(playerid, 0);
                    SetPlayerPos(playerid, HouseInfo[i][SaidaX], HouseInfo[i][SaidaY], HouseInfo[i][SaidaZ]);
                }
            }
        }
    }
    return 1;
}
Reply
#2

Tente.
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys == KEY_SECONDARY_ATTACK)
    {
        for(new i = 0; i < sizeof(TotalEmpresas); ++i)
        {
            if(IsPlayerInRangeOfPoint(playerid, 3, BusinessInfo[i][SaidaX], BusinessInfo[i][SaidaY], BusinessInfo[i][SaidaZ]))
            if(BusinessInfo[i][Interior] == 0) return SendClientMessage(playerid, -1, "Empresa desativada temporбriamente.");
            {
                if(BusinessInfo[i][Chave] == 0)
                {
                    SetPlayerInterior(playerid, BusinessInfo[i][Interior]);
                    SetPlayerVirtualWorld(playerid, BusinessInfo[i][VirtualWorld]);
                    SetPlayerPos(playerid, BusinessInfo[i][EntradaX], BusinessInfo[i][EntradaY], BusinessInfo[i][EntradaZ]);
                }
                else { GameTextForPlayer(playerid, "EMPRESA FECHADA", 3000, 1); }
            }
            if(IsPlayerInRangeOfPoint(playerid, 3, BusinessInfo[i][EntradaX], BusinessInfo[i][EntradaY], BusinessInfo[i][EntradaZ]))
            {
                if(GetPlayerVirtualWorld(playerid) == BusinessInfo[i][VirtualWorld])
                {
                    SetPlayerInterior(playerid, 0);
                    SetPlayerVirtualWorld(playerid, 0);
                    SetPlayerPos(playerid, BusinessInfo[i][SaidaX], BusinessInfo[i][SaidaY], BusinessInfo[i][SaidaZ]);
                }
            }
        }
        for(new i = 0; i < sizeof(TotalCasas); ++i)
        {
            if(IsPlayerInRangeOfPoint(playerid, 3, HouseInfo[i][SaidaX], HouseInfo[i][SaidaY], HouseInfo[i][SaidaZ]))
            {
                if(HouseInfo[i][Chave] == 0)
                {
                    SetPlayerInterior(playerid, HouseInfo[i][Interior]);
                    SetPlayerVirtualWorld(playerid, HouseInfo[i][VirtualWorld]);
                    SetPlayerPos(playerid, HouseInfo[i][EntradaX], HouseInfo[i][EntradaY], HouseInfo[i][EntradaZ]);
                }
                else { GameTextForPlayer(playerid, "CASA FECHADA", 3000, 1); }
            }
            if(IsPlayerInRangeOfPoint(playerid, 3, HouseInfo[i][EntradaX], HouseInfo[i][EntradaY], HouseInfo[i][EntradaZ]))
            {
                if(GetPlayerVirtualWorld(playerid) == HouseInfo[i][VirtualWorld])
                {
                    SetPlayerInterior(playerid, 0);
                    SetPlayerVirtualWorld(playerid, 0);
                    SetPlayerPos(playerid, HouseInfo[i][SaidaX], HouseInfo[i][SaidaY], HouseInfo[i][SaidaZ]);
                }
            }
        }
    }
    return 1;
}
Reply
#3

Funcionou, obrigado +rep.
Reply
#4

blz.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)