08.03.2018, 23:42
Tente isso
Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { new string[128]; // Entrar Casa if(newkeys & KEY_SECONDARY_ATTACK) { if(!pInfo[playerid][dentrocasa]) { new timestamp = GetTickCount(); if(timestamp - inhousepickup[playerid] > 1000) { return 1; } format(STRX, sizeof(STRX), "Casaid %d", playericonhouse[playerid]); GetPlayerName(playerid, pInfo[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(playerid, hInfo[playericonhouse[playerid]][Virtualworld]); SetPlayerInterior(playerid, hInfo[playericonhouse[playerid]][Interior]); SetPlayerPos(playerid, hInfo[playericonhouse[playerid]][InteriorX], hInfo[playericonhouse[playerid]][InteriorY], hInfo[playericonhouse[playerid]][InteriorZ]); playerinterior[playerid] = hInfo[playericonhouse[playerid]][Interior]; pInfo[playerid][dentrocasa] = true; format(string, sizeof(string), "Bem vindo a sua casa", hInfo[playericonhouse[playerid]][ID]); SendClientMessage(playerid, -1, string); return 1; } if(hInfo[playericonhouse[playerid]][Locked] == true) return SendClientMessage(playerid, -1, "Essa casa estб trancada"); playerworld[playerid] = GetPlayerVirtualWorld(playerid); SetPlayerVirtualWorld(playerid, hInfo[playericonhouse[playerid]][Virtualworld]); SetPlayerInterior(playerid, hInfo[playericonhouse[playerid]][Interior]); SetPlayerPos(playerid, hInfo[playericonhouse[playerid]][InteriorX], hInfo[playericonhouse[playerid]][InteriorY], hInfo[playericonhouse[playerid]][InteriorZ]); playerinterior[playerid] = hInfo[playericonhouse[playerid]][Interior]; pInfo[playerid][dentrocasa] = true; format(string, sizeof(string), "Bem vindo б CASA ID %d", hInfo[playericonhouse[playerid]][ID]); SendClientMessage(playerid, -1, string); } else { if(GetPlayerInterior(playerid) == playerinterior[playerid]) { if(IsPlayerInRangeOfPoint(playerid, 2.0, hInfo[playericonhouse[playerid]][InteriorX], hInfo[playericonhouse[playerid]][InteriorY], hInfo[playericonhouse[playerid]][InteriorZ])) { SetPlayerPos(playerid, hInfo[playericonhouse[playerid]][iconx], hInfo[playericonhouse[playerid]][icony],hInfo[playericonhouse[playerid]][iconz]); SetPlayerInterior(playerid, playerworld[playerid]); SetPlayerVirtualWorld(playerid, 0); pInfo[playerid][dentrocasa] = false; format(string, sizeof(STRX), "Vocк saiu da casa %d.", hInfo[playericonhouse[playerid]][ID]); SendClientMessage(playerid, -1, string); } else { SendClientMessage(playerid, -1, "Vocк estб longe da porta!"); return 1; } } } } // Entrar Empresa if(newkeys & KEY_SECONDARY_ATTACK) { if(!pInfo[playerid][dentroEmpresa]) { new timestamp = GetTickCount(); if(timestamp - inEmpresapickup[playerid] > 1000) { return 1; } format(STRX, sizeof(STRX), "Empresa ID : %d", playericonEmpresa[playerid]); GetPlayerName(playerid, pInfo[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(playerid, eInfo[playericonEmpresa[playerid]][eVirtualworld]); SetPlayerInterior(playerid, eInfo[playericonEmpresa[playerid]][eInterior]); SetPlayerPos(playerid, eInfo[playericonEmpresa[playerid]][eInteriorX], eInfo[playericonEmpresa[playerid]][eInteriorY], eInfo[playericonEmpresa[playerid]][eInteriorZ]); playerinterior[playerid] = eInfo[playericonEmpresa[playerid]][eInterior]; pInfo[playerid][dentroEmpresa] = true; format(string, sizeof(string), "Sua Empresa de ID : %d ", eInfo[playericonEmpresa[playerid]][eID]); SendClientMessage(playerid, -1, string); return 1; } if(eInfo[playericonEmpresa[playerid]][eLocked] == true) return SendClientMessage(playerid, -1, "Empresa estб fechada"); playerworld[playerid] = GetPlayerVirtualWorld(playerid); SetPlayerVirtualWorld(playerid, eInfo[playericonEmpresa[playerid]][eVirtualworld]); SetPlayerInterior(playerid, eInfo[playericonEmpresa[playerid]][eInterior]); SetPlayerPos(playerid, eInfo[playericonEmpresa[playerid]][eInteriorX], eInfo[playericonEmpresa[playerid]][eInteriorY], eInfo[playericonEmpresa[playerid]][eInteriorZ]); playerinterior[playerid] = eInfo[playericonEmpresa[playerid]][eInterior]; pInfo[playerid][dentroEmpresa] = true; format(string, sizeof(string), "Empresa ID : %d.", eInfo[playericonEmpresa[playerid]][eID]); SendClientMessage(playerid, -1, string); } else { if(GetPlayerInterior(playerid) == playerinterior[playerid]) { if(IsPlayerInRangeOfPoint(playerid, 2.0, eInfo[playericonEmpresa[playerid]][eInteriorX], eInfo[playericonEmpresa[playerid]][eInteriorY], eInfo[playericonEmpresa[playerid]][eInteriorZ])) { SetPlayerPos(playerid, eInfo[playericonEmpresa[playerid]][eiconx], eInfo[playericonEmpresa[playerid]][eicony],eInfo[playericonEmpresa[playerid]][eiconz]); SetPlayerInterior(playerid, playerworld[playerid]); SetPlayerVirtualWorld(playerid, 0); pInfo[playerid][dentroEmpresa] = false; format(string, sizeof(STRX), "saiu da Empresa ID : %d.", eInfo[playericonEmpresa[playerid]][eID]); SendClientMessage(playerid, -1, string); } else { SendClientMessage(playerid, -1, "longe da porta!"); return 1; } } } } return 1; }