function main()
if not isSampLoaded() then return end
while not isSampAvailable() do wait (100) end
while not sampIsLocalPlayerSpawned() do wait (100) end
local _, id = sampGetPlayerIdByCharHandle(PLAYER_PED)
while sampGetPlayerScore(id) == 0 do wait(100) end
if isCharInArea3d(PLAYER_PED, float cornerAX, float cornerAY, float cornerAZ, float cornerBX, float cornerBY, float cornerBZ, false) or isCharInArea3d(PLAYER_PED, float cornerAX, float cornerAY, float cornerAZ, float cornerBX, float cornerBY, float cornerBZ, false) then
sampProcessChatInput('/fog')
end
wait(-1)
end