14.02.2012, 14:26
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;
}